Ad Widget

Collapse

Match a string and alert

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sfereday
    Member
    • Jun 2020
    • 30

    #1

    Match a string and alert

    It might be the lack of sleep, it might be the inexperience with Zabbix. I don't know, I'm not a doctor. I can tell you what my problem is though.

    I've created a command to run on each of the Linux servers. system.run[ tune2fs -l /dev/vda2 | grep "Filesystem state:"] The command comes back correct and I see output from each of the servers that have a /dev/vda2. The output comes back as "Filesystem state: clean". I'm trying for the life of me to create a trigger that will flag only when it doesn't equal "Filesystem state: clean".

    The trigger I've created and played with is
    {KMI_Linux:system.run[ tune2fs -l /dev/vda2 | grep "Filesystem state:"].str(""Filesystem state: clean"")}=0

    I've tested multiple different endings from =1, <>0, and <>1. I don't know that I have this correct and I'm at a punch drunk wall of no sleep. I am going to do my best to not forget to check this for a month.
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Try it without the doubled-up " parameter to str(). I would also probably just look for "clean":

    Code:
    {KMI_Linux:system.run[ tune2fs -l /dev/vda2 | grep "Filesystem state:"].str("clean")}=0
    The =0 looks correct (for str(), that should be "no match", though <>1 might be a little more easy to understand, logically), I think the problem is likely with the str() call you were making.

    Comment

    • sfereday
      Member
      • Jun 2020
      • 30

      #3
      tim.mooney Thank you! I'm trying this now. I was out Friday or I would have tried it then. I may have to adjust it though. The response from the OS can be "clean with errors". I'm not sure how to contend with that.

      Edit: You beath thy maneth. It seems to be working. I still have to experiment with the "clean with errors" part.
      Last edited by sfereday; 27-07-2020, 16:40.

      Comment

      Working...