Hello,
I got this warning in the logs today:
[1358219716.027789] [2048.1] [pid=971] Processing: '/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$'
[1358219716.027830] [2048.0] [pid=971] WARNING: An error occurred
processing macro 'CONTACTEMAIL'!
[1358219716.027843] [2048.1] [pid=971] Done. Final output:
'/usr/bin/printf "%b" "***** Icinga *****\n\nNotification Type: \n\nService:
Swap Usage\nHost: SMTP Server\nAddress: 173.203.206.161\nState:
CRITICAL\n\nDate/Time: Tue Jan 15 03:15:16 GMT 2013\n\nAdditional
Info:\n\nCHECK_NRPE: Socket timeout after 10 seconds.\n" | /bin/mail -s "**
Service Alert: SMTP Server/Swap Usage is CRITICAL **" $CONTACTEMAIL$'
So, something with the CONTACTEMAIL regarding the Swap Usage service is
wrong.
./etc/services/imp_nrpe.cfg
define service {
#NAGIOSQL_CONFIG_NAME imp_nrpe
host_name bastion. london.itpassion.co.uk,
database .london.itpassion.co.uk, development.london .itpassion.co.uk,
email.us .itpassion.com,imap .us.itpassion.com ,logger.london.itpassion
.co.uk,smtp.us .itpassion.com,webdev. london.itpassion.co. uk,www.london
.itpassion.co.uk
service_description Swap Usage
use generic-itp-service
check_command check_nrpe_swap!20%!10%
register 1
}
(Spaces in the host_name were introduced after copying the definition to
this email)
./etc/servicetemplates.cfg
define service {
name generic-itp-service
is_volatile 0
max_check_attempts 3
check_interval 10
retry_interval 2
active_checks_enabled 1
passive_checks_enabled 1
check_period SUSA_UK_0024
parallelize_check 1
obsess_over_service 1
check_freshness 0
event_handler notify-service-by-email
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 60
notification_period SUSA_UK_0024
notification_options w,u,c,r
notifications_enabled 1
contacts adm_leeu
contact_groups ITPSysAd
failure_prediction_enabled 1
register 0
}
./etc/contacts:
define contact {
contact_name adm_leeu
alias Guus Leeuw jr (Administrator)
contactgroups ITPSysAd
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period SUSA_UK_0024
service_notification_period SUSA_UK_0024
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
can_submit_commands 1
email guus . leeuw @ itpassion.com
register 1
}
(Spaces in the email address were introduced after copying the definition to
this email)
./etc/contactgroups.cfg
define contactgroup {
contactgroup_name ITPSysAd
alias ITPassion System Administrators
members adm_leeu
register 1
}
To me, this reads fine, and should not result in macro errors: Other
services that fail use the same generic-itp-service, and this particular
service / host combination does generate email from time to time.
Any insights into this will be greatly appreciated.
Regards,
Guus
> -----Original Message-----
> From: Guus Leeuw jr [mailto:[email protected]]
> Sent: 14 January 2013 05:05
> To: [email protected]
> Subject: Re: [icinga-users] Icinga sends email to [email protected]
>
> > -----Original Message-----
> > From: Michael Friedrich [mailto:[email protected]]
> > Sent: 13 January 2013 21:21
> > To: [email protected]
> > Subject: Re: [icinga-users] Icinga sends email to [email protected]
> >
> > 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
>
>
>
----------------------------------------------------------------------------
--
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122412
> _______________________________________________
> icinga-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/icinga-users
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/icinga-users