Email message not coming properly

Hello.
I tried to modify the email which nagios sends to the users. In order to do this, i specified a definition in misccommands,cfg with a name host-notify-by-Controllers.
Nagios did not give any pre flight errors or warnings. But when i rebooted my controller i got the message specified within host-notify-by-email when it should have been a message within host-notify-by-Controllers,
I have the cgi’s below for reference. Please help as i am confused
Thanks :slight_smile:

This is misccommands.cfg

‘host-notify-by-email’ command definition

define command{
command_name host-notify-by-email
command_line /usr/bin/printf “%b” “***** This is Nagios Network Monitoring System *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” “This is a test, to see if DR steps can be included with email messages for the Host” | /bin/mail -s “Host $HOSTSTATE$ alert for $HOSTNAME$!” $CONTACTEMAIL$
}

‘host-notify-by-email’ command definition

define command{
command_name host-notify-by-Controllers
command_line /usr/bin/printf “%b” “***** This is Nagios Network Monitoring System *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” “This is a test for Controllers, to see if DR steps can be included with email messages for the Host” “%b” “Step1: Check Application” “%b” “Step 2: Test is successful” | /bin/mail -s “Host $HOSTSTATE$ alert for $HOSTNAME$!” $CONTACTEMAIL$
}

This is contacts.cfg

‘ControllerMiamiNoc’ contact definition

define contact{
contact_name controllermiaminoc
alias Miaminoc
service_notification_period 24x7
host_notification_period 24x7
service_notification_options c,w,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-Controllers
email [email protected]
}


This is my contactgroups.cfg

define contactgroup{
contactgroup_name Admins
alias Administrators
members miaminoc
}

define contactgroup{
contactgroup_name ControllerAdmins
alias Administrators
members controllermiaminoc
}

This is my services.cfg

define service{
use generic-nix
host_name CTRL02
service_description PING
notification_options c,r
check_command check_ping!100.0,20%!500.0,60%
contact_groups ControllerAdmins
notification_interval 120
notification_period 24x7
}

define service{
use generic-nix ; Name of service template to use

  host_name                       CTRL02
  service_description             UPTIME
  is_volatile                     0
  check_period                    24x7
  max_check_attempts              3
  normal_check_interval           1
  retry_check_interval            1
  contact_groups                  Admins
  notification_interval           120
  notification_period             none
  notification_options            c,r
  check_command                   check_nt_uptime
    }

I think i know what the problem is. Sir jake, if you see this message, do i need to specify the contact_name in hosts.cfg as ControllerAdmins :slight_smile:
I think i have found the answer :slight_smile:

Yup, the hosts.cfg should have been
contact_groups ControllerAdmins