Page 1 of 1

Unix command monitoring from Nagios

Posted: Fri Sep 27, 2019 9:46 am
by RIDS_I2MP
Hi team,

wanted to monitor this command output using nagios,

PRODUCTION> root@eu2ddbu107: /root > mmlsconfig tiebreakerDisks
tiebreakerDisks tbnsd101;tbnsd102;tbnsd103
PRODUCTION> root@eu2ddbu107: /root >

To trigger an alert if the tiebreaker disk is set to undefined as below,

root@eu2ndbu365:/root $mmlsconfig tiebreakerDisks
tiebreakerDisks (undefined)
root@eu2ndbu365:/root $

Is this possible to monitor above command?

Re: Unix command monitoring from Nagios

Posted: Fri Sep 27, 2019 11:26 am
by mbellerue
Absolutely, you can monitor that. You will need to write a wrapper script, however. Nagios reads the exit code of a plugin to determine if the plugin is returning OK, WARNING, CRITICAL, or UNKNOWN. The exit codes are 0, 1, 2, anything else, respectively. So you could write a simple bash script to test the output of the command, and if it sees tbnsd101;tbnsd102;tbnsd103, it returns 0. This particular case seems like it's all or nothing, so if the script doesn't see that exact string, then it would return a 2.

This guide is incredibly detailed, and should help you along the way.
http://nagios-plugins.org/doc/guidelines.html