First, a brief explanation:
Using Zabbix for system monitoring, I'm try to understand if/how it can be used to run important, scheduled task for which I need an OK/PROBLEM value reported (ie: via email).
I already use a custom-written script, called by cron
, to report errors on program execution. However, such an approach is open to being "flooded" by a fast-repeating, yet failing, scheduled task. What I really want is to be notified on a "edge change" - ie: from normal (OK) to failed (PROBLEM) executions, and vice-versa.
From here, I had the idea to trying Monit - and it works very well. However, having already Zabbix deployed, I would like to avoid using another tools if I can reasonably accomplish my goal using the existing setup.
OK, back to main problem:
From my researchs/tests, the basic approach is to treat the to-be-executed task as a recurring check/data query. Two possibilities exists:
- configure an SSH check to execute the command;
- extending the Zabbix agent with the specific command to be executed.
The first approach requires a login for each command execution, which tend to "pollute" the logs with unnecessary entries, so I tend toward the second approach. That said, both methods have a significant problem: they only capture the command's output, not capturing the command's exit value
So, my questions are:
- anyone knows how to capture the command exit value? Note: I would like to avoid wrapper scripts.
- is someone using a similar approach? If so, do you have any feedback?
- should I simply "resign" to use Monit?