NRPE test ok but with args get Unknown argument -Help Please

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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE test ok but with args get Unknown argument -Help Pl

Post by abrist »

Can you post the entirety of your nrpe.cfg file from the *remote* host?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
millisa
Posts: 69
Joined: Thu Jan 16, 2014 11:13 pm
Location: Austin, TX
Contact:

Re: NRPE test ok but with args get Unknown argument -Help Pl

Post by millisa »

Your first post had:
[root@solitude ~]# /usr/local/nagios/libexec/check_nrpe -H 145.125.99.18 -c check_disk 85% 90% /
The '-a' is missing from the check_nrpe line, and the arguments for warning and critical are backwards; you'd want it to look like this:
/usr/local/nagios/libexec/check_nrpe -H 145.125.99.18 -c check_disk -a 15% 10% /

will work with this in the remote's nrpe.cfg:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
(with path modified appropriately for your check_disk location)

Using slansing's suggestion of combinging all the args might make things simpler, you just can't leave the '-a' out of your check in the nagios service definition.

From check_disk -h :

Code: Select all

...
 -w, --warning=INTEGER
    Exit with WARNING status if less than INTEGER units of disk are free
 -w, --warning=PERCENT%
    Exit with WARNING status if less than PERCENT of disk space is free
 -c, --critical=INTEGER
    Exit with CRITICAL status if less than INTEGER units of disk are free
 -c, --critical=PERCENT%
    Exit with CRITCAL status if less than PERCENT of disk space is free
...
Key words in there being the 'less than X of disk space is free', not 'x disk space used'. I know, a little intuitively backwards, but it's been that way a long time.

Example check from a nagios server to nagios client at 192.168.176.44:

Code: Select all

