Page 1 of 1
check_ifoperstatus - perfdata?
Posted: Wed Oct 23, 2019 4:25 am
by solarmon
Hi,
I'm using check_ifoperstatus to get the status of host interface. However, this does not graph the status so that you can check historically when an interface does down.
How can I enable perfdata output from this check_ifoperstatus check command? There does not seem to be an option for this.
Re: check_ifoperstatus - perfdata?
Posted: Wed Oct 23, 2019 7:39 am
by scottwilkerson
This plugin doesn't have performance data as there is not a numeric value to associate with. You can check historical values in the State History report.
Re: check_ifoperstatus - perfdata?
Posted: Wed Oct 23, 2019 8:34 am
by solarmon
Hi,
There is the numeric value of the return status code (0,1,2,3) that could be graphed. I think that is all I need to be graphed.
I have found the State History report but this just shows a table fo the states, not a nice visual graph that I would like.
A workaround I can think of is piping the results to a script that adds the perfdata text based on the returned status code.
Re: check_ifoperstatus - perfdata?
Posted: Wed Oct 23, 2019 8:49 am
by scottwilkerson
solarmon wrote:
A workaround I can think of is piping the results to a script that adds the perfdata text based on the returned status code.
Yes, you could make a wrapper script.
Here's the information on the format of the performance data
https://nagios-plugins.org/doc/guidelines.html#AEN200
Re: check_ifoperstatus - perfdata?
Posted: Thu Oct 24, 2019 3:40 am
by solarmon
Hi,
Rather than a 'wrapper' script I wrote a 'check_ifoperstatus_perfdata.sh' script to pipe to:
All this does is repeat the input it gets, and then creates the perfdata based on what it finds and exits with the appropriate code. I don't need any thresholds yet, so this is good enough for me, for now.
Code: Select all
#!/bin/bash
read input
echo $input
case "$input" in
*OK*)
echo "| status=0"
exit 0
;;
*WARNING*)
echo "| status=1"
exit 1
;;
*CRITICAL*)
echo "| status=2"
exit 2
;;
*UNKNOWN*)
echo "| status=3"
exit 3
;;
esac
So the check command would be something like this:
Code: Select all
/usr/local/nagios/libexec/check_ifoperstatus -H <HOST> -C <COMMUNITY> -d <interface> -v 2 -p 161 | /usr/local/nagios/libexec/check_ifoperstatus_perfdata.sh
I'll probably create a custom check command that uses this format/template.
Re: check_ifoperstatus - perfdata?
Posted: Thu Oct 24, 2019 6:24 am
by scottwilkerson
solarmon wrote:Hi,
Rather than a 'wrapper' script I wrote a 'check_ifoperstatus_perfdata.sh' script to pipe to:
All this does is repeat the input it gets, and then creates the perfdata based on what it finds and exits with the appropriate code. I don't need any thresholds yet, so this is good enough for me, for now.
Code: Select all
#!/bin/bash
read input
echo $input
case "$input" in
*OK*)
echo "| status=0"
exit 0
;;
*WARNING*)
echo "| status=1"
exit 1
;;
*CRITICAL*)
echo "| status=2"
exit 2
;;
*UNKNOWN*)
echo "| status=3"
exit 3
;;
esac
So the check command would be something like this:
Code: Select all
/usr/local/nagios/libexec/check_ifoperstatus -H <HOST> -C <COMMUNITY> -d <interface> -v 2 -p 161 | /usr/local/nagios/libexec/check_ifoperstatus_perfdata.sh
I'll probably create a custom check command that uses this format/template.
sounds good