Notifications not triggering

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
RyanUI
Posts: 2
Joined: Thu Apr 09, 2020 2:08 pm

Notifications not triggering

Post by RyanUI »

Hi all! This might be an easy answer and I may need to just walk away and come back to see what needs to be changed.. been looking at this for over an hr.

I've got a new Nagios install 4.4.5 and checks work 100% the problem I'm having is getting email notifications. I tried fiddling with the numbers but I just can't get it to be consistent. I got 2 or three emails and now nothing.

What I'm looking to do is check services every 3mins and if there is a problem to instantly alert me and then check again in 2 min and if there is still a problem to alert me again. and to keep doing that for 2hrs. It seems like a lot of emails but certain core services I need to be sure are operational.

Here's what I have.

Code: Select all

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$
}

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$
}

define hostgroup{
	hostgroup_name	databases	; The name of the hostgroup
	alias		DB Servers	; Long name of the group
	members		192.168.1.55
}
define host{
	use linux-server ; 
	host_name 192.168.1.55 ;
	alias 192.168.1.55 ;
	address 192.168.1.55 ;
}
define service{
	use generic-service
	host_name 192.168.1.55
	service_description Replication Running
	check_command check_rep
}

	
define contact {
    name                            generic-contact ;
    service_notification_period     24x7            ;
    host_notification_period        24x7            ;
    service_notification_options    w,u,c,r,f,s     ;
    host_notification_options       d,u,r,f,s       ;
    service_notification_commands   notify-service-by-email ;
    host_notification_commands      notify-host-by-email;
    register                        0               ;
}
define host {
    name                            generic-host    ;
    notifications_enabled           1               ;
    event_handler_enabled           1               ;
    flap_detection_enabled          1               ;
    process_perf_data               1               ;
    retain_status_information       1               ;
    retain_nonstatus_information    1               ;
    notification_period             24x7            ;
    register                        0               ;
}
define host {
    name                            linux-server    ;
    use                             generic-host    ;
    check_period                    24x7            ;
    check_interval                  3               ;
    retry_interval                  2               ;
    max_check_attempts              120              ;
    check_command                   check-host-alive;
    notification_period             24x7       ;

    notification_interval           3             ;
    notification_options            d,u,r           ;
    contact_groups                  admins          ;
    register                        0               ;
}
define service {
    name                            generic-service ;
    active_checks_enabled           1               ;
    passive_checks_enabled          1               ;
    parallelize_check               1               ;
    obsess_over_service             1               ;
    check_freshness                 0               ;
    notifications_enabled           1               ;
    event_handler_enabled           1               ;
    flap_detection_enabled          1               ;
    process_perf_data               1               ;
    retain_status_information       1               ;
    retain_nonstatus_information    1               ;
    is_volatile                     0               ;
    check_period                    24x7            ;
    max_check_attempts              120              ;
    check_interval                  3               ;
    retry_interval                  2               ;
    contact_groups                  admins          ;
    notification_options            w,u,c,r         ;
    notification_interval           3
    notification_period             24x7            ;
    register                        0               ;
}
if I do a send custom notification it goes through perfectly. Just not the critical / warning / down ones..

Any help would be very appr!

thanks
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Notifications not triggering

Post by scottwilkerson »

Code: Select all

    check_interval                  3               ;
    retry_interval                  2               ;
    max_check_attempts              120              ;
max_check_attempts is the number of attempts at the retry_interval before an alert is generated, with the settings above, an alert would not be sent until the host has been down for 240 minutes
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
RyanUI
Posts: 2
Joined: Thu Apr 09, 2020 2:08 pm

Re: Notifications not triggering

Post by RyanUI »

wow.. I knew it had to be something simple. THANK YOU!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Notifications not triggering

Post by scottwilkerson »

RyanUI wrote:wow.. I knew it had to be something simple. THANK YOU!
No problem, Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked