Unix command monitoring from Nagios

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Unix command monitoring from Nagios

Post 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?
Thanks & Regards,
I2MP Team.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Unix command monitoring from Nagios

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked