Issues with command.cfg and ports

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.
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Issues with command.cfg and ports

Post by kmartin2007 »

our old nagios server took a dump, rebuilt the server on ubuntu, installed from packages (not source). Migrated all the files over and modified as needed.

However the check_nt command i cannot un-comment because i get the below errror. I have searched EVERYWHERE and cannot find where the duplicate check_nt command is.


Warning: Duplicate definition found for command 'check_nt' (config file '/etc/nagios3/conf.d/commands.cfg', starting on line 304)
Error: Could not add object property in file '/etc/nagios3/conf.d/commands.cfg' on line 305.
Error processing object config files!


Secondly,


The check_nt command is using port 1248 however the existing server was using port 12489 (the agent on all the windows boxes are using 12489), once again i cannot find where this is defined at all.

Any help will be appreciated.




NOTE: I have uploaded my commands.cfg file. Please let me know if you need another file or more info.

Version of Nagios Core Nagios Core 3.5.1
Attachments
commands.cfg
(6.99 KiB) Downloaded 128 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Issues with command.cfg and ports

Post by scottwilkerson »

Hello and welcome to the Nagios Forum!

It will likely help to search for the extra check_nt command like this

Code: Select all

grep "command_name.*check_nt" -R /etc/nagios3
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Re: Issues with command.cfg and ports

Post by kmartin2007 »

this was the output


/etc/nagios3# grep "command_name.*check_nt" -R /etc/nagios3
/etc/nagios3/conf.d/commands.cfg:# command_name check_nt
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Issues with command.cfg and ports

Post by scottwilkerson »

is your nagios.cfg pulling in a file from outside /etc/nagios3 ?

Code: Select all

grep cfg_dir nagios.cfg
grep cfg_file nagios.cfg
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Re: Issues with command.cfg and ports

Post by kmartin2007 »

no it is sitting in /etc/nagios3


I have attached it here.

:/etc/nagios3# ls
apache2.conf cgi.cfg commands.cfg conf.d htpasswd.users nagios.cfg nagios.cfg.save resource.cfg stylesheets



root@dalsrvitmon03:/etc/nagios3# grep cfg_dir nagios.cfg
cfg_dir=/etc/nagios-plugins/config
cfg_dir=/etc/nagios3/conf.d
# extension) in a particular directory by using the cfg_dir
#cfg_dir=/etc/nagios3/servers
#cfg_dir=/etc/nagios3/printers
#cfg_dir=/etc/nagios3/switches
#cfg_dir=/etc/nagios3/routers
#cfg_dir=/etc/nagios3/OZ
# object configuration files (see the cfg_file and cfg_dir options above).
root@dalsrvitmon03:/etc/nagios3# grep cfg_file nagios.cfg
cfg_file=/etc/nagios3/commands.cfg
#cfg_file=/etc/nagios3/objects/commands.cfg
#cfg_file=/etc/nagios3/objects/contacts.cfg
#cfg_file=/etc/nagios3/objects/timeperiods.cfg
#cfg_file=/etc/nagios3/objects/templates.cfg
#cfg_file=/etc/nagios3/objects/windows.cfg
#cfg_file=/etc/nagios3/objects/switch.cfg
#cfg_file=/etc/nagios3/objects/printer.cfg
# object configuration files (see the cfg_file and cfg_dir options above).
Attachments
nagios.cfg
(44.61 KiB) Downloaded 97 times
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Re: Issues with command.cfg and ports

Post by kmartin2007 »

here is the nt.cfg file.
Attachments
nt.cfg
(495 Bytes) Downloaded 103 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Issues with command.cfg and ports

Post by scottwilkerson »

this is your culprit.

Code: Select all

# 'check_nt' command definition
define command {
	command_name    check_nt
	command_line    /usr/lib/nagios/plugins/check_nt -H '$HOSTADDRESS$' -v '$ARG1$'
}
it doesn't have a port set (-p 12489) which will use the default 1248
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Re: Issues with command.cfg and ports

Post by kmartin2007 »

AWESOME! i see the info starting to populate starting to say could not fetch info from server...


Now that ncsp++ config file... Is there a way to change the allowed hosts en mass? or is it 1 by one?


Now my next problem....
All my servers for CPU Load, C drive, E drive says missing -l Parameters.

CPU_Load
Perform Extra Service Actions
UNKNOWN 2019-11-14 21:20:00 2d 0h 16m 13s 2/2 missing -l parameters
C_Drive
Perform Extra Service Actions
UNKNOWN 2019-11-14 21:23:08 2d 0h 24m 4s 3/3 missing -l parameters
E_Drive
Perform Extra Service Actions
UNKNOWN 2019-11-14 21:18:55 2d 0h 22m 45s 3/3 missing -l parameters
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Issues with command.cfg and ports

Post by scottwilkerson »

kmartin2007 wrote:Now that ncsp++ config file... Is there a way to change the allowed hosts en mass? or is it 1 by one?
Unfortunately one by one.

Can you give an example of the check_command line for one of these services So I can see how they are configured?

We likely need to change the check_nt command to match how your services are setup.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Re: Issues with command.cfg and ports

Post by kmartin2007 »

Here is my services.cfg file. Not sure where this is set at, as i inherited this system, and have never used nagios before.

Let me know if these are what you need.
Attachments
generic-service_nagios2.cfg
(1.64 KiB) Downloaded 102 times
generic-host_nagios2.cfg
(1.13 KiB) Downloaded 102 times
services_nagios2.cfg
(36.3 KiB) Downloaded 108 times
Locked