zabbix: fping failed: simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

595 views Asked by At


I want to use ICMPPING in zabbix as a simple check. I know it uses fping. But I want to override the fping program to do my desired work. fping utility can give me the result of an ICMP request from the system that runs it. I mean it investigates the availability of an IP address from just one server. But I want to use an API which is performed by the use of CURL that returns the results of availability of an IP address from multiple servers. I wrote the program with python and it is working well. But I don't know how to send the result to zabbix! By now it simply produce 1 if the IP is online and 0 if it is offline. I think I should submit the result in a JSON like format, but I do not know the right syntax!! I formerly wrote a script for discovering LVM partitions and submit the result with the following JSON synax:
{"data":[{"{#MDNAME}":"md1"},{"{#MDNAME}":"md127"},{"{#MDNAME}":"md2"}]}
But I don't know the correct json syntax for the icmpping!
Any help is appreciated

1

There are 1 answers

3
Richlv On BEST ANSWER

It does not use JSON, Zabbix just parses the fping output - you would have to emulate that.

For example, fping output with the default settings and 3 packets sent looks like this:

> fping -C 3 127.0.0.1
127.0.0.1 : [0], 96 bytes, 0.07 ms (0.07 avg, 0% loss)
127.0.0.1 : [1], 96 bytes, 0.06 ms (0.06 avg, 0% loss)
127.0.0.1 : [2], 96 bytes, 0.07 ms (0.06 avg, 0% loss)