Service Critical not sending notification.

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.
Post Reply
itinneed2022
Posts: 1
Joined: Fri Nov 03, 2023 2:41 pm

Service Critical not sending notification.

Post by itinneed2022 »

I've setup a service alert in Nagios 4.3.4, however when it goes critical, no notifications are being sent out.
Here's the config:

Code: Select all

#/etc/nagios/custom/templates.cfg
define service{
        name                            generic-service 	; The 'name' of this service template
        active_checks_enabled           1       		; Active service checks are enabled
        passive_checks_enabled          1    		   	; Passive service checks are enabled/accepted
        parallelize_check               1       		; Active service checks should be parallelized (disabling this can lead to major performance problems)
        obsess_over_service             1       		; We should obsess over this service (if necessary)
        check_freshness                 0       		; Default is to NOT check service 'freshness'
        notifications_enabled           1       		; Service notifications are enabled
        event_handler_enabled           1       		; Service event handler is enabled
        flap_detection_enabled          1       		; Flap detection is enabled
        flap_detection_options          o,c

        process_perf_data               1       		; Process performance data
        retain_status_information       1       		; Retain status information across program restarts
        retain_nonstatus_information    1       		; Retain non-status information across program restarts
        is_volatile                     0       		; The service is not volatile
        check_period                    24x7			; The service can be checked at any time of the day
        max_check_attempts              3			; Re-check the service up to 3 times in order to determine its final (hard) state
        check_interval           10			; Check the service every 10 minutes under normal conditions
        retry_interval            2			; Re-check the service every two minutes until a hard state can be determined
        contact_groups                  admins			; Notifications get sent out to everyone in the 'admins' group
	notification_options		c,r			; Send notifications about warning, unknown, critical, and recovery events
        notification_interval           60			; Re-notify about service problems every hour
        notification_period             24x7			; Notifications can be sent out at any time
         register                        0       		; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
        }


define service{
        use                             generic-service
        name                            basic-service
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              2
        check_interval           10
        retry_interval            3
        notification_interval           10
        notification_period             24x7
        register                        0
        }

#/etc/nagios/custom/hosts/chillwater.cfg
define host{
    name                    chillwater
    check_period            24x7
    check_interval          5
    retry_interval          5
    max_check_attempts      3
    notification_period     24x7
    notification_interval   1
    notification_options    d,r,f
    notifications_enabled   1
    check_command           check-host-alive
    contact_groups         chillwatergroup
    register                0
}

define hostgroup {
    hostgroup_name      chillwater
    alias               chillwater
    members             cc-bb-mr.company.com,cc-bb-north.company.com
}

define host {
   address              cc-bb-mr.company.com
   host_name            cc-bb-mr.company.com
   use                  chillwater
}


define host {
   address              cc-bb-north.company.com
   host_name            cc-bb-north.company.com
   use                  chillwater
}

#/etc/nagios/custom/services/chillwater.cfg
define servicegroup {
        servicegroup_name       chillwater
        alias                   chillwater
}

define service {
    use                 basic-service
    host_name           cc-bb-mr.company.com
    service_description Liebert1-6-heat-flow
    servicegroups       chillwater
    check_interval          5
    notification_options    c,r,f
    notification_interval   5
    check_command       chillwatersnmp1
    contact_groups     chillwatergroup
}

define service {
    use                 basic-service
    host_name           cc-bb-mr.company.com
    service_description Bridge-heat-flow
    servicegroups       chillwater
    check_interval          5
    notification_options    c,r,f
    notification_interval   5
    check_command       chillwatersnmp2
    contact_groups     chillwatergroup
}

define service {
    use                 basic-service
    host_name           cc-bb-north.company.com
    service_description HPC-cool-heat-flow
    servicegroups       chillwater
    check_interval          5
    notification_options    c,r,f
    notification_interval   5
    check_command       chillwatersnmp3
    contact_groups     chillwatergroup
}

#/etc/nagios/custom/commands.cfg
define command {
    command_name        chillwatersnmp1
    command_line        $USER1$/check_snmp -H $HOSTNAME$ -C techlook -o 1.3.6.1.4.1.3815.1.2.2.1.1.2.1.1.2.266 -s 0
}

define command {
    command_name        chillwatersnmp2
    command_line        $USER1$/check_snmp -H $HOSTNAME$ -C techlook -o 1.3.6.1.4.1.3815.1.2.2.1.1.2.1.1.2.279 -s 0
}

define command {
    command_name        chillwatersnmp3
    command_line        $USER1$/check_snmp -H $HOSTNAME$ -C techlook -o 1.3.6.1.4.1.3815.1.2.2.1.1.2.1.1.2.279 -s 0
}

#/etc/nagios/custom/contacts.cfg
define contact {
    name                                my_contact
    service_notification_period         24x7
    host_notification_period            24x7
    host_notifications_enabled          0
    service_notifications_enabled       0
    service_notification_options        n
    host_notification_options           n
    service_notification_commands       notify-service-by-email
    host_notification_commands          notify-host-by-email
	contactgroups						chillwatergroup
    register                            0
}

define contact{
        contact_name        myemail
        alias               My Name
        use                 my_contact
        email               jo2712@columbia.edu
        }
        
define contactgroup{
        contactgroup_name       chillwatergroup
        alias                   	    chillwatergroup
        members                      myemail
}
What have I missed that e-mails are not being sent? This command:

Code: Select all

$USER1$/check_snmp -H $HOSTNAME$ -C techlook -o 1.3.6.1.4.1.3815.1.2.2.1.1.2.1.1.2.279 -s 0
Is purposefully set to force a critical state on the monitor (the monitor returns a string value that is not zero). So being that I have the service notification_options set to c,r,f, I should be seeing e-mails right?
gwesterman
Posts: 97
Joined: Wed Aug 23, 2023 11:29 am

Re: Service Critical not sending notification.

Post by gwesterman »

Hi @itinneed2022,

If you haven't already, I would make sure whatever you have setup to send/receive email notifications is properly configured (i.e. ensure that the notification is not being triggered, as opposed to not being received). These links might be helpful for setting up email notifications if that is indeed the issue:
- Core notifications doc
- Setup email notifs support discussion and configure email support discussion

Let us know if you can narrow down the problem and if there is anything else we can help you with.
Post Reply