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.
check_ifoperstatus - perfdata?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_ifoperstatus - perfdata?
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?
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.
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.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_ifoperstatus - perfdata?
Yes, you could make a wrapper script.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.
Here's the information on the format of the performance data
https://nagios-plugins.org/doc/guidelines.html#AEN200
Re: check_ifoperstatus - perfdata?
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.
So the check command would be something like this:
I'll probably create a custom check command that uses this format/template.
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
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
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_ifoperstatus - perfdata?
sounds goodsolarmon 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.
So the check command would be something like this: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 ;; esacI'll probably create a custom check command that uses this format/template.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