Notify when service has been down for a specific period

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
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Notify when service has been down for a specific period

Post by neworderfac33 »

Good afternoon,

I have the following service definition that checks to see if the IIS service is up or down.

Code: Select all

define service{
       use                     generic-service
       hostgroup_name          my_hostgroups          
       service_description     Service -  W3SVC/IIS
       check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
       }
However, we often resync servers, meaning that IIS is down and is SUPPOSED to be down, until the sync is complete.

Is there any way in which I can only generate an alert status if the service has been down for a specified period, say 30 minutes?
Thanks in advance
Pete
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Notify when service has been down for a specific period

Post by scottwilkerson »

peterooney wrote:Good afternoon,

I have the following service definition that checks to see if the IIS service is up or down.

Code: Select all

define service{
       use                     generic-service
       hostgroup_name          my_hostgroups          
       service_description     Service -  W3SVC/IIS
       check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
       }
However, we often resync servers, meaning that IIS is down and is SUPPOSED to be down, until the sync is complete.

Is there any way in which I can only generate an alert status if the service has been down for a specified period, say 30 minutes?
Thanks in advance
Pete
Yes. You will want to add the first_notification_delay directive
https://assets.nagios.com/downloads/nag ... ml#service
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Notify when service has been down for a specific period

Post by neworderfac33 »

Thanks a lot for responding - can I add this directive to the service definition itself?

And if I add it into a template, are there any other values that I need to change there to make it work properly?

Pete
Last edited by neworderfac33 on Wed Aug 30, 2017 10:33 am, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Notify when service has been down for a specific period

Post by scottwilkerson »

peterooney wrote:Thanks a lot for responding - can I add this directive to the service definition itself?

Pete
Yes, it would look something like this:

Code: Select all

define service{
       use                     generic-service
       hostgroup_name          my_hostgroups         
       service_description     Service -  W3SVC/IIS
       check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
       first_notification_delay            30
       }
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Notify when service has been down for a specific period

Post by neworderfac33 »

That's brilliant - thank you! :-)

Please can you close the thread?

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

Re: Notify when service has been down for a specific period

Post by scottwilkerson »

peterooney wrote:That's brilliant - thank you! :-)

Please can you close the thread?

Pete
Glad we were able to assist! Closed.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked