Ad Widget

Collapse

How to display log file contents

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • esawyja
    Member
    Zabbix Certified Specialist
    • Dec 2011
    • 54

    #1

    How to display log file contents

    Hi All,
    I wrote a script that will add an application name to a log file when the application is down, for example in the log file whoisdown.log the following will be in the log file if application mail is down
    #cat /etc/zabbix/scripts.whoisdown.log
    mail
    #

    when another application named sas is down, the logfile will contain the word
    #cat /etc/zabbix/scripts.whoisdown.log
    sas
    #

    Is there any way that I can trigger on this, for example if the trigger sees any word in the logfile, it will trigger and display the word, example if the mail and sas appllication is down, I want 2 alarms or triggers, one for mail and one for sas? If the logfile only contains the word mail, then only one trigger must be active IE mail
    Last edited by esawyja; 27-01-2012, 13:27.
  • zychonatic
    Member
    • Jun 2010
    • 52

    #2
    hi,

    you can create an item with that key: "system.run[cat /etc/zabbix/scripts.whoisdown.log]" and than create a trigger with that expression: "({Template_WHATEVER:system.run[cat /etc/zabbix/scripts.whoisdown.log].str("mail")}=1)|{Template_WHATEVER:system.run[cat /etc/zabbix/scripts.whoisdown.log].str("sas")}=1)"

    and the Trigger description should look like: "{ITEM.LASTVALUE} is down"

    this is a generic trigger which only alerts if the file contains "mail" or "sas" and the it raises an alarm with name "mail is down" or "sas is down".

    hope this will help you.

    br, matthias

    Comment

    • esawyja
      Member
      Zabbix Certified Specialist
      • Dec 2011
      • 54

      #3
      Thank you, that worked for me

      Comment

      Working...