check_ifoperstatus - perfdata?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

check_ifoperstatus - perfdata?

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_ifoperstatus - perfdata?

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: check_ifoperstatus - perfdata?

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_ifoperstatus - perfdata?

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: check_ifoperstatus - perfdata?

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_ifoperstatus - perfdata?

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked