[icinga-users] Icinga sends email to $@itpassion.com

Guus Leeuw jr guus.leeuw at itpassion.com
Mon Jan 14 05:05:05 CET 2013


> -----Original Message-----
> From: Michael Friedrich [mailto:michael.friedrich at gmail.com]
> Sent: 13 January 2013 21:21
> To: icinga-users at lists.sourceforge.net
> Subject: Re: [icinga-users] Icinga sends email to $@itpassion.com
> 
> On 13.01.2013 20:50, Guus Leeuw jr wrote:
> > Michael,
> >
> > Having left debugging on for the day, I can confirm that
> > $CONTACTEMAIL$ seems to be a problem for some services:
> >
> > [1358064635.395239] [256.1] [pid=971] Running command '/usr/bin/printf
> "%b"
> > "***** Icinga *****\n\nNotification Type: \n\nService: Check Apponotec
> > Windows Updates\nHost: Apponotec FIA-CORE1\nAddress:
> 82.153.129.66\nState:
> > UNKNOWN\n\nDate/Time: Sun Jan 13 08:10:35 GMT 2013\n\nAdditional
> > Info:\n\nCHECK_NRPE: Received 0 bytes from daemon.  Check the remote
> > server logs for error messages.\n" | /bin/mail -s "**  Service Alert:
> > Apponotec FIA-CORE1/Check Apponotec Windows Updates is UNKNOWN
> **" $CONTACTEMAIL$'...
> 
> Matching that with the given config
> 
> define command {
>          command_name                    notify-service-by-email
>          command_line                    /usr/bin/printf "%b" "*****
Icinga
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
> $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
> $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
> Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$
> Service
> Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **"
> $CONTACTEMAIL$
>          register                        1
> }
> 
> you can extract all the details to look for your host and service
affected, and
> then look up the config for the service definition. Likely there's are
contacts
> missing. Question aside - during config verification of Icinga core, it
should
> warn about hosts/services with no contacts defined - is that the case?

It normally has 0 errors and 0 warnings from a NagioSQL point of view.
Icinga core verification:
Icinga 1.6.1
Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org)
Copyright (c) 2009-2011 Nagios Core Development Team and Community
Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-02-2011
License: GPL

Reading configuration data...
   Read main config file okay...
Processing object config file '/usr/local/icinga/etc/commands.cfg'...
Processing object config file '/usr/local/icinga/etc/contactgroups.cfg'...
Processing object config file '/usr/local/icinga/etc/contacts.cfg'...
Processing object config file
'/usr/local/icinga/etc/contacttemplates.cfg'...
Processing object config file
'/usr/local/icinga/etc/hostdependencies.cfg'...
Processing object config file '/usr/local/icinga/etc/hostescalations.cfg'...
Processing object config file '/usr/local/icinga/etc/hostextinfo.cfg'...
Processing object config file '/usr/local/icinga/etc/hostgroups.cfg'...
Processing object config file '/usr/local/icinga/etc/hosttemplates.cfg'...
Processing object config file
'/usr/local/icinga/etc/servicedependencies.cfg'...
Processing object config file
'/usr/local/icinga/etc/serviceescalations.cfg'...
Processing object config file '/usr/local/icinga/etc/serviceextinfo.cfg'...
Processing object config file '/usr/local/icinga/etc/servicegroups.cfg'...
Processing object config file
'/usr/local/icinga/etc/servicetemplates.cfg'...
Processing object config file '/usr/local/icinga/etc/timeperiods.cfg'...
Processing object config directory '/usr/local/icinga/etc/hosts'...
Processing object config file
'/usr/local/icinga/etc/hosts/imap.us.itpassion.com.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/development.london.itpassion.co.uk.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/webdev.london.itpassion.co.uk.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/bastion.london.itpassion.co.uk.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/team.itpassion.com.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/icinga.london.itpassion.co.uk.cfg'...
Processing object config file '/usr/local/icinga/etc/hosts/FIA-CORE1.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/email.us.itpassion.com.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/database.london.itpassion.co.uk.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/www.london.itpassion.co.uk.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/smtp.us.itpassion.com.cfg'...
Processing object config file
'/usr/local/icinga/etc/hosts/logger.london.itpassion.co.uk.cfg'...
Processing object config directory '/usr/local/icinga/etc/services'...
Processing object config file
'/usr/local/icinga/etc/services/imp_nrpe.cfg'...
Processing object config file
'/usr/local/icinga/etc/services/imp_nrpe_win.cfg'...
Processing object config file
'/usr/local/icinga/etc/services/imp_cyrus.cfg'...
Processing object config file
'/usr/local/icinga/etc/services/imp_http.cfg'...
Processing object config file
'/usr/local/icinga/etc/services/imp_mysql.cfg'...
Processing object config file
'/usr/local/icinga/etc/services/imp_nrpe_apponotec_win.cfg'...
Processing object config file
'/usr/local/icinga/etc/services/imp_localhost.cfg'...
Processing object config directory '/usr/local/icinga/etc/modules'...
Processing object config file
'/usr/local/icinga/etc/modules/idoutils.cfg'...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
 Checked 95 services.
Checking hosts...
 Checked 12 hosts.
Checking host groups...
 Checked 2 host groups.
Checking service groups...
 Checked 3 service groups.
Checking contacts...
 Checked 4 contacts.
Checking contact groups...
 Checked 4 contact groups.
Checking service escalations...
 Checked 0 service escalations.
Checking service dependencies...
 Checked 22 service dependencies.
Checking host escalations...
 Checked 0 host escalations.
Checking host dependencies...
 Checked 0 host dependencies.
Checking commands...
 Checked 46 commands.
Checking time periods...
 Checked 4 time periods.
Checking modules...
 Checked 1 modules.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight
check

> 
> > [...]
> >
> > So, I'll go through them and make sure that there is a contact email
> > available for Icinga in the command / service / generic service
definitions.
> >
> > Would I need to have these services against a person or is a contact
> > group good enough for Icinga 1.6.1 to figure out $CONTACTEMAIL$?
> 
> A contactgroup consists of contactgroup members (contacts), so Icinga will
> figure out who to notify if you just put a contactgroup instead of a
single
> contact to your service definition. This behaviour is part of the
notification
> event, also checking if a contact is viable to be notified
(notification_period,
> etc).
> 
> So you're safe after fixing your configuration in 1.6.x - that being said,
you
> probably now figure why that change was made to 1.8 - it will remove the
> macrostring, not sending any mail (and your (mail) log will alarm you that
the
> command invocation to /bin/mail is missing a recipient too), as well as
the
> core will output a warning to syslog that this happened. It may be
annoying
> as f*ck, but better fix the configs in the first place, before hunting
this
> 'feature' down ;-)

Totally agree.

[...]

Regards,
Guus





More information about the icinga-users mailing list