Ad Widget

Collapse

Trigger on Last Check

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dminstrel
    Member
    • Apr 2005
    • 72

    #1

    Trigger on Last Check

    Hello,

    I'd like to be able to define a Trigger to fire if the Last Check time for an Item goes over a certain threshold. E.g., raise an alert if the last check is more than 5 hours. Is this possible?

    Thanks,
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    Short answer, no.

    Long answer, yes. You'd need to write an external script to query the DB.

    Here's a simple shellscript I wrote which will query the DB for the item you give on the command line and return the number of seconds since the item was checked. Please note if the Zabbix server and the MySQL server are on different hosts you may run into a time synchronization issue. You can use this shellscript as an external check against the DB.

    Code:
    #!/bin/sh
    
    OPTS=" --skip-column-names"  #options to connect to MySQL such as -h <host>
    DB="zabbix"   #The name of the Zabbix DB
    
    MYSQLSTR="$OPTS $DB"
    QUERYSTR="select unix_timestamp()-lastclock from items where itemid=$1"
    
    echo $QUERYSTR | mysql $MYSQLSTR
    Sample output:
    Code:
    :~/svn/zabbix/misc> ./get_item_time.sh 22126
    44
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • vinny
      Senior Member
      • Jan 2008
      • 145

      #3
      Why not using "nodata(<period in second>)" ?

      vinny
      -------
      Zabbix 1.8.3, 1200+ Hosts, 40 000+ Items...zabbix's everywhere

      Comment

      Working...