Unknown argument error with check_disk

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
davidlesicnik
Posts: 4
Joined: Wed Mar 06, 2019 8:17 am

Unknown argument error with check_disk

Post by davidlesicnik »

I've got this odd issue on my hand regarding the use of check_disk with nagios.
If i manually do

Code: Select all

./check_nrpe -H [host] -c check_disk -a 25 50 /mnt/nfs
(where [hostname is the actual IP of the host) it works fine and returns

Code: Select all

DISK OK - free space: /mnt/nfs 470888 MB (31.72% inode=100%);| /mnt/nfs=1013186MB;1484050;1484025;0;1484075
which is the expected result.

However, moving that into Nagios itself results in it throwing out "unknown argument"

Code: Select all

 
Status Information:	Unknown argument
Usage:
check_disk -w limit -c limit [-W limit] [-K limit] {-p path
Performance Data:	-x device} [-C] [-E] [-e] [-f] [-g group ] [-k] [-l] [-M] [-m] {-A | [-R path] [-r path]} [-s] [-t timeout] [-u unit] [-v] [-X type] [-N type] [-n]
My nrpe.cfg has check_disk defined as

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
And in nagios I have check_disk_lin defined as

Code: Select all

define command {
		command_name check_disk_lin
      command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_disk -a '$ARG1$ $ARG2$ $ARG3$'
}
And then the host itself has the service defined as

Code: Select all

define service{
        use                             local-service  
        host_name                      	apphost2
        service_description             Disk Utilitation - Backup
        check_command                   check_disk_lin!25!10!/mnt/nfs
        }
I've been bashing my head in with this issue for a few hours now and I have no idea what the problem might be.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Unknown argument error with check_disk

Post by cdienger »

The configuration looks good and I set it up just like you outlined with success. Did you edit the files directly using vi or nano from the command line? Using another editor or copying and pasting may result in hidden characters that may break things.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
davidlesicnik
Posts: 4
Joined: Wed Mar 06, 2019 8:17 am

Re: Unknown argument error with check_disk

Post by davidlesicnik »

I always use Nano (or Vi if it's not available) to edit the configuration.

The odd part about this is that I set this up 100% the same way for a friend of my and it worked perfectly fine there, which leads me to believe there might be something wrong with my Nagios setup. (Given that it works fine with check_nrpe and doesn't work over Nagios)
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Unknown argument error with check_disk

Post by cdienger »

Odd. Can you PM me a copy of your /usr/local/nagios/etc/ directory?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
davidlesicnik
Posts: 4
Joined: Wed Mar 06, 2019 8:17 am

Re: Unknown argument error with check_disk

Post by davidlesicnik »

Sorry for the delayed response, I have sent a download link to the ./etc folder to you. It's a bit messy, haven't made it pretty yet, so it might be a bit tricky :D
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Unknown argument error with check_disk

Post by cdienger »

No problem. Initially when I tested it looked good but on closer inspection it wasn't giving good results and I could see on the agent side the following logged in /var/log/syslog:

Mar 15 13:21:59 localhost nrpe[4206]: Running command: /usr/local/nagios/libexec/check_disk -w 25 10 /mnt/nfs -c -p

Modifying the command to remove the quotes around the arguments allowed it to run properly:

Code: Select all

define command {
        command_name check_disk_lin
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_disk -a $ARG1$ $ARG2$ $ARG3$
}
and the syslog showed:

Mar 15 13:24:15 localhost nrpe[4221]: Running command: /usr/local/nagios/libexec/check_disk -w 25 -c 10 -p /mnt/nfs

Give this a try and let us know your results.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
davidlesicnik
Posts: 4
Joined: Wed Mar 06, 2019 8:17 am

Re: Unknown argument error with check_disk

Post by davidlesicnik »

That did indeed fix the Unknown Argument issue! But running it without single quotes doesn't push the arguments over properly, so I wasn't getting a warning for disk usage.

But somehow putting the quotes back now works.... I have no idea what happened, but hey, it works.

Thank you so much for your help! This topic can (probably) be closed now.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Unknown argument error with check_disk

Post by cdienger »

Glad to hear!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked