Basics - Adding a Host to Nagios Core

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.
workid
Posts: 34
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Post by workid »

I have restarted but still have the same error:

could it be something to do with my commands.cfg file? when i try and verify that i get this error:

Code: Select all

admin-it@GC-NAGIOS:/usr/local/nagios/etc/objects$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/objects/commands.cfg 

Nagios Core 4.4.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2018-08-16
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Error in configuration file '/usr/local/nagios/etc/objects/commands.cfg' - Line 26 (NULL value)
   Error processing main config file!
Attachments
commands.cfg
(6.72 KiB) Downloaded 344 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Basics - Adding a Host to Nagios Core

Post by scottwilkerson »

workid wrote:I have restarted but still have the same error:
What error?
workid wrote:could it be something to do with my commands.cfg file? when i try and verify that i get this error:
You cannot verify individual .cfg files like this, only the nagios.cfg
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
workid
Posts: 34
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Post by workid »

The error is:

(Return code of 127 is out of bounds. Check if plugin exists)

The plugin definitely exists:

Code: Select all

admin-it@GC-NAGIOS:/usr/local/nagios/libexec$ ls
check_apt       check_flexlm        check_mailq     check_overcr   check_time
check_breeze    check_ftp           check_mrtg      check_ping     check_udp
check_by_ssh    check_hpjd          check_mrtgtraf  check_pop      check_ups
check_clamd     check_http          check_nagios    check_procs    check_uptime
check_cluster   check_icmp          check_ncpa.py   check_real     check_users
check_dhcp      check_ide_smart     check_nntp      check_rpc      check_wave
check_dig       check_ifoperstatus  check_nt        check_sensors  negate
check_disk      check_ifstatus      check_ntp       check_smtp     urlize
check_disk_smb  check_imap          check_ntp_peer  check_snmp     utils.pm
check_dns       check_ircd          check_ntp_time  check_ssh      utils.sh
check_dummy     check_load          check_nwstat    check_swap
check_file_age  check_log           check_oracle    check_tcp
I have the check command in the commands file:
define command {

command_name check_ncpa
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Basics - Adding a Host to Nagios Core

Post by scottwilkerson »

I asked this earlier but I do not see the plugin in the directory list you just showed
scottwilkerson wrote:did you install the check_ncpa.py on the nagios server in /usr/local/nagios/libexec?

See the "Active Checks (check_ncpa.py)" section here
https://www.nagios.org/ncpa/getting-sta ... ive-checks
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
workid
Posts: 34
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Post by workid »

sorry i don't understand... it is in the list i just posted above
workid
Posts: 34
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Post by workid »

Code: Select all

admin-it@GC-NAGIOS:/usr/local/nagios/libexec$ ls
check_apt       check_flexlm        check_mailq     check_overcr   check_time
check_breeze    check_ftp           check_mrtg      check_ping     check_udp
check_by_ssh    check_hpjd          check_mrtgtraf  check_pop      check_ups
check_clamd     check_http          check_nagios    check_procs    check_uptime
check_cluster   check_icmp          [color=#FF0000]check_ncpa.py[/color]   check_real     check_users
check_dhcp      check_ide_smart     check_nntp      check_rpc      check_wave
check_dig       check_ifoperstatus  check_nt        check_sensors  negate
check_disk      check_ifstatus      check_ntp       check_smtp     urlize
check_disk_smb  check_imap          check_ntp_peer  check_snmp     utils.pm
check_dns       check_ircd          check_ntp_time  check_ssh      utils.sh
check_dummy     check_load          check_nwstat    check_swap
check_file_age  check_log           check_oracle    check_tcp
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Basics - Adding a Host to Nagios Core

Post by scottwilkerson »

Sorry I missed it.

Can you share the configuration definition for this host or service that is showing this error?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
workid
Posts: 34
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Post by workid »

is this in the ncpa.cfg file?
define host {
host_name NCPA 2 Host
address 172.17.136.147
check_command check_ncpa!-t 'Nagios_Token' -P 5693 -M system/agent_version
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
contacts nagiosadmin
notification_interval 60
notification_period 24x7
notifications_enabled 1
icon_image ncpa.png
statusmap_image ncpa.png
register 1
}

define service {
host_name NCPA 2 Host
service_description CPU Usage
check_command check_ncpa!-t 'Nagios_Token' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}

define service {
host_name NCPA 2 Host
service_description Memory Usage
check_command check_ncpa!-t 'Nagios_Token' -P 5693 -M memory/virtual -w 50 -c 80 -u G
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}

define service {
host_name NCPA 2 Host
service_description Process Count
check_command check_ncpa!-t 'Nagios_Token' -P 5693 -M processes -w 150 -c 200
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Basics - Adding a Host to Nagios Core

Post by scottwilkerson »

What is the name of the host or service that is giving the (Return code of 127 is out of bounds. Check if plugin exists) error?

also can you run the following so we can verify the plugin has the correct permissions

Code: Select all

ls -al /usr/local/nagios/libexec/check_ncpa.py
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
workid
Posts: 34
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Post by workid »

Host Name is the default : NCPA 2 Host

Services are:
CPU Usage
Memory Usage
Process Count


Her is the output from the code you asked me to run:

Code: Select all

ls -al /usr/local/nagios/libexec/check_ncpa.py
-rwxrwxr-x 1 nagios nagios 9982 Mar  8  2018 /usr/local/nagios/libexec/check_ncpa.py
Locked