Warning: Duplicate definition found for command
Posted: Mon Jan 16, 2017 5:10 am
Hi guys,
I have a Duplicate warning on my Nagios Core 4.2.4...
I have already one Nagios 3.2.0 and i have import (cut/past) configurations files.
When i check my configuration between start a nagios service, i have this message :
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...
Thanks for your Help
I have a Duplicate warning on my Nagios Core 4.2.4...
I have already one Nagios 3.2.0 and i have import (cut/past) configurations files.
When i check my configuration between start a nagios service, i have this message :
And i have run this command (found in this forum):[root@canetd01 etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
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.
[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...
Thanks for your Help