regular and emergency notifications

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
drxeno
Posts: 1
Joined: Wed Aug 18, 2021 11:24 am

regular and emergency notifications

Post by drxeno »

What is the best way to have regular notifications for business hours, and emergency alerts for non-business hours? What we have is working as far as the business hours notifications goes, but not for the non-business ones.

This is our time periods:

Code: Select all

define timeperiod {
    timeperiod_name                     24x7
    name                                24x7
    alias                               24 Hours A Day, 7 Days A Week
    sunday                              00:00-23:59
    monday                              00:00-23:59
    tuesday                             00:00-23:59
    wednesday                           00:00-23:59
    thursday                            00:00-23:59
    friday                              00:00-23:59
    saturday                            00:00-23:59
    }

define timeperiod {
    timeperiod_name                     ch-holidays
    name                                ch-holidays
    alias                               CH Holidays
    january 1                           00:00-23:59     ; New Years
    july 4                              00:00-23:59     ; Independence Day
    thursday 4 november                 00:00-23:59     ; Thanksgiving (4th Thursday in November)
    december 25                         00:00-23:59     ; Christmas
    }

define timeperiod {
    timeperiod_name                     alerthours
    name                                alerthours
    alias                               Alert Hours
    monday                              08:10-18:00
    tuesday                             08:10-18:00
    wednesday                           08:10-18:00
    thursday                            08:10-18:00
    friday                              08:10-18:00
    exclude                             ch-holidays
    }

define timeperiod {
    timeperiod_name                     emergencyhours
    name                                emergencyhours
    alias                               Emergency Hours
    use                                 24x7
    exclude                             alerthours
    }
Here is a sample of our services:

Code: Select all

define service {
    name                            base-service
    active_checks_enabled           1
    passive_checks_enabled          0
    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
    check_interval                  5
    max_check_attempts              4
    check_interval                  5
    retry_interval                  1
    contact_groups                  techs
    notification_interval           120
    notification_period             alerthours
    action_url                      /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$' onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()' rel='/nagiosgraph/cgi-bin/showgraph.cgi?h
ost=$HOSTNAME$&service=$SERVICEDESC$
    notification_options            w,u,c,r
    register                        0
    }
define service {
    name                            generic-service
    use                             base-service
    check_period                    24x7
    notification_period             alerthours
    contact_groups                  techs
    register                        0
    }
define service {
    name                            emergency-service
    use                             base-service
    check_interval                  30
    notification_period             emergencyhours
    contact_groups                  emergency
    register                        0
    }
And here is one of the hosts in question:

Code: Select all

define host {
    use                             linux-server
    host_name                       ubek-testbed
    address                         192.168.1.70
    parents                         chswitch
    notification_period             24x7
    contact_groups                  emergency
    register                        1
    }

define service {
    use                             emergency-service
    check_command                   check_http!ubek-testbed.ch.local
    service_description             Site http://ubek-testbed.ch.local/ - emergency
    host_name                       ubek-testbed
    }
As I said, the business hours notifications are working fine, so I do not know why we are having this difficulty with this. Any help would be apreciated.
Locked