Zabbix – Closing problems when recovery expression is met

zabbixzabbix-agent

I have a script on a Linux machine performing a check on our DB which results in either OK or KO depending on the result (good or bad).

I have configured a UserParameter in the Zabbix Agent configuration which runs the script:

# Check the DB for number longer than 12 characters.
UserParameter=customcheck.longnumber, /usr/local/bin/longnumber.sh

I have a template in Zabbix with an Item:

  • Name: longnumber
  • Trigger: 1
  • Key: customcheck.longnumber
  • Type: Zabbix Agent

The trigger is configured as follows:

Zabbix Trigger

This seems to trigger a problem. But the problem has been solved, and it keeps triggering the problem. Altough the recovery expression is made, it does not solve/close the problem.

Zabbix Agent Logs show the 'OK' response:

  3892:20200204:133550.537 Requested [customcheck.longnumber]
  3892:20200204:133550.537 In zbx_popen() command:' /usr/local/bin/longnumber.sh'
  3892:20200204:133550.652 EXECUTE_STR() command:' /usr/local/bin/longnumber.sh' len:2 cmd_result:'OK'

Any idea what could be the issue?

Best Answer

According to the documentation:

Logical expression (optional) defining additional conditions that have to be met before the problem is resolved, after the original problem expression has already been evaluated as FALSE. Recovery expression is useful for trigger hysteresis. It is not possible to resolve a problem by recovery expression alone if the problem expression is still TRUE.

So, you don't need to configure the recovery expresion because you don't need extra 'checks' for the recovery.

Once the Problem expresión will be evaluated as FALSE it will recovery automatically if you set the OK event generation as Expresión:

Expression - OK events are generated based on the same expression as problem events;