Ad Widget

Collapse

Determine the number of active triggers?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peter_field
    Member
    • Jun 2006
    • 71

    #1

    Determine the number of active triggers?

    Is there any way to determine the number of active triggers?

    I am responsible for a number of Zabbix servers. The number of triggers that go up and down daily on the systems I monitor make it almost impossible to know if all the triggers have cleared without logging in to check, if I got a daily email with the number of active triggers it would make life a lot easier.

    I already have all the systems sending me an email every day, what I need is an internal item like zabbix[triggers] that returns the total active triggers on the system that I could monitor and put into the action.

    perhaps:
    zabbix[triggers_active]

    unless there is something already?

    Thanks guys
  • peter_field
    Member
    • Jun 2006
    • 71

    #2
    Ok, just added a UserParameter to agent running on Zabbix server

    OK, I found a workaround, I simply added a UserParameter to the Zabbix server's agent config as follows:

    UserParameter=uZaTriggersOn,echo "SELECT count(t.triggerid) FROM triggers t, functions f, items i, hosts h WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.status=0 AND i.hostid=h.hostid AND h.status=0 AND t.status=0 AND t.value=1;"|mysql zabbix -s -u root

    and then monitored that item, and it works a treat, now I get a daily Zabbix "heartbeat" telling me that the Zabbix server is up, and the number of triggers that are on at the time. Now all I have to do when I get up in the morning is count the number of emails to make sure all my Zabbix servers are up, and in the subject I can see if there is a problem with any of them. Too easy.

    Hope this helps someone else.

    Comment

    • peter_field
      Member
      • Jun 2006
      • 71

      #3
      Problem with select statement and multiple functions on a trigger

      In my previous post, the SELECT statement to get the number of active triggers has a bug (I got the SELECT statement from report1.php in 1.1.2 so it has the bug also) - when a trigger has more than one function, it reports the wrong value.

      Correct SELECT statement is below (this at least works on MySQL, SELECT statement would need to be checked on other database servers):

      UserParameter=uZaTriggersOn,echo "SELECT count(DISTINCT t.triggerid) FROM triggers t, functions f, items i, hosts h WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.status=0 AND i.hostid=h.hostid AND h.status=0 AND t.status=0 AND t.value=1;"|mysql zabbix -s -u root

      Comment

      Working...