Search code examples
regextriggerszabbix

String Trigger How to Create?


Hi I need to create a String trigger for the first time.

I need a trigger that check if the word deploy_succeeded from a script

The expression must trigger if anything else from deploy_succeeded appears happens, the strings could be any but after 8 minutes the trigger must alert.

I have create this one, but I am sure that is incorrect.

{NETGLOBE NODES FAIL SNMP V3:Netglobe_Nodes_Fail.sh[{HOST.DNS}].regexp("deploy_succeeded")}=1

Thanks.


Solution

  • Well, it is almost correct. It will alert if the string deploy_succeeded appears in the output. To reverse that you would change it to ...].regexp("deploy_succeeded")}=0.

    Note that it will match a substring. If you want to match the exact string alone, use regexp("^deploy_succeeded$"). If you want to match substring, function str() might be a tiiiiny bit faster.

    To check that deploy_succeeded has not been there for 8 minutes, use the count() function like this: count(8m,deploy_succeeded)=0.

    Also see Zabbix trigger function documentation.