Page 1 of 1

check_apc.pl --> running multiple check commands

Posted: Fri Feb 07, 2020 7:06 pm
by Tal
Does anyone know what the magic syntax is for running multiple check commands with this plugin would be?
(see attached help page, etc.)

techservices@vpd-nagios:/usr/local/nagios/libexec$ perl check_apc.pl -H192.168.60.3 -Cpublic -l out_status; bat_capacity; out_phase; out_load; bat_run_remaining

<output>
OK: UPS is Running on GridLine
bat_capacity: command not found
out_phase: command not found
out_load: command not found
bat_run_remaining: command not found


If I run the command like this...
techservices@vpd-nagios:/usr/local/nagios/libexec$ perl check_apc.pl -H192.168.60.3 -Cpublic -l bat_capacity out_phase out_load bat_run_remaining out_status

<output>
OK: UPS is Running on GridLine
(it only runs the last command)

If you take out the spaces between the checks, it errors (doesn't recognize the command)
(ex. bat_capacityout_phase)

I've also tried (ex. $bat_capacity) and other variations (e.g. using $, using \, using --, )

I just can't find it.

Re: check_apc.pl --> running multiple check commands

Posted: Mon Feb 10, 2020 5:40 pm
by mbellerue
Can you post the plugin itself? We might be able to figure it out pretty quick by looking at the code.

Otherwise, you might also try multiple -l switches. So -l bat_status -l bat_capacity

Re: check_apc.pl --> running multiple check commands

Posted: Mon Feb 10, 2020 5:47 pm
by Tal
check_apc.pl code (see attached)

Re: check_apc.pl --> running multiple check commands

Posted: Tue Feb 11, 2020 11:48 am
by mbellerue
It doesn't look like this plugin supports checking multiple metrics in a single command. You'll have to make a service check per metric in order to use this plugin. Or you could have a single service check, and write a wrapper script that calls this plugin multiple times.