Plugin exit code help

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
lee.krause
Posts: 86
Joined: Wed Jan 20, 2016 8:38 am

Plugin exit code help

Post by lee.krause »

I have created a script to check the number of used inodes on Solaris10/11.

I ran the following as the nagios user...

When I run my script on the client I get:
bash-4.1$ /etc/nagios/nrpe/check_disk_inodes -w 80 -c 90
/oracle/DX1 inodes 3% used
bash-4.1$ echo $?
0
When I run the check NRPE command from the Nagios Server I get:
bash-4.1$ /usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx -t 30 -c check_disk_inodes -a '-w 80 -c 90'
/oracle/DX1 inodes 3% used
bash-4.1$ echo $?
2

Code: Select all

#!/bin/bash

while test -n "$1"; do
    case "$1" in
        -w)
            WarnInodes=$2
            shift
            ;;
        -c)
            CritInodes=$2
            shift
            ;;
        -p)
            Partition=$2
            shift
            ;;
    esac
    shift
done

sid=`sudo df -h |awk '{print $NF}' | grep oracle | egrep -v '(log|arch|data|oracle$)'`

inode=`sudo df -o i $sid | awk '{print $4}' | grep -v iused | sed 's/%//g'`

#echo $inode $WarnInodes $CritInodes

if [ "$inode" -lt "$WarnInodes" ];
        then
        echo "$sid inodes $inode% used"
        exit 0
fi
if [ "$inode" -gt "$WarnInodes" -a "$inode" -lt "$CritInodes" ];
        then
        echo "$sid inodes $inode% used"
        exit 1
fi
if [ "$inode" -gt "$CritInodes" ];
        then
        echo "$sid inodes $inode% used"
        exit 2
fi

Thanks in advance!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Plugin exit code help

Post by Box293 »

Can you please post your check_disk_inodes command that is defined in nrpe.cfg.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lee.krause
Posts: 86
Joined: Wed Jan 20, 2016 8:38 am

Re: Plugin exit code help

Post by lee.krause »

command[check_disk_inodes]=/etc/nagios/nrpe/check_disk_inodes
lee.krause
Posts: 86
Joined: Wed Jan 20, 2016 8:38 am

Re: Plugin exit code help

Post by lee.krause »

OK looks like I misunderstood the relationship of the commands in the nrpe.cfg.
I thought the check_nrpe would add the arguments.
I changed the nrpe.cfg to:
command[check_disk_inodes]=/etc/nagios/nrpe/check_disk_inodes $ARG1$ (being the next field in the GUI after the check_nrpe) and it worked.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Plugin exit code help

Post by hsmith »

Is there anything else you need assistance with, or is this topic good to close?
Former Nagios Employee.
me.
lee.krause
Posts: 86
Joined: Wed Jan 20, 2016 8:38 am

Re: Plugin exit code help

Post by lee.krause »

Sure you can close it.
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Plugin exit code help

Post by bwallace »

Glad we were able to help. We'll lock this thread now and feel free to open another should you require assistance with anything else.
Be sure to check out the Knowledgebase for helpful articles and solutions!
Locked