hookenz
hookenz

Reputation: 38889

How do I use the Zabbix 2.2 JSON API to determine host status?

I'm having to modify a Zabbix traffic light web page that shows the general availability or status of some hosts.

The update is because I'm ugrading to version 2.2 from 1.8. The status field is no longer used.

According to what I've been reading on the web and off the zabbix website the general way to determine availability is now to use agent.ping and an agent.ping.nodata trigger.

How do I implement that in practice?

https://www.zabbix.com/documentation/2.2/manual/api/reference/trigger/get

Upvotes: 1

Views: 5061

Answers (1)

Tom M.
Tom M.

Reputation: 136

It's been a while since you asked this question, nevertheless one might find my reply useful I hope :)

You could consider examining the host object, where the status of the interface is being reflected (either Zabbix Agent, SNMP, IPMI, JMX).

https://www.zabbix.com/documentation/2.2/manual/api/reference/host/object

This has downsides, however. The specific interface could be reported "down" due to many reasons (credentials changed, firewall was changed, daemon died etc.). That's why I chose this approach:

  • having one item which pings regularly
  • having one item which pulls data regularly (in my case Zabbix Agent or SNMP)
  • having one trigger for "ping fails", another for "Zabbix Agent fails" (or SNMP fails). That's where you'd use nodata(). Assign it a medium severity.
  • having one more trigger which checks for ping and zabbix agent failure (with a high severity) - that's my dead host detection. It gets escalated 7x24.
  • optional: define dependencies on the triggers to that you only get one event (host dead) if both ping & snmp/Zabbix fail
  • put all this into one template and assign it the respective hosts

Now you can rely on the "host dead" trigger (it's always available no matter if you do ping & snmp/zabbix/jmx/whatever) - which is much more relevant than the default "interface works" status field from the host object.

Upvotes: 2

Related Questions