Unknown argument error with check_disk

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Unknown argument error with check_disk

Postby davidlesicnik » Wed Mar 06, 2019 8:31 am

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.
davidlesicnik
 
Posts: 4
Joined: Wed Mar 06, 2019 8:17 am

Re: Unknown argument error with check_disk

Postby cdienger » Wed Mar 06, 2019 3:06 pm

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.
User avatar
cdienger
Support Tech
 
Posts: 2692
Joined: Tue Feb 07, 2017 11:26 am

Re: Unknown argument error with check_disk

Postby davidlesicnik » Fri Mar 08, 2019 3:11 am

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)
davidlesicnik
 
Posts: 4
Joined: Wed Mar 06, 2019 8:17 am

Re: Unknown argument error with check_disk

Postby cdienger » Fri Mar 08, 2019 4:21 pm

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.
User avatar
cdienger
Support Tech
 
Posts: 2692
Joined: Tue Feb 07, 2017 11:26 am

Re: Unknown argument error with check_disk

Postby davidlesicnik » Fri Mar 15, 2019 4:09 am

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
davidlesicnik
 
Posts: 4
Joined: Wed Mar 06, 2019 8:17 am

Re: Unknown argument error with check_disk

Postby cdienger » Fri Mar 15, 2019 1:26 pm

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.
User avatar
cdienger
Support Tech
 
Posts: 2692
Joined: Tue Feb 07, 2017 11:26 am

Re: Unknown argument error with check_disk

Postby davidlesicnik » Fri Mar 22, 2019 8:16 am

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.
davidlesicnik
 
Posts: 4
Joined: Wed Mar 06, 2019 8:17 am

Re: Unknown argument error with check_disk

Postby cdienger » Fri Mar 22, 2019 9:19 am

Glad to hear!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
cdienger
Support Tech
 
Posts: 2692
Joined: Tue Feb 07, 2017 11:26 am


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 15 guests