Reputation: 2131
I have a userparameter on the agent which returns a string. This string contains a line with E:x where x==0 if no errors were found and x>0 if errors found. I want to check this number on the trigger but cannot find how to do it. Alternatively I could use the exit status of my command if possible. Thank you.
Upvotes: 0
Views: 13949
Reputation: 95
Try this Approach:
{HP LaserJet P2055dn:display.str(Load Paper)}
It should works.
Upvotes: 0
Reputation: 1345
Zabbix triggers run an expression on a value.
If your key returns a string, you'll have to use a regular expression match to do what you're describing:
{my-template:system.hostname.regexp(IMPORTANT-SERVER)}#1
This will trigger an alert if the hostname key returns a value that does not match "IMPORTANT-SERVER" (case sensitive).
If your key returns an unsigned integer, you can use expressions that check values.
{my-template:uptime.last(0)}<300
This will return an alert if the value returned from the key "uptime" is less than 300, which in this case would mean the machine has less than 5 minutes of uptime and was probably restarted. This ONLY works if the value returns an unsigned integer.
My suggestion is to change your check to only respond with a number (or exit code). Collect the data as an unsigned integer. Set up a trigger to say if the number is not a 0, then send a trigger.
Otherwise you're going to have to match a regular expression against a string.
Upvotes: 0