Scheduled downtime configuration for Nagios Core

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
suresh.ramasamy
Posts: 6
Joined: Mon Mar 06, 2017 10:12 am

Scheduled downtime configuration for Nagios Core

Post by suresh.ramasamy »

After some research in google found the below configuration to be used in timeperiods.cfg for scheduling downtime.

Code: Select all

define timeperiod{
        timeperiod_name weekly-maintenance
        alias           Weekly Maintenance Windows
        sunday          00:00-04:29,04:45-00:00
        monday          00:00-04:29,04:45-00:00
        tuesday         00:00-04:29,04:45-00:00
        wednesday       00:00-04:29,04:45-00:00
        thursday        00:00-04:29,04:45-00:00
        friday          00:00-04:29,04:45-00:00
}
here is the template.cfg configuration.

Code: Select all

define service{
        name                            CRM-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
        failure_prediction_enabled      1                       ; Failure prediction is enabled
        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
        normal_check_interval           2                      ; Check the service every 10 minutes under normal conditions
        retry_check_interval            1                       ; Re-check the service every two minutes until a hard state can be determined
        contact_groups                  CRMadmins                     ; Notifications get sent out to everyone in the 'admins' group
        notification_options            w,u,f,c,r                 ; Send notifications about warning, unknown, critical, and recovery events
        notification_interval           5                     ; Re-notify about service problems every hour
        notification_period             weekly-maintenance                   ; Notifications can be sent out at any time
         register                        0                      ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
        }
Based on the provided timeperiod.cfg configuration, scheduled downtime would be between 4:30 to 4:45 and there should not be any alert sent out during this time frame.

we are not getting alert E-Mails or recovery emails even after completing the scheduled downtime which is 4:30 to 4:45.

is any change required in my current setup ?
Last edited by mcapra on Thu Mar 16, 2017 3:36 pm, edited 1 time in total.
Reason: code blocks for MAXIMUM READABILITY
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Scheduled downtime configuration for Nagios Core

Post by mcapra »

You should revise your time period like so:

Code: Select all

define timeperiod{
timeperiod_name weekly-maintenance
alias Weekly Maintenance Windows
sunday 00:00-04:29,04:45-24:00
monday 00:00-04:29,04:45-24:00
tuesday 00:00-04:29,04:45-24:00
wednesday 00:00-04:29,04:45-24:00
thursday 00:00-04:29,04:45-24:00
friday 00:00-04:29,04:45-24:00
}
Your previous range of 04:45-00:00 was incorrect. If you want a range that means "from 04:45 until the end of the day", 04:45-24:00 is more appropriate. This combined with your template should effectively establish a period from 04:29-04:45 in which no notifications are sent for all hosts using that template.

You may also want to include Saturday depending on whether or not maintanance is run on that day.

More info:
https://assets.nagios.com/downloads/nag ... timeperiod
Former Nagios employee
https://www.mcapra.com/
Locked