Page 1 of 1

NRPE: Command not defined

Posted: Thu Aug 10, 2017 9:31 am
by Cristhian_Plaza
Hi....., I have a question. I am trying to monitor my agents with NRPE.

The check_load plugin runs without problem.., but when I want to monitor de xvda1 disk by the check_disk plugin the response of Nagios in the web is..., NRPE: Command '...' not defined. By the way when I execute the command by the console "./check_nrpe -H address -c check_xvda1 " it returns correctly. I mean that the check_xvda1 command is correctly defined on the remote host for that reason I got a good answer when I execute it by the console, but why in the web of Nagios I got a "NRPE: Command '...' not defined "?

Re: NRPE: Command not defined

Posted: Thu Aug 10, 2017 11:43 am
by scottwilkerson
Cristhian_Plaza wrote:Hi....., I have a question. I am trying to monitor my agents with NRPE.

The check_load plugin runs without problem.., but when I want to monitor de xvda1 disk by the check_disk plugin the response of Nagios in the web is..., NRPE: Command '...' not defined. By the way when I execute the command by the console "./check_nrpe -H address -c check_xvda1 " it returns correctly. I mean that the check_xvda1 command is correctly defined on the remote host for that reason I got a good answer when I execute it by the console, but why in the web of Nagios I got a "NRPE: Command '...' not defined "?
connecting to the same address?

What is the command defined for the service in Nagios?
What does the command definition look like?

Re: NRPE: Command not defined

Posted: Thu Aug 10, 2017 12:01 pm
by Cristhian_Plaza
Nagios Server

Since nagios plugins folder location

Code: Select all

./check_nrpe -H 52.91.100.253 -c check_xvda1
DISK OK - free space: / 3778 MB (50% inode=76%);| /=3724MB;6341;7134;0;7927


Since nagios commands.cfg

Code: Select all

define command {
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
Since nagios service.cfg

Code: Select all

 
define service {
        use                     generic-service
        host_name               Wikinovum
        service_description     Disco /dev/xvda1
        check_command           check_nrpe!check_xvda1
}
----------------------------------

Client

nrpe.cfg

Code: Select all

command[check_xvda1]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/xvda1

Re: NRPE: Command not defined

Posted: Thu Aug 10, 2017 3:24 pm
by tgriep
To be sure, you run the check from the command line on the Nagios server, it works but the web interface is showing you that is does not, correct?

Lets restart the nagios process by running the following as root

Code: Select all

service nagios stop
killall -9 nagios
service nagios start
Give the system a few minutes to run and if still fails, can you post your full nrpe.cfg file from the remote host and the /usr/local/nagios/var/objects.cache file from the Nagios server?
Thanks

Re: NRPE: Command not defined

Posted: Thu Aug 10, 2017 4:01 pm
by Cristhian_Plaza

Code: Select all

[root@ip-10-0-8-150 nagios]# killall -9 nagios
nagios: no process found

Code: Select all

########################################
#       NAGIOS OBJECT CACHE FILE
#
# THIS FILE IS AUTOMATICALLY GENERATED
# BY NAGIOS.  DO NOT MODIFY THIS FILE!
#
# Created: Thu Aug 10 20:58:51 2017
########################################

define timeperiod {
        timeperiod_name 24x7
        alias   24 Hours A Day, 7 Days A Week
        sunday  00:00-24:00
        monday  00:00-24:00
        tuesday 00:00-24:00
        wednesday       00:00-24:00
        thursday        00:00-24:00
        friday  00:00-24:00
        saturday        00:00-24:00
        }

define timeperiod {
        timeperiod_name 24x7_sans_holidays
        alias   24x7 Sans Holidays
        december 25     00:00-00:00
        july 4  00:00-00:00
        january 1       00:00-00:00
        thursday 4 november     00:00-00:00
        monday 1 september      00:00-00:00
        monday -1 may   00:00-00:00
        sunday  00:00-24:00
        monday  00:00-24:00
        tuesday 00:00-24:00
        wednesday       00:00-24:00
        thursday        00:00-24:00
        friday  00:00-24:00
        saturday        00:00-24:00
        }

define timeperiod {
        timeperiod_name none
        alias   No Time Is A Good Time
        }

define timeperiod {
        timeperiod_name us-holidays
        alias   U.S. Holidays
        january 1       00:00-00:00
        july 4  00:00-00:00
        december 25     00:00-00:00
        monday -1 may   00:00-00:00
        monday 1 september      00:00-00:00
        thursday 4 november     00:00-00:00
        }

define timeperiod {
        timeperiod_name workhours
        alias   Normal Work Hours
        monday  09:00-17:00
        tuesday 09:00-17:00
        wednesday       09:00-17:00
        thursday        09:00-17:00
        friday  09:00-17:00
        }

define command {
        command_name    check-host-alive
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
        }

define command {
        command_name    check_dhcp
        command_line    $USER1$/check_dhcp $ARG1$
        }

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

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

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

define command {
        command_name    check_ifstatus
        command_line    $USER1$/check_ifstatus -H $HOSTADRESS$ -C $ARG1$ -v $ARG2$
        }

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

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

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

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

define command {
        command_name    check_local_procs
        command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
        }

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

define command {
        command_name    check_local_users
        command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
        }

define command {
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -2 -4 -t 10:0 -c $ARG1$
        }

define command {
        command_name    check_nt
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
        }

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

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

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

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

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

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

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

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" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

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" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

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" >> /var/log/nagios/host-perfdata.out
        }

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" >> /var/log/nagios/service-perfdata.out
        }

