https://github.com/kmomberg/pyZabbixSender

https://www.cnblogs.com/jiayun/archive/2015/12/17/5054915.html

 

# Creating a sender object
z = pyZabbixSender(server="zabbix-server", port=10051)

# Adding data (without timestamp)
z.addData(hostname="test_host", key="test_trap_1", value="12")
z.addData("test_host", "test_trap_2", "2.43")

# Adding data (with timestamp)
z.addData("test_host", "test_trap_2", "2.43", 1365787627)

# Ready to send your data?
results = z.sendData()

# Check if everything was sent as expected
if results[0][0] != z.RC_OK:
  print "oops!"

# Clear internal data to start populating again
z.clearData()

# Wants to send a single data point right now?
z.sendSingle("test_host","test_trap","12")

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注