ARGS for Services

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
and1100
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

ARGS for Services

Post by and1100 »

Hi,

I seem to be having issue presenting ARGs for users, swap, procs, and zombie procs checks. For all else, it seems to be working fine. Please see below:

Client side:

Code: Select all

command[check_users]=/usr/lib64/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s Z
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$
Server side:

Code: Select all

define service {
        use                     generic-service
        hostgroup_name          x
        service_description     Current Users
        check_command           check_nrpe!check_users!15!20!
        contact_groups          admins
        }

define service {
        use                     generic-service
        hostgroup_name          x
        service_description     Total Processes
        check_command           check_nrpe!check_total_procs!950!1000!
        contact_groups          admins
        }

define service {
        use                     generic-service
        hostgroup_name         x
        service_description     Zombie Processes
        check_command           check_nrpe!check_zombie_procs!5!10!
        contact_groups          admins
        }

define service {
        use                     generic-service
        hostgroup_name         x
        service_description     Swap Usage
        check_command           check_nrpe!check_swap!20%!10%!
        contact_groups          admins
        }

Output on the GUI:

Current Users
Notifications for this service have been disabled
UNKNOWN 03-10-2015 16:03:14 0d 0h 15m 8s 3/3 check_users: Warning threshold must be a positive integer
Swap Usage
Notifications for this service have been disabled
UNKNOWN 03-10-2015 15:56:34 0d 0h 11m 48s 3/3 check_swap: Warning threshold must be integer or percentage!
Total Processes
Notifications for this service have been disabled
UNKNOWN 03-10-2015 15:58:15 0d 0h 6m 7s 3/3 check_procs: Warning Process Count must be an integer!
Zombie Processes
Notifications for this service have been disabled
UNKNOWN 03-10-2015 15:59:05 0d 0h 9m 17s 3/3 check_procs: Warning Process Count must be an integer!

Here is an example of something I am using that does work:

Client:

Code: Select all

command[check_x]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p /x/y
Server:

Code: Select all

define service {
        use                     generic-service
        hostgroup_name          x
        service_description     /x/y Free Space
        check_command           check_nrpe!check_x!40%!20%!
        contact_groups          admins
        }

Free Space
Notifications for this service have been disabled
OK 03-10-2015 16:05:03 0d 2h 42m 18s 1/3 DISK OK - free space: /x/y 1696223 MB (98% inode=99%):


Is there something I am missing?

Thank you.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: ARGS for Services

Post by jdalrymple »

A couple of things...

First, are you even sure that you have argument passing enabled?

Code: Select all

dont_blame_nrpe=1
Secondly...

I think you want to replace $ARG1$ with $ARG2$, and $ARG2$ with $ARG3$, etc...

http://nagios.sourceforge.net/docs/3_0/macros.html

--EDIT--

Sorry, I cascaded your configs in my head improperly - ignore the "secondly" part. This leaves us with hopefully the simple question - did you NRPE get compiled with the option to pass arguments and also did you configure it as specified in your nrpe.cfg?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: ARGS for Services

Post by Box293 »

Can you please post your command definition:

check_command check_nrpe
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
and1100
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: ARGS for Services

Post by and1100 »

Hi,

I believe I have argument passing enabled. It seems some check commands work with arguments while others do not.

Here is my check_nrpe command:

Code: Select all

define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }
Thank you.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: ARGS for Services

Post by jdalrymple »

In your OP you indicated check disk was working but the others weren't. The error indicated by the others is the type of error you'd get if args weren't getting passed:

Code: Select all

[jdalrymple@localhost libexec]$ ./check_users -w -c
check_users: Warning threshold must be a positive integer
Usage:
check_users -w <users> -c <users>
However some checks are tolerant to mangled command line specs:

Code: Select all

[jdalrymple@localhost libexec]$ ./check_disk -w -c -p /
DISK OK - free space: / 13346 MB (79% inode=92%);| /=3462MB;17709;;0;17709
Try making your disk-free warning threshold 99% and see if it alerts.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: ARGS for Services

Post by Box293 »

and1100 wrote:

Code: Select all

command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
and1100 wrote:

Code: Select all

command[check_users]=/usr/lib64/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
and1100 wrote:

Code: Select all

define service {
        use                     generic-service
        hostgroup_name          x
        service_description     Current Users
        check_command           check_nrpe!check_users!15!20!
        contact_groups          admins
        }
What is happening here is you only have one argument defined in your command, so nagios executes this:

Code: Select all

check_nrpe -H the_host -c check_users
And nrpe tries to execute this:

Code: Select all

/usr/lib64/nagios/plugins/check_users -w -c 
So it gives you this error:

Code: Select all

UNKNOWN 03-10-2015 16:03:14 0d 0h 15m 8s 3/3 check_users: Warning threshold must be a positive integer 
Which is correct as you haven't specified a warning value.

So this needs to be:

Code: Select all

command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$
Which means nagios will execute this:

Code: Select all

check_nrpe -H the_host -c check_users -a 15 20
And nrpe will execute this:

Code: Select all

/usr/lib64/nagios/plugins/check_users -w 15 -c 20
Does that make sense?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
and1100
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: ARGS for Services

Post by and1100 »

Hi Box293,

Yes, that does make sense. Thank you all for the assistance. I will try these out and see if I receive expected results.

Thanks for the help!!
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: ARGS for Services

Post by jolson »

Please let us know the results of your testing when you can. Thank you!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked