You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Same feature as is implemented in zabbix_sender -N or --with-ns. Useful when converting snmp traps to zabbix trapper and snmp traps are arriving within same second.
The text was updated successfully, but these errors were encountered:
I've created patch for sender.py, it adds ns parameter to data which is sent to zabbix server/proxy.
`--- sender.py.20220916_01 2022-09-16 08:20:25.632689524 +0300
+++ sender.py 2022-09-16 08:31:13.880987429 +0300
@@ -109,11 +109,14 @@
:type clock: int
:param clock: Unix timestamp. Current time will used if not specified.
:type ns: int
:param ns: Unix timestamp, nanosecond part. Current time will used if not specified.
from pyzabbix import ZabbixMetric
ZabbixMetric('localhost', 'cpu[usage]', 20)
"""
def init(self, host, key, value, clock=None):
def init(self, host, key, value, clock=None, ns=None):
self.host = str(host)
self.key = str(key)
self.value = str(value)
@@ -122,6 +125,11 @@
self.clock = int(clock)
else:
raise ValueError('Clock must be time in unixtime format')
if ns:
if isinstance(ns, (float, int)):
self.ns = int(ns)
else:
raise ValueError('Clock ns must be time in unixtime format')
def repr(self):
"""Represent detailed ZabbixMetric view."""
`
Seems to be working on my installation.
Same feature as is implemented in zabbix_sender -N or --with-ns. Useful when converting snmp traps to zabbix trapper and snmp traps are arriving within same second.
The text was updated successfully, but these errors were encountered: