Ad Widget

Collapse

Monitoring a Log File for a Specific String

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • valek1
    Junior Member
    • Jul 2017
    • 2

    #1

    Monitoring a Log File for a Specific String

    Hi, I am trying to check a text file/log file works too, for a specific string, and if that string exists I want a trigger to go off, and an email to send. I have tried multiple things for the triggers, and nothing seems to work. This is my most recent attempt :

    Item :
    Name : Test
    Type : Zabbix agent (active)
    Key : log[/path/to/file,myWord]
    Type of information : Log

    Trigger :
    Name : Test
    Expression : ({Template OS Linux:log[/path/to/file].regexp(myWord)})<>0)

    So basically I am trying to get the trigger to go off if "myWord" in the file exists.
    If anyone has any advice it is appreciated.
    Thanks.
  • martin.lester
    Junior Member
    • Jul 2017
    • 5

    #2
    Could you create an external script that does the grep of the log for you and returns true/false/count etc. Then you should be able to trigger off that. as long as the script returns a single value that seems to work quite well.

    Comment

    • valek1
      Junior Member
      • Jul 2017
      • 2

      #3
      Solved

      If anyone else reads this, and have been struggling with this like I have, this is what I did to end up making it work:

      Made the item specific host I was working with log["/path/to/file"] (Zabbix Active)
      Created a trigger off that item : regexp("DESIRED_STRING"), which ends up looking like this : {server_name:log["/path/to/file"].regexp("DESIRED_STRING")})

      Comment

      Working...