define contactgroup {
        contactgroup_name       admins
        alias   Nagios Administrators
        members nagiosadmin
        }

define hostgroup {
        hostgroup_name  linux-servers
        alias   Linux Servers
        members localhost
        }

define contact {
        contact_name    Cristhian Plaza
        alias   Cristhian Plaza
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    r,w,u,c,f,s
        host_notification_options       r,d,u,f,s
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email   [email protected]
        minimum_importance      0
        host_notifications_enabled      1
        service_notifications_enabled   1
        can_submit_commands     1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define contact {
        contact_name    nagiosadmin
        alias   Nagios Admin
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    r,w,u,c,f,s
        host_notification_options       r,d,u,f,s
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email   nagios@localhost
        minimum_importance      0
        host_notifications_enabled      1
        service_notifications_enabled   1
        can_submit_commands     1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define host {
        host_name       GLPI
        alias   GLPI
        address 52.91.100.253
        contacts        Cristhian Plaza
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    a
        notifications_enabled   1
        notification_interval   30.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define host {
        host_name       Wikinovum
        alias   Wikinovum
        address 54.144.2.243
        contacts        Cristhian Plaza
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    a
        notifications_enabled   1
        notification_interval   30.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define host {
        host_name       localhost
        alias   localhost
        address 127.0.0.1
        check_period    24x7
        check_command   check-host-alive
        contact_groups  admins
        notification_period     workhours
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      10
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,d,u
        notifications_enabled   1
        notification_interval   120.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       GLPI
        service_description     Disco /dev/xvda2
        check_period    24x7
        check_command   check_nrpe!'check_xvda2'
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  10.000000
        retry_interval  2.000000
        max_check_attempts      3
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       GLPI
        service_description     IfStatus
        check_period    24x7
        check_command   check_ifstatus! -C public -v 2
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  10.000000
        retry_interval  2.000000
        max_check_attempts      3
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       GLPI
        service_description     Load
        check_period    24x7
        check_command   check_nrpe!check_load
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  10.000000
        retry_interval  2.000000
        max_check_attempts      3
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       GLPI
        service_description     Ping
        check_period    24x7
        check_command   check_ping! 100,20%!500,60% -w 20% -c 30%
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  10.000000
        retry_interval  2.000000
        max_check_attempts      3
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       Wikinovum
        service_description     Disco /dev/xvda1
        check_period    24x7
        check_command   check_nrpe!'check_xvda1'
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  10.000000
        retry_interval  2.000000
        max_check_attempts      3
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       Wikinovum
        service_description     IfStatus
        check_period    24x7
        check_command   check_ifstatus! -C public -v 2
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  10.000000
        retry_interval  2.000000
        max_check_attempts      3
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       Wikinovum
        service_description     Load
        check_period    24x7
        check_command   check_nrpe!check_load
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  10.000000
        retry_interval  2.000000
        max_check_attempts      3
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       Wikinovum
        service_description     Ping
        check_period    24x7
        check_command   check_ping! 100,20%!500,60% -w 20% -c 30%
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  10.000000
        retry_interval  2.000000
        max_check_attempts      3
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       localhost
        service_description     Current Load
        check_period    24x7
        check_command   check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       localhost
        service_description     Current Users
        check_period    24x7
        check_command   check_local_users!20!50
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       localhost
        service_description     HTTP
        check_period    24x7
        check_command   check_http
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   0
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       localhost
        service_description     PING
        check_period    24x7
        check_command   check_ping!100.0,20%!500.0,60%
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       localhost
        service_description     Root Partition
        check_period    24x7
        check_command   check_local_disk!20%!10%!/
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       localhost
        service_description     SSH
        check_period    24x7
        check_command   check_ssh
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   0
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       localhost
        service_description     Swap Usage
        check_period    24x7
        check_command   check_local_swap!20!10
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

define service {
        host_name       localhost
        service_description     Total Processes
        check_period    24x7
        check_command   check_local_procs!250!400!RSZDT
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,w,u,c
        notifications_enabled   1
        notification_interval   60.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

nrpe.cfg file from client

Code: Select all

#############################################################################
# Sample NRPE Config File
# Written by: Ethan Galstad ([email protected])
#
# Last Modified: 11-23-2007
#
# NOTES:
# This is a sample configuration file for the NRPE daemon.  It needs to be
# located on the remote host that is running the NRPE daemon, not the host
# from which the check_nrpe client is being executed.
#############################################################################


# LOG FACILITY
# The syslog facility that should be used for logging purposes.

log_facility=daemon



# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number.  The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.

pid_file=/var/run/nagios/nrpe.pid



# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

server_port=5666



# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

#server_address=127.0.0.1



# NRPE USER
# This determines the effective user that the NRPE daemon should run as.
# You can either supply a username or a UID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

nrpe_user=nagios



# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as.
# You can either supply a group name or a GID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

nrpe_group=nagios



# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames
# that are allowed to talk to the NRPE daemon. Network addresses with a bit mask
# (i.e. 192.168.1.0/24) are also supported. Hostname wildcards are not currently                                                                                        
# supported.
#
# Note: The daemon only does rudimentary checking of the client's IP
# address.  I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

allowed_hosts=127.0.0.1,52.87.62.14



# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed.  This option only works
# if the daemon was configured with the --enable-command-args configure script
# option.
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! ***
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments

dont_blame_nrpe=0



# BASH COMMAND SUBTITUTION
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments that contain bash command substitutions of the form
# $(...).  This option only works if the daemon was configured with both
# the --enable-command-args and --enable-bash-command-substitution configure
# script options.
#
# *** ENABLING THIS OPTION IS A HIGH SECURITY RISK! ***
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow bash command substitutions,
#         1=allow bash command substitutions

allow_bash_command_substitution=0



# COMMAND PREFIX
# This option allows you to prefix all commands with a user-defined string.
# A space is automatically added between the specified prefix string and the
# command line from the command definition.
#
# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
# Usage scenario:
# Execute restricted commmands using sudo.  For this to work, you need to add
# the nagios user to your /etc/sudoers.  An example entry for alllowing
# execution of the plugins from might be:
#
# nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
#
# This lets the nagios user run all commands in that directory (and only them)
# without asking for a password.  If you do this, make sure you don't give
# random users write access to that directory or its contents!

# command_prefix=/usr/bin/sudo



# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on

debug=0



# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.

command_timeout=60



# CONNECTION TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# wait for a connection to be established before exiting. This is sometimes
# seen where a network problem stops the SSL being established even though
# all network sessions are connected. This causes the nrpe daemons to
# accumulate, eating system resources. Do not set this too low.

connection_timeout=300



# WEEK RANDOM SEED OPTION
# This directive allows you to use SSL even if your system does not have
# a /dev/random or /dev/urandom (on purpose or because the necessary patches
# were not applied). The random number generator will be seeded from a file
# which is either a file pointed to by the environment valiable $RANDFILE
# or $HOME/.rnd. If neither exists, the pseudo random number generator will
# be initialized and a warning will be issued.
# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness

#allow_weak_random_seed=1



# INCLUDE CONFIG FILE
# This directive allows you to include definitions from an external config file.

#include=<somefile.cfg>



# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).

#include_dir=<somedirectory>
#include_dir=<someotherdirectory>



# COMMAND DEFINITIONS
# Command definitions that this daemon will run.  Definitions
# are in the following format:
#
# command[<command_name>]=<command_line>
#
# When the daemon receives a request to return the results of <command_name>
# it will execute the command specified by the <command_line> argument.
#
# Unlike Nagios, the command line cannot contain macros - it must be
# typed exactly as it should be executed.
#
# Note: Any plugins that are used in the command lines must reside
# on the machine that this daemon is running on!  The examples below
# assume that you have plugins installed in a /usr/local/nagios/libexec
# directory.  Also note that you will have to modify the definitions below
# to match the argument format the plugins expect.  Remember, these are
# examples only!


# The following examples use hardcoded command arguments...

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w .6,.5,.4 -c .9,.8,.7
#command[check_xvda]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $                                                                                        ARG3$
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
command[check_xvda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/xv                                                                                        da1 -C Wikinovum
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$

# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'.  This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.

#command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $                                                                                        ARG3$
#command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s                                                                                         $ARG3$

#
# local configuration:
#       if you'd prefer, you can instead place directives here
include=/etc/nagios/nrpe_local.cfg

#
# you can place your config snipplets into nrpe.d/
# only snipplets ending in .cfg will get included
include_dir=/etc/nagios/nrpe.d/

Re: NRPE: Command not defined

Posted: Fri Aug 11, 2017 10:46 am
by tgriep
The opjects.cache file shows that you have single quotes around the command for both the xvda1 and xvda2 disks and that is probably getting passed to the NRPE Agent causing the issue.
Change those checks from

Code: Select all

check_nrpe!'check_xvda1'
check_nrpe!'check_xvda2'
to

Code: Select all

check_nrpe!check_xvda1
check_nrpe!check_xvda2
and see if that fixes the issue.

Re: NRPE: Command not defined

Posted: Mon Aug 14, 2017 2:09 pm
by Cristhian_Plaza
I solved the problem, thanks for helping me, you already close this topic. Problem was on definition of the hosts, I was confusing the IP Addresses for 2 servers.

Re: NRPE: Command not defined

Posted: Mon Aug 14, 2017 2:40 pm
by bolson
Closing topic as resolved.

Thank you for using the Nagios Support Forum.