Ad Widget

Collapse

Trigger expression for log monitoring does not fire Action

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • paxas
    Junior Member
    • Jan 2024
    • 13

    #1

    Trigger expression for log monitoring does not fire Action

    I configured a log monitoring Item:

    HTML Code:
    log[C:\temp\test.log,failed,,,skip]
    I confirmed in Latest Data that it gets the expected data (a string "failed").

    Then i configured Trigger for this Item and the Trigger expression looks like this:

    HTML Code:
    last(/MY_HOSTNAME/log[C:\temp\test.log,failed,,,skip])=1
    And then i created Trigger Action to send an email notification whenever the condition in the Trigger expression is True. However, i never receive any email. I verified tha the Trigger is Enabled, "OK event generation" set to "None" and "PROBLEM event generation mode" set to "Single".

    Is there anything else to configure or is there something wrong with my Trigger expression?
  • Answer selected by paxas at 05-01-2024, 13:12.
    ISiroshtan
    Senior Member
    • Nov 2019
    • 324

    So logic wise you started strong: configured item to collect data -> verified that data is collected.
    But after that you made a leap. Instead of "Configure a trigger -> make sure trigger fires properly (you see alert/problem fired in Zabbix WebUI in Monitoring -> Problems) -> configure action for problem -> make sure action works" you went with "configure trigger -> configure action -> see if action works".

    I would expect your item fetches the whole log line containing word failed. In trigger you try to check if the value fetched from log file equals to 1. I would expect it to never be equal. So consequently trigger to never fire and Zabbix to not even try to execute the action. You can start with using
    Code:
    count(/MY_HOSTNAME/log[C:\temp\test.log,failed,,,skip],1m)>0 and nodata(/MY_HOSTNAME/log[C:\temp\test.log,failed,,,skip],5m)=0
    This way if the monitoring fetched any lines in last minute you will get alert fired, and if no new log lines are fetched for 5 minutes after alert will auto resolved.

    Then you can trey confirm that this trigger fires and you see the problem created in Monitoring -> Problem. If you created Action properly there you will also see indication if Zabbix tried to execute action and if it was successful at it or not. If not it will also indicate the error it encountered when executing the action.

    Comment

    • ISiroshtan
      Senior Member
      • Nov 2019
      • 324

      #2
      So logic wise you started strong: configured item to collect data -> verified that data is collected.
      But after that you made a leap. Instead of "Configure a trigger -> make sure trigger fires properly (you see alert/problem fired in Zabbix WebUI in Monitoring -> Problems) -> configure action for problem -> make sure action works" you went with "configure trigger -> configure action -> see if action works".

      I would expect your item fetches the whole log line containing word failed. In trigger you try to check if the value fetched from log file equals to 1. I would expect it to never be equal. So consequently trigger to never fire and Zabbix to not even try to execute the action. You can start with using
      Code:
      count(/MY_HOSTNAME/log[C:\temp\test.log,failed,,,skip],1m)>0 and nodata(/MY_HOSTNAME/log[C:\temp\test.log,failed,,,skip],5m)=0
      This way if the monitoring fetched any lines in last minute you will get alert fired, and if no new log lines are fetched for 5 minutes after alert will auto resolved.

      Then you can trey confirm that this trigger fires and you see the problem created in Monitoring -> Problem. If you created Action properly there you will also see indication if Zabbix tried to execute action and if it was successful at it or not. If not it will also indicate the error it encountered when executing the action.

      Comment

      Working...