Page 1 of 1

Stripping output of check_ command

Posted: Fri Mar 16, 2018 10:28 am
by nov1ce
Hello,

Nagios Core 4.3.4 running on Debian Stretch.

I'm using check_snmp_environment.pl plugin (from https://exchange.nagios.org/directory/P ... 29/details) to monitor the power supply status and temperature of one of the ICX Brocade switches.

Here is the output I get:

Code: Select all

./check_snmp_environment.pl -H icx6450.local.net -C public -T brocadeTurboIron

Power supply 1 (NA - AC - Regular) present, status ok: OK; Power supply 2 (NA - AC - Regular) present, status ok: OK; 
Rear Side Fan 1  (1): OK; 
Chassis temperature of 42.5OK; 
Management module: CPU temperature of 47.5OK; 
Management module: MAC 1 temperature of 42.5OK; 
Management module: CPU temperature of 42.5OK; 
Management module: MAC 1 temperature of 42.5OK; 
all OK
My question is: how do I strip the output to one result per line? For example, in the Nagios Web GUI, I'd like to see one check for Power supply 1:

Power supply 1 (NA - AC - Regular) present, status ok: OK;

Then another check for Power supply 2:

Power supply 2 (NA - AC - Regular) present, status ok: OK;

And so on.

Do I need to have separate commands per line piping the output to awk/sed?

Thanks.

Re: Stripping output of check_ command

Posted: Fri Mar 16, 2018 2:10 pm
by scottwilkerson
This plugin doesn't seem to allow them to be run separately, so you would need to do as you said, somehow manipulate the results, OR write your own plugin that just does the checks one at a time