[root@nagiostestA ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.176.44 -c check_disk -a 85% 75% /
DISK WARNING - free space: / 3762 MB (80% inode=93%);| /=935MB;742;1237;0;4949
(you'll likely be wanting to use 15% and 10% respectively if you are watching for 'warn when disk is 85% used and critical when 90% used')


Using the slansing single argument method:
remote server's nrpe.cfg command:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
And from your nagios server:

Code: Select all

[root@nagiostestA ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.176.44 -c check_disk -a '-w 85% -c 75% -p /'
DISK WARNING - free space: / 3762 MB (80% inode=93%);| /=935MB;742;1237;0;4949
As for not getting much in your logs, you may have to modify your syslog to pick them up. Setting debug=1 and log_facility=daemon in your nrpe.cfg will send extra info to the syslog facility.
In rsyslog, I added it to my /var/log/messages by appending ';daemon.debug' to the appropriate line:

Code: Select all

*.info;mail.none;authpriv.none;cron.none;daemon.debug                /var/log/messages
Alternately you could add a line with something like

Code: Select all

*.debug    /var/log/debug
To have it push it all into /var/log/debug.
(and if you use a different syslogger, you'll need to modify it according to capture *.debug messages).

You should get a whole bunch more lines, even on a successful check (my dirs and IP's will be a little different than yours):

Code: Select all

Feb 15 05:32:27 nagiostestd nrpe[2425]: Connection from 192.168.176.41 port 5058
Feb 15 05:32:27 nagiostestd nrpe[2425]: Host address is in allowed_hosts
Feb 15 05:32:27 nagiostestd nrpe[2425]: Handling the connection...
Feb 15 05:32:27 nagiostestd nrpe[2425]: Host is asking for command 'check_disk' to be run...
Feb 15 05:32:27 nagiostestd nrpe[2425]: Running command: /usr/lib64/nagios/plugins/check_disk -w 85% -c 75% -p /
Feb 15 05:32:27 nagiostestd nrpe[2425]: Command completed with return code 1 and output: DISK WARNING - free space: / 3762 MB (80% inode=93%);| /=935MB;742;1237;0;4949
Feb 15 05:32:27 nagiostestd nrpe[2425]: Return Code: 1, Output: DISK WARNING - free space: / 3762 MB (80% inode=93%);| /=935MB;742;1237;0;4949
Feb 15 05:32:27 nagiostestd nrpe[2425]: Connection from 192.168.176.41 closed.
That should at least let you figure out if arguments are actually making it to your nrpe daemon.

You are running in xinetd - double check your nrpe startup in your xinetd directories to be sure it is using the nrpe.cfg you think it is.

Also, allow_bash_command_substitution is not needed for this to work. You aren't subsituting bash commands with $(...), you're just passing regular old variables. dont_blame_nrpe=1 should be sufficient here.

Unrelated to the issue you are concentrating on but it will matter after you get over this hurdle:
Your host template is oddly/conflictingly named:
define host{
name winterhold ; Name of this template
use generic-host
check_period 24x7
...
register 0
But in your host definition you have:
define host{
use linux-server
host_name winterhold
...
You are using the linux-server template in winterhold's host definition. This probably isn't giving an error since I'd wager you have the sample config included which has a linux-server template defined in it. You dont' appear to be using the 'winterhold' host template anywhere. I expect you either intended the first host template to be named 'linux-server'? Having a host template named 'winterhold' along with a host_name of 'winterhold' is going to be a might bit confusing.

Edit: Also noticed this: Your service definitions have:

Code: Select all

check_command check_nrpe!check_disk! 20%! 10%! /
(which I note you were putting spaces into, you probably want to avoid that, it makes it harder to test things at the cli when you run into an unexpected return result you want to troubleshoot)

But you are using the sample check_nrpe command definition which only takes one argument:

Code: Select all

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
You've either got to go with something like slansings suggestion with the one-argument-to-rule-them all in your service definition:

Code: Select all

check_command check_nrpe!'check_disk -w 20% -c 20% -p /'
or you need to modify or create a new command definition that takes more arguments (personal preference is for the latter, example below):

Code: Select all

define command{
command_name check_nrpe_disk
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
with corresponding service check:

Code: Select all

define service{
...
check_command check_nrpe_disk!20%!10%!/
}
(Double check your paths to check_disk, check_nrpe on your assorted hosts. If your host and remote systems are different linux flavors, the paths will often be different depending on your got things installed . . .I may not have caught all the places in the post above and modified the path to resemble yours)
danielbcjr
Posts: 9
Joined: Thu Feb 06, 2014 12:48 pm

Re: NRPE test ok but with args get Unknown argument -Help Pl

Post by danielbcjr »

Thank you millisa =D

I´m making 2 AWS RedHAt to test it right now.
danielbcjr
Posts: 9
Joined: Thu Feb 06, 2014 12:48 pm

Re: NRPE test ok but with args get Unknown argument -Help Pl

Post by danielbcjr »

Hi guys, thank you so much for helping,

I´m finnaly in the middle of the journey I think. In the machines I just did I put that configs but now is just Web Interface with erros :( :
Nagios NRPE -> thundernrpe

I put "allow_bash_command_substitution" to 0

Comment allow_host (Cos I´m using xinetd)

The NRPE.cfg is (I made both ways to test each other):

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ --metric=CPU


connection_timeout=300

command_timeout=60

debug=1

allow_bash_command_substitution=0

dont_blame_nrpe=1

nrpe_group=nagios

nrpe_user=nagios

server_port=5666

pid_file=/var/run/nrpe.pid

log_facility=daemon

That´s my Xinetd NRPE conf, like you gays said to check if the correctly nrpe.cfg was being used:

Code: Select all

[root@thundernrpe ~]# cat /etc/xinetd.d/nrpe

service nrpe
{
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = localhost 127.0.0.1 54.244.249.63 ec2-54-244-249-63.us-west-2.compute.amazonaws.com
}

Nagios Server -> thundernagios

/usr/local/nagios/etc/servers/thundernrpe.cfg:

Code: Select all

define host{
        name                            thundernrpe       ; Name of this template
        use                             generic-host    ; Inherit default values
        check_period                    24x7
        check_interval                  1
        retry_interval                  1
        max_check_attempts              10
        check_command                   check-host-alive
        notification_period             24x7
        notification_interval           30
        notification_options            d,r
        contact_groups                  admins
        register                        0               ; DONT REGISTER THIS - ITS A TEMPLATE
}

define host{
        use                             linux-server    ; Default values from a template
        host_name                       thundernrpe     ; The name we're giving to this server
        alias                           Thunder NRPE    ; Name for the server
        address                         54.244.251.67
}

define service{
                use                     generic-service
                host_name               thundernrpe
                service_description CPU Load
                check_command           check_nrpe!'check_load -w 2.0,1.8,1,3 -c 3.5,3.1,2.8'
}

define service{
                use                     generic-service
                host_name               thundernrpe
                service_description     Current Users
                check_command           check_nrpe!'check_users -w 5 -c 10'
}

define service{
                use                      generic-service
                host_name                thundernrpe
                service_description     / Free Space
                check_command            check_nrpe!check_disk!20%!10%!/

}

define service{
                use                      generic-service
                host_name                thundernrpe
                service_description     Proc / CPU
                check_command            check_nrpe!check_procs!60%!90%
}
The tests responses are:

Code: Select all

[root@thundernagios servers]#  /usr/local/nagios/libexec/check_nrpe -H 54.244.251.67 -c check_load -a ' -w 2.0,1.8,1,3 -c 3.5,3.1,2.8'
OK - load average: 0.00, 0.00, 0.00|load1=0.000;2.000;3.500;0; load5=0.000;1.800;3.100;0; load15=0.000;1.000;2.800;0;

[root@thundernagios servers]#  /usr/local/nagios/libexec/check_nrpe -H 54.244.251.67 -c check_users -a ' -w 5 -c 10'
USERS OK - 1 users currently logged in |users=1;5;10;0

[root@thundernagios servers]#  /usr/local/nagios/libexec/check_nrpe -H 54.244.251.67 -c check_disk -a 20% 10% /
DISK OK - free space: / 3865 MB (64% inode=84%);| /=2120MB;4837;5442;0;6047

[root@thundernagios servers]#  /usr/local/nagios/libexec/check_nrpe -H 54.244.251.67 -c check_procs -a 20% 10%
CPU OK: 80 processes | procs=80;;;0; procs_warn=0;;;0; procs_crit=0;;;0;

But, in the web I get this =/ :

check_load:

Code: Select all

Current Status:	  UNKNOWN   (for 0d 0h 6m 53s)
Status Information:	(No output returned from plugin)
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
\nUsage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
\nOptions:
-n = Do no use SSL
-u = Make socket timeouts return an UNKNOWN state instead of CRITICAL
<host> = The address of the host running the NRPE daemon
<bindaddr> = bind to local address
-4 = user ipv4 only
-6 = user ipv6 only
[port] = The port on which the daemon is running (default=5666)
[timeout] = Number of seconds before connection times out (default=10)
[command] = The name of the command that the remote daemon should run
[arglist] = Optional arguments that should be passed to the command. Multiple
arguments should be separated by a space. If provided, this must be
the last option supplied on the command line.
\nNote:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here. Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin. This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.
\n

check_users:

Code: Select all

  UNKNOWN   (for 0d 0h 4m 29s)
Status Information:	(No output returned from plugin)
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
\nUsage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
\nOptions:
-n = Do no use SSL
-u = Make socket timeouts return an UNKNOWN state instead of CRITICAL
<host> = The address of the host running the NRPE daemon
<bindaddr> = bind to local address
-4 = user ipv4 only
-6 = user ipv6 only
[port] = The port on which the daemon is running (default=5666)
[timeout] = Number of seconds before connection times out (default=10)
[command] = The name of the command that the remote daemon should run
[arglist] = Optional arguments that should be passed to the command. Multiple
arguments should be separated by a space. If provided, this must be
the last option supplied on the command line.
\nNote:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here. Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin. This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.
\n

check_disk

Code: Select all

Current Status:	  UNKNOWN   (for 0d 0h 29m 27s)
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] [-R path ] [-r path ] [-t timeout] [-u unit] [-v] [-X type] [-N type]
Current Attempt:	3/3  (HARD state)
Last Check Time:	16-02-2014 16:52:28
Check Type:	ACTIVE
check_procs:

Code: Select all

Current Status:	  OK   (for 0d 0h 2m 53s)
Status Information:	CPU OK: 79 processes


That is my /usr/local/nagios/etc/objects/commands.cfg:

Code: Select all

# 'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

# 'notify-service-by-email' command definition
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }
# 'check-host-alive' command definition
define command{
        command_name    check-host-alive
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
        }

# 'check_local_disk' command definition
define command{
        command_name    check_local_disk
        command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
        }


# 'check_local_load' command definition
define command{
        command_name    check_local_load
        command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
        }


# 'check_local_procs' command definition
define command{
        command_name    check_local_procs
        command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
        }
# 'check_local_users' command definition
define command{
        command_name    check_local_users
        command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
        }


# 'check_local_swap' command definition
define command{
        command_name    check_local_swap
        command_line    $USER1$/check_swap -w $ARG1$ -c $ARG2$
        }


# 'check_local_mrtgtraf' command definition
define command{
        command_name    check_local_mrtgtraf
        command_line    $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
        }


################################################################################
# NOTE:  The following 'check_...' commands are used to monitor services on
#        both local and remote hosts.
################################################################################


# 'check_nrpe' Monitoramento Remoto

define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 200 -c $ARG1$
        }



# 'check_ftp' command definition
define command{
        command_name    check_ftp
        command_line    $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
        }

# 'check_hpjd' command definition
define command{
        command_name    check_hpjd
        command_line    $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
        }


# 'check_snmp' command definition
define command{
        command_name    check_snmp
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
        }


# 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
        }


# 'check_ssh' command definition
define command{
        command_name    check_ssh
        command_line    $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
        }


# 'check_dhcp' command definition
define command{
        command_name    check_dhcp
        command_line    $USER1$/check_dhcp $ARG1$
        }


# 'check_ping' command definition
define command{
        command_name    check_ping
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
        }


# 'check_pop' command definition
define command{
        command_name    check_pop
        command_line    $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
        }


# 'check_imap' command definition
define command{
        command_name    check_imap
        command_line    $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
        }


# 'check_smtp' command definition
define command{
        command_name    check_smtp
        command_line    $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
        }


# 'check_tcp' command definition
define command{
        command_name    check_tcp
        command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
        }


# 'check_udp' command definition
define command{
        command_name    check_udp
        command_line    $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
        }


# 'check_nt' command definition
define command{
        command_name    check_nt
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
        }
# 'process-host-perfdata' command definition
define command{
        command_name    process-host-perfdata
        command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
        }


# 'process-service-perfdata' command definition
define command{
        command_name    process-service-perfdata
        command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
        }


That is my /usr/local/nagios/etc/nagios.cfg:

Code: Select all

log_file=/usr/local/nagios/var/nagios.log

# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/hostgroup.cfg


# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

# Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg

# Definitions for monitoring a router/switch
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg

# Definitions for monitoring a network printer
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg


# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:

cfg_dir=/usr/local/nagios/etc/servers
#cfg_dir=/usr/local/nagios/etc/printers
#cfg_dir=/usr/local/nagios/etc/switches
#cfg_dir=/usr/local/nagios/etc/routers




# OBJECT CACHE FILE
# This option determines where object definitions are cached when
# Nagios starts/restarts.  The CGIs read object definitions from
# this cache file (rather than looking at the object config files
# directly) in order to prevent inconsistencies that can occur
# when the config files are modified after Nagios starts.

object_cache_file=/usr/local/nagios/var/objects.cache

precached_object_file=/usr/local/nagios/var/objects.precache



# RESOURCE FILE
# This is an optional resource file that contains $USERx$ macro
# definitions. Multiple resource files can be specified by using
# multiple resource_file definitions.  The CGIs will not attempt to
# read the contents of resource files, so information that is
# considered to be sensitive (usernames, passwords, etc) can be
# defined as macros in this file and restrictive permissions (600)
# can be placed on this file.

resource_file=/usr/local/nagios/etc/resource.cfg



# STATUS FILE
# This is where the current status of all monitored services and
# hosts is stored.  Its contents are read and processed by the CGIs.
# The contents of the status file are deleted every time Nagios
#  restarts.

status_file=/usr/local/nagios/var/status.dat



# STATUS FILE UPDATE INTERVAL
# This option determines the frequency (in seconds) that
# Nagios will periodically dump program, host, and
# service status data.

status_update_interval=10



# NAGIOS USER
# This determines the effective user that Nagios should run as.
# You can either supply a username or a UID.

nagios_user=nagios

nagios_group=nagios



# EXTERNAL COMMAND OPTION
# This option allows you to specify whether or not Nagios should check
# for external commands (in the command file defined below).  By default
# Nagios will *not* check for external commands, just to be on the
# cautious side.  If you want to be able to use the CGI command interface
# you will have to enable this.
# Values: 0 = disable commands, 1 = enable commands

check_external_commands=1



# EXTERNAL COMMAND FILE
# This is the file that Nagios checks for external command requests.
# It is also where the command CGI will write commands that are submitted
# by users, so it must be writeable by the user that the web server
# is running as (usually 'nobody').  Permissions should be set at the
# directory level instead of on the file, as the file is deleted every
# time its contents are processed.

command_file=/usr/local/nagios/var/rw/nagios.cmd



# QUERY HANDLER INTERFACE
# This is the socket that is created for the Query Handler interface

#query_socket=/usr/local/nagios/var/rw/nagios.qh



# LOCK FILE
# This is the lockfile that Nagios will use to store its PID number
# in when it is running in daemon mode.

lock_file=/usr/local/nagios/var/nagios.lock

temp_file=/usr/local/nagios/var/nagios.tmp



# TEMP PATH
# This is path where Nagios can create temp files for service and
# host check results, etc.

temp_path=/tmp



# EVENT BROKER OPTIONS
# Controls what (if any) data gets sent to the event broker.
# Values:  0      = Broker nothing
#         -1      = Broker everything
#         <other> = See documentation

event_broker_options=-1

log_rotation_method=d



# LOG ARCHIVE PATH
# This is the directory where archived (rotated) log files should be
# placed (assuming you've chosen to do log rotation).

log_archive_path=/usr/local/nagios/var/archives



# LOGGING OPTIONS
# If you want messages logged to the syslog facility, as well as the
# Nagios log file set this option to 1.  If not, set it to 0.

use_syslog=1



# NOTIFICATION LOGGING OPTION
# If you don't want notifications to be logged, set this value to 0.
# If notifications should be logged, set the value to 1.

log_notifications=1



# SERVICE RETRY LOGGING OPTION
# If you don't want service check retries to be logged, set this value
# to 0.  If retries should be logged, set the value to 1.

log_service_retries=1



# HOST RETRY LOGGING OPTION
# If you don't want host check retries to be logged, set this value to
# 0.  If retries should be logged, set the value to 1.

log_host_retries=1

log_event_handlers=1



# INITIAL STATES LOGGING OPTION
# If you want Nagios to log all initial host and service states to
# the main log file (the first time the service or host is checked)
# you can enable this option by setting this value to 1.  If you
# are not using an external application that does long term state
# statistics reporting, you do not need to enable this option.  In
# this case, set the value to 0.

log_initial_states=0



# CURRENT STATES LOGGING OPTION
# If you don't want Nagios to log all current host and service states
# after log has been rotated to the main log file, you can disable this
# option by setting this value to 0. Default value is 1.

log_current_states=1



# EXTERNAL COMMANDS LOGGING OPTION
# If you don't want Nagios to log external commands, set this value
# to 0.  If external commands should be logged, set this value to 1.
# Note: This option does not include logging of passive service
# checks - see the option below for controlling whether or not
# passive checks are logged.

log_external_commands=1



# PASSIVE CHECKS LOGGING OPTION
# If you don't want Nagios to log passive host and service checks, set
# this value to 0.  If passive checks should be logged, set
# this value to 1.

log_passive_checks=1

service_inter_check_delay_method=s



# MAXIMUM SERVICE CHECK SPREAD
# This variable determines the timeframe (in minutes) from the
# program start time that an initial check of all services should
# be completed.  Default is 30 minutes.

max_service_check_spread=30



# SERVICE CHECK INTERLEAVE FACTOR
# This variable determines how service checks are interleaved.
# Interleaving the service checks allows for a more even
# distribution of service checks and reduced load on remote
# hosts.  Setting this value to 1 is equivalent to how versions
# of Nagios previous to 0.0.5 did service checks.  Set this
# value to s (smart) for automatic calculation of the interleave
# factor unless you have a specific reason to change it.
#       s       = Use "smart" interleave factor calculation
#       x       = Use an interleave factor of x, where x is a
#                 number greater than or equal to 1.

service_interleave_factor=s



# HOST INTER-CHECK DELAY METHOD
# This is the method that Nagios should use when initially
# "spreading out" host checks when it starts monitoring.  The
# default is to use smart delay calculation, which will try to
# space all host checks out evenly to minimize CPU load.
# Using the dumb setting will cause all checks to be scheduled
# at the same time (with no delay between them)!
#       n       = None - don't use any delay between checks
#       d       = Use a "dumb" delay of 1 second between checks
#       s       = Use "smart" inter-check delay calculation
#       x.xx    = Use an inter-check delay of x.xx seconds

host_inter_check_delay_method=s

max_host_check_spread=30



# MAXIMUM CONCURRENT SERVICE CHECKS
# This option allows you to specify the maximum number of
# service checks that can be run in parallel at any given time.
# Specifying a value of 1 for this variable essentially prevents
# any service checks from being parallelized.  A value of 0
# will not restrict the number of concurrent checks that are
# being executed.

max_concurrent_checks=0



# HOST AND SERVICE CHECK REAPER FREQUENCY
# This is the frequency (in seconds!) that Nagios will process
# the results of host and service checks.

check_result_reaper_frequency=10




# MAX CHECK RESULT REAPER TIME
# This is the max amount of time (in seconds) that  a single
# check result reaper event will be allowed to run before
# returning control back to Nagios so it can perform other
# duties.

max_check_result_reaper_time=30




# CHECK RESULT PATH
# This is directory where Nagios stores the results of host and
# service checks that have not yet been processed.
#
# Note: Make sure that only one instance of Nagios has access
# to this directory!

check_result_path=/usr/local/nagios/var/spool/checkresults
max_check_result_file_age=3600




# CACHED HOST CHECK HORIZON
# This option determines the maximum amount of time (in seconds)
# that the state of a previous host check is considered current.
# Cached host states (from host checks that were performed more
# recently that the timeframe specified by this value) can immensely
# improve performance in regards to the host check logic.
# Too high of a value for this option may result in inaccurate host
# states being used by Nagios, while a lower value may result in a
# performance hit for host checks.  Use a value of 0 to disable host
# check caching.

cached_host_check_horizon=15



# CACHED SERVICE CHECK HORIZON
# This option determines the maximum amount of time (in seconds)
# that the state of a previous service check is considered current.
# Cached service states (from service checks that were performed more
# recently that the timeframe specified by this value) can immensely
# improve performance in regards to predictive dependency checks.
# Use a value of 0 to disable service check caching.

cached_service_check_horizon=15



# ENABLE PREDICTIVE HOST DEPENDENCY CHECKS
# This option determines whether or not Nagios will attempt to execute
# checks of hosts when it predicts that future dependency logic test
# may be needed.  These predictive checks can help ensure that your
# host dependency logic works well.
# Values:
#  0 = Disable predictive checks
#  1 = Enable predictive checks (default)

enable_predictive_host_dependency_checks=1

enable_predictive_service_dependency_checks=1



# SOFT STATE DEPENDENCIES
# This option determines whether or not Nagios will use soft state
# information when checking host and service dependencies. Normally
# Nagios will only use the latest hard host or service state when
# checking dependencies. If you want it to use the latest state (regardless
# of whether its a soft or hard state type), enable this option.
# Values:
#  0 = Don't use soft state dependencies (default)
#  1 = Use soft state dependencies

soft_state_dependencies=0



# TIME CHANGE ADJUSTMENT THRESHOLDS
# These options determine when Nagios will react to detected changes
# in system time (either forward or backwards).

#time_change_threshold=900



# AUTO-RESCHEDULING OPTION
# This option determines whether or not Nagios will attempt to
# automatically reschedule active host and service checks to
# "smooth" them out over time.  This can help balance the load on
# the monitoring server.
# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY

auto_reschedule_checks=0



# AUTO-RESCHEDULING INTERVAL
# This option determines how often (in seconds) Nagios will
# attempt to automatically reschedule checks.  This option only
# has an effect if the auto_reschedule_checks option is enabled.
# Default is 30 seconds.
# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY

auto_rescheduling_interval=30

auto_rescheduling_window=180



# TIMEOUT VALUES
# These options control how much time Nagios will allow various
# types of commands to execute before killing them off.  Options
# are available for controlling maximum time allotted for
# service checks, host checks, event handlers, notifications, the
# ocsp command, and performance data commands.  All values are in
# seconds.

service_check_timeout=60
host_check_timeout=30
event_handler_timeout=30
notification_timeout=30
ocsp_timeout=5
perfdata_timeout=5



# RETAIN STATE INFORMATION
# This setting determines whether or not Nagios will save state
# information for services and hosts before it shuts down.  Upon
# startup Nagios will reload all saved service and host state
# information before starting to monitor.  This is useful for
# maintaining long-term data on state statistics, etc, but will
# slow Nagios down a bit when it (re)starts.  Since its only
# a one-time penalty, I think its well worth the additional
# startup delay.

retain_state_information=1



# STATE RETENTION FILE
# This is the file that Nagios should use to store host and
# service state information before it shuts down.  The state
# information in this file is also read immediately prior to
# starting to monitor the network when Nagios is restarted.
# This file is used only if the retain_state_information
# variable is set to 1.

state_retention_file=/usr/local/nagios/var/retention.dat

retention_update_interval=60



# USE RETAINED PROGRAM STATE
# This setting determines whether or not Nagios will set
# program status variables based on the values saved in the
# retention file.  If you want to use retained program status
# information, set this value to 1.  If not, set this value
# to 0.

use_retained_program_state=1



# USE RETAINED SCHEDULING INFO
# This setting determines whether or not Nagios will retain
# the scheduling info (next check time) for hosts and services
# based on the values saved in the retention file.  If you
# If you want to use retained scheduling info, set this
# value to 1.  If not, set this value to 0.

use_retained_scheduling_info=1



# RETAINED ATTRIBUTE MASKS (ADVANCED FEATURE)
# The following variables are used to specify specific host and
# service attributes that should *not* be retained by Nagios during
# program restarts.
#
# The values of the masks are bitwise ANDs of values specified
# by the "MODATTR_" definitions found in include/common.h.
# For example, if you do not want the current enabled/disabled state
# of flap detection and event handlers for hosts to be retained, you
# would use a value of 24 for the host attribute mask...
# MODATTR_EVENT_HANDLER_ENABLED (8) + MODATTR_FLAP_DETECTION_ENABLED (16) = 24

# This mask determines what host attributes are not retained
retained_host_attribute_mask=0

# This mask determines what service attributes are not retained
retained_service_attribute_mask=0

retained_process_host_attribute_mask=0
retained_process_service_attribute_mask=0

# These two masks determine what contact attributes are not retained.
# There are two masks, because some contact attributes have host and
# service options.  For example, you can disable host notifications for
# a contact, but leave service notifications enabled for them.
retained_contact_host_attribute_mask=0
retained_contact_service_attribute_mask=0



# INTERVAL LENGTH
# This is the seconds per unit interval as used in the
# host/contact/service configuration files.  Setting this to 60 means
# that each interval is one minute long (60 seconds).  Other settings
# have not been tested much, so your mileage is likely to vary...

interval_length=60



# CHECK FOR UPDATES
# This option determines whether Nagios will automatically check to
# see if new updates (releases) are available.  It is recommend that you
# enable this option to ensure that you stay on top of the latest critical
# patches to Nagios.  Nagios is critical to you - make sure you keep it in
# good shape.  Nagios will check once a day for new updates. Data collected
# by Nagios Enterprises from the update check is processed in accordance
# with our privacy policy - see http://api.nagios.org for details.

check_for_updates=1



# BARE UPDATE CHECK
# This option deterines what data Nagios will send to api.nagios.org when
# it checks for updates.  By default, Nagios will send information on the
# current version of Nagios you have installed, as well as an indicator as
# to whether this was a new installation or not.  Nagios Enterprises uses
# this data to determine the number of users running specific version of
# Nagios.  Enable this option if you do not want this information to be sent.

bare_update_check=0

use_aggressive_host_checking=0



# SERVICE CHECK EXECUTION OPTION
# This determines whether or not Nagios will actively execute
# service checks when it initially starts.  If this option is
# disabled, checks are not actively made, but Nagios can still
# receive and process passive check results that come in.  Unless
# you're implementing redundant hosts or have a special need for
# disabling the execution of service checks, leave this enabled!
# Values: 1 = enable checks, 0 = disable checks

execute_service_checks=1



# PASSIVE SERVICE CHECK ACCEPTANCE OPTION
# This determines whether or not Nagios will accept passive
# service checks results when it initially (re)starts.
# Values: 1 = accept passive checks, 0 = reject passive checks

accept_passive_service_checks=1



# HOST CHECK EXECUTION OPTION
# This determines whether or not Nagios will actively execute
# host checks when it initially starts.  If this option is
# disabled, checks are not actively made, but Nagios can still
# receive and process passive check results that come in.  Unless
# you're implementing redundant hosts or have a special need for
# disabling the execution of host checks, leave this enabled!
# Values: 1 = enable checks, 0 = disable checks

execute_host_checks=1



# PASSIVE HOST CHECK ACCEPTANCE OPTION
# This determines whether or not Nagios will accept passive
# host checks results when it initially (re)starts.
# Values: 1 = accept passive checks, 0 = reject passive checks

accept_passive_host_checks=1

enable_notifications=1



# EVENT HANDLER USE OPTION
# This determines whether or not Nagios will run any host or
# service event handlers when it is initially (re)started.  Unless
# you're implementing redundant hosts, leave this option enabled.
# Values: 1 = enable event handlers, 0 = disable event handlers

enable_event_handlers=1



# PROCESS PERFORMANCE DATA OPTION
# This determines whether or not Nagios will process performance
# data returned from service and host checks.  If this option is
# enabled, host performance data will be processed using the
# host_perfdata_command (defined below) and service performance
# data will be processed using the service_perfdata_command (also
# defined below).  Read the HTML docs for more information on
# performance data.
# Values: 1 = process performance data, 0 = do not process performance data

process_performance_data=0

obsess_over_services=0


obsess_over_hosts=0


translate_passive_host_checks=0


passive_host_checks_are_soft=0


check_for_orphaned_services=1
check_for_orphaned_hosts=1



# SERVICE FRESHNESS CHECK OPTION
# This option determines whether or not Nagios will periodically
# check the "freshness" of service results.  Enabling this option
# is useful for ensuring passive checks are received in a timely
# manner.
# Values: 1 = enabled freshness checking, 0 = disable freshness checking

check_service_freshness=1


service_freshness_check_interval=60

service_check_timeout_state=c

check_host_freshness=0

host_freshness_check_interval=60



additional_freshness_latency=15


enable_flap_detection=1


low_service_flap_threshold=5.0
high_service_flap_threshold=20.0
low_host_flap_threshold=5.0
high_host_flap_threshold=20.0

date_format=euro

illegal_object_name_chars=`~!$%^&*|'"<>?,()=

illegal_macro_output_chars=`~$&|'"<>

use_regexp_matching=0

use_true_regexp_matching=0


admin_email=nagios@localhost
admin_pager=pagenagios@localhost


daemon_dumps_core=0

use_large_installation_tweaks=0

enable_environment_macros=0

debug_level=1

debug_verbosity=1

debug_file=/usr/local/nagios/var/nagios.debug

max_debug_file_size=1000000

allow_empty_hostgroup_assignment=0


danielbcjr
Posts: 9
Joined: Thu Feb 06, 2014 12:48 pm

Re: NRPE test ok but with args get Unknown argument -Help Pl

Post by danielbcjr »

ATTACHMENTS:
There is the log from the nagios server (/var/log/messages) -> nagios.log
nagios.log
nagios server (/var/log/messages)
(7.45 KiB) Downloaded 464 times
There is the log from the nrpe server (/var/log/messages) -> nrpe.log
nrpe.log
nrpe server (/var/log/messages)
(21.68 KiB) Downloaded 435 times
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: NRPE test ok but with args get Unknown argument -Help Pl

Post by slansing »

Looks like you are still defining them incorrectly, please replace your check_load service section from the sample host you shared with this:

check_load -a ' -w 2.0,1.8,1,3 -c 3.5,3.1,2.8'

Code: Select all

define service{
                use                     generic-service
                host_name               thundernrpe
                service_description CPU Load
                check_command           check_nrpe!check_load -a '-w 2.0,1.8,1,3 -c 3.5,3.1,2.8'
}
If that does not work, please share the check_nrpe section of your commands.cfg again, thanks!
Locked