Re: using contacts causing double email alert
Posted: Fri Sep 12, 2014 11:03 am
hata_ph, could you post the logs that millissa requested, you guys seem to be on a pretty good path here!
Support for Nagios products and services
https://support.nagios.com/forum/
Code: Select all
# services template for DBA team
define service{
name generic-service-dba
use generic-service-template
contacts itdba
#contact_groups db-admins
}
Code: Select all
[1410754854] Caught SIGTERM, shutting down...
[1410754854] Successfully shutdown... (PID=7407)
[1410754854] Nagios 3.5.1 starting... (PID=20701)
[1410754854] Local time is Mon Sep 15 12:20:54 MYT 2014
[1410754854] LOG VERSION: 2.0
[1410754854] Finished daemonizing... (New PID=20702)
[1410754854] SERVICE FLAPPING ALERT: SIT-MBX02;Physical Memory;STARTED; Service appears to have started flapping (30.1% change >= 20.0% threshold)
[1410754854] SERVICE FLAPPING ALERT: SRMSHOST08A;Physical Memory;STARTED; Service appears to have started flapping (27.6% change >= 20.0% threshold)
[1410754924] SERVICE NOTIFICATION: itnetworksupport;6800SRETDB;F Drive;CRITICAL;notify-service-by-email;SNMP CRITICAL - F:\ Label:New Volume Serial Number 46939174 at 96% with 10,190 of 286,081 MB free
[1410754924] SERVICE NOTIFICATION: itdba;6800SRETDB;F Drive;CRITICAL;notify-service-by-email;SNMP CRITICAL - F:\ Label:New Volume Serial Number 46939174 at 96% with 10,190 of 286,081 MB free
Code: Select all
postconf -n
Code: Select all
# services template for DBA team
define service{
name generic-service-dba
use generic-service-template
contacts itdba
contact_groups null
#contact_groups db-admins
}
Code: Select all
administrator@SIT-NAGIOS:/etc/nagios3/conf.d$ postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = SIT-NAGIOS, localhost.localdomain, , localhost
myhostname = SIT-NAGIOS
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost = sit-smtp01.xxx.com
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
Code: Select all
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Code: Select all
contact_groups null
contacts itdba
Code: Select all
Sep 17 08:42:09 SIT-NAGIOS postfix/pickup[19373]: 668066008D: uid=106 from=<nagios>
Sep 17 08:42:09 SIT-NAGIOS postfix/cleanup[4639]: 668066008D: message-id=<20140917004209.668066008D@SIT-NAGIOS>
Sep 17 08:42:09 SIT-NAGIOS postfix/qmgr[976]: 668066008D: from=<nagios@SIT-NAGIOS>, size=629, nrcpt=1 (queue active)
Sep 17 08:42:09 SIT-NAGIOS postfix/smtp[4645]: 668066008D: to=<itnetworksupport@xxx.com>, relay=sit-smtp01.xxx.com[10.16.0.142]:25, delay=0.47, delays=0.11/0.07/0.02/0.28, dsn=2.6.0, status=sent (250 2.6.0 <20140917004209.668066008D@SIT-NAGIOS> Queued mail for delivery)
Sep 17 08:42:09 SIT-NAGIOS postfix/qmgr[976]: 668066008D: removed
Code: Select all
Sep 17 08:42:09 SIT-NAGIOS postfix/pickup[19373]: 8E979600B3: uid=106 from=<nagios>
Sep 17 08:42:09 SIT-NAGIOS postfix/cleanup[4639]: 8E979600B3: message-id=<20140917004209.8E979600B3@SIT-NAGIOS>
Sep 17 08:42:09 SIT-NAGIOS postfix/qmgr[976]: 8E979600B3: from=<nagios@SIT-NAGIOS>, size=649, nrcpt=2 (queue active)
Sep 17 08:42:09 SIT-NAGIOS postfix/smtp[4648]: 8E979600B3: to=<itdba@xxx.com>, relay=sit-smtp01.xxx.com[10.16.0.142]:25, delay=0.37, delays=0.01/0.04/0.09/0.22, dsn=2.6.0, status=sent (250 2.6.0 <20140917004209.8E979600B3@SIT-NAGIOS> Queued mail for delivery)
Sep 17 08:42:09 SIT-NAGIOS postfix/smtp[4648]: 8E979600B3: to=<itnetworksupport@xxx.com>, relay=sit-smtp01.xxx.com[10.16.0.142]:25, delay=0.37, delays=0.01/0.04/0.09/0.22, dsn=2.6.0, status=sent (250 2.6.0 <20140917004209.8E979600B3@SIT-NAGIOS> Queued mail for delivery)
Sep 17 08:42:09 SIT-NAGIOS postfix/qmgr[976]: 8E979600B3: removed
Code: Select all
[1410914529] SERVICE NOTIFICATION: itnetworksupport;6800SRETDB;F Drive;CRITICAL;notify-service-by-email;SNMP CRITICAL - F:\ Label:New Volume Serial Number 46939174 at 96% with 10,190 of 286,081 MB free
[1410914529] SERVICE NOTIFICATION: itdba;6800SRETDB;F Drive;CRITICAL;notify-service-by-email;SNMP CRITICAL - F:\ Label:New Volume Serial Number 46939174 at 96% with 10,190 of 286,081 MB free
Code: Select all
echo "Test body"|/usr/bin/mail -s "some subject" user1@example.com user2@example.com
Code: Select all
define contact{
contact_name nagiosadmin
use generic-contact
alias Nagios Admin
email millisa@example.com aaron@example.com
}