Page 1 of 3

Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 3:38 pm
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

Re: Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 4:02 pm
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

Re: Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 4:05 pm
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

Re: Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 4:07 pm
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

Re: Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 4:08 pm
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).

Re: Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 4:11 pm
by kmartin2007
here is the nt.cfg file.

Re: Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 4:16 pm
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

Re: Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 4:25 pm
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

Re: Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 4:34 pm
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.

Re: Issues with command.cfg and ports

Posted: Thu Nov 14, 2019 4:38 pm
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.