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.
Nagios Core 4.2.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-07-2016
License: GPL
Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for command 'notify-host-by-email' (config file '/usr/local/nagios/etc/objects/commands.cfg', starting on line 27)
Error: Could not add object property in file '/usr/local/nagios/etc/objects/commands.cfg' on line 28.
Error processing object config files!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
And i have run this command (found in this forum):
[root@canetd01 etc]# grep -r -A 5 -B 5 'notify-host-by-email' /usr/local/nagios/etc/
/usr/local/nagios/etc/objects/commands.cfg-# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
/usr/local/nagios/etc/objects/commands.cfg-#
/usr/local/nagios/etc/objects/commands.cfg-################################################################################
/usr/local/nagios/etc/objects/commands.cfg-
/usr/local/nagios/etc/objects/commands.cfg-
/usr/local/nagios/etc/objects/commands.cfg:# 'notify-host-by-email' command definition
/usr/local/nagios/etc/objects/commands.cfg-define command{
/usr/local/nagios/etc/objects/commands.cfg: command_name notify-host-by-email
/usr/local/nagios/etc/objects/commands.cfg- 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$
/usr/local/nagios/etc/objects/commands.cfg- }
/usr/local/nagios/etc/objects/commands.cfg-
/usr/local/nagios/etc/objects/commands.cfg-# 'notify-service-by-email' command definition
/usr/local/nagios/etc/objects/commands.cfg-define command{
--
/usr/local/nagios/etc/objects/templates.cfg- service_notification_period 24x7 ; service notifications can be sent anytime
/usr/local/nagios/etc/objects/templates.cfg- host_notification_period 24x7 ; host notifications can be sent anytime
/usr/local/nagios/etc/objects/templates.cfg- service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events
/usr/local/nagios/etc/objects/templates.cfg- host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events
/usr/local/nagios/etc/objects/templates.cfg- service_notification_commands notify-service-by-email ; send service notifications via email
/usr/local/nagios/etc/objects/templates.cfg: host_notification_commands notify-host-by-email ; send host notifications via email
/usr/local/nagios/etc/objects/templates.cfg- register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
/usr/local/nagios/etc/objects/templates.cfg- }
/usr/local/nagios/etc/objects/templates.cfg-
/usr/local/nagios/etc/objects/templates.cfg-
/usr/local/nagios/etc/objects/templates.cfg-
In this configuration files, i create a command (notify-host-by-email) and then i use this command... I don't know how to fixed this warning...
Are these on the same system? If so, you will need to uninstall 3.2.0. Did you try to upgrade? What instructions did you use? Did you install 3.2.0 via repos or via source?
I have 2 servers one on Nagios 4.2.4 (the new server) and one on Nagios 3.2.0.
I have installed Nagios 4.2.4 and tested this (it's ok). After my install and my first test i have got configuration files to my Nagios 3.2.0.
When i want checked my configuration i have this duplicate error...
And i don't know how fixed this error.. because for me it's normal..
Most often this type of behavior can be attributed to a hostgroup and/or servicegroup memerbship. If you have checks set up directly for the host in the host's config, be careful that the host is not also inheriting checks from a hostgroup or servicegroup with the same checks configured.
In order to help you track this down, what's the output of ll /usr/local/nagios/etc/objects/?
It might be easiest to post/PM your objects.cache. It's probably at /usr/local/nagios/var/objects.cache but you can set the location in /usr/local/nagios/etc/nagios.cfg. Attaching it as a file is probably best, but if you want to PM it for security purposes, that works too. Just make sure you update this post after PMing the objects.cache.
I'm not sure to understand your reply..
Where I do send this command :
grep -R '' /usr/local/nagios/etc/
?
You say on top of the objects.cache, but my objects.cache is on the "/usr/local/nagios/var" folder. Then I do change your command to grep -R '' /usr/local/nagios/var/ ?
Or i do send my command on the objects.cache file ?
Just run it over the command line, and send over the full output it produces. This will show us the files / contents contained in your entire /usr/local/nagios/etc/ directory.
You'll want to make sure you don't have any duplicate definitions between the two. The same thing applies for other objects in your system - if the same configuration exists twice it will not work.