Host timeperiod isnt applied to its services?

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Host timeperiod isnt applied to its services?

Postby riahc3 » Sun Aug 11, 2019 12:05 am

Hello

I just added a timeperiod to the notification and check and while it does work for the host (eg. it does not alert nor check out of that time period), it still alerts me of the services out of that time period.

Doesnt it get inherited?

Thanks
riahc3
 
Posts: 26
Joined: Thu Apr 05, 2018 9:36 am

Re: Host timeperiod isnt applied to its services?

Postby Guyver1 » Sun Aug 11, 2019 1:36 am

I believe you have to set time periods on your services

use a template service for say in business hours only services 6am-6pm and then apply that template to all the services you only want to alert in business hours

https://assets.nagios.com/downloads/nag ... ml#service
Guyver1
 
Posts: 16
Joined: Tue Apr 16, 2019 4:43 am

Re: Host timeperiod isnt applied to its services?

Postby riahc3 » Sun Aug 11, 2019 9:39 am

Guyver1 wrote:I believe you have to set time periods on your services

use a template service for say in business hours only services 6am-6pm and then apply that template to all the services you only want to alert in business hours

https://assets.nagios.com/downloads/nag ... ml#service



That fucking sucks....Any other way?

I have a service assigned to host groups so I cant do it like that.
riahc3
 
Posts: 26
Joined: Thu Apr 05, 2018 9:36 am

Re: Host timeperiod isnt applied to its services?

Postby Guyver1 » Sun Aug 11, 2019 10:34 am

Hi,

Boomark this page as it has all the definitions of all the object types:
https://assets.nagios.com/downloads/nag ... tions.html

Looking at the notification options for a host:
notification_options:
This directive is used to determine when notifications for the host should be sent out. Valid options are a combination of one or more of the following:

d = send notifications on a DOWN state
u = send notifications on an UNREACHABLE state
r = send notifications on recoveries (OK state)
f = send notifications when the host starts and stops flapping
s = send notifications when scheduled downtime starts and ends.

If you specify n (none) as an option, no host notifications will be sent out. If you do not specify any notification options, Nagios will assume that you want notifications to be sent out for all possible states. Example: If you specify d,r in this field, notifications will only be sent out when the host goes DOWN and when it recovers from a DOWN state.

So the notifications for a host are not the same as the notifications for a service.
Notifications for a host simply tell whether the host is up, down, flapping or has recovered.

Service notifications only tell you about the state of the service, not the host.

You may need to re-think your service configuration and you may possibly need two separate services, one for your 24x7 alerting hosts and a separate one for your business hours only hosts:

24x7 disk check
define service {
host_name host1,host2,host3,host4
service_description check-disk-sda1
check_command check-disk!/dev/sda1
max_check_attempts 5
check_interval 5
retry_interval 3
check_period 24x7
notification_interval 30
notification_period 24x7
notification_options w,c,r
contact_groups linux-admins
}

business hours only disk check
define service {
host_name host5,host6,host7,host8
service_description check-disk-sda1
check_command check-disk!/dev/sda1
max_check_attempts 5
check_interval 5
retry_interval 3
check_period workhours
notification_interval 30
notification_period workhours
notification_options w,c,r
contact_groups linux-admins
}


You could do this fairly quickly by creating two hostgroups:
24x7_hosts
buisiness_hours_hosts

and add in your hosts to each host group and then assign the relevant hostgroup to the correct services as I created above instead of specifying hosts.

If a customer has 24x7 support then it would be assumed that their servers would require 24x7 monitoring on all services on all their servers and a business hours only support customer would only need business hour alerting on all the services on their servers.

Its all about how you want to configure your config files and how you write your hosts/services
Guyver1
 
Posts: 16
Joined: Tue Apr 16, 2019 4:43 am

Re: Host timeperiod isnt applied to its services?

Postby scottwilkerson » Mon Aug 12, 2019 8:38 am

Yes you must apply to the objects themselves or an attached template
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectinheritance.html
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15796
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Host timeperiod isnt applied to its services?

Postby riahc3 » Tue Aug 13, 2019 3:14 pm

We are talking about 28 services......28 services that need to be duplicated at least twice.....

I still dont get why Nagios cant use some intelligence and if the host doesnt check, the services shouldnt get checked either.

It would be almost easier to set a scheduled downtime period on the host....Those DO get replicated to the service.

But, AFAIK, you cant do a "scheduled_downtime_period" i think
riahc3
 
Posts: 26
Joined: Thu Apr 05, 2018 9:36 am

Re: Host timeperiod isnt applied to its services?

Postby scottwilkerson » Tue Aug 13, 2019 3:20 pm

Unfortunately what you are looking for doesn't exist in the current code base for Nagios Core, however, it is an open source project so you can feel free to modify it to meet your custom needs, the project is located here
https://github.com/NagiosEnterprises/nagioscore

I will point out that if you use templates when setting up your services, changes would only need to be made in the affected template file, that would be just one change.

Nagios XI is another option with built-in configuration management and a bulk modification wizard, you can do steps like the above in about 3 clicks
https://www.nagios.com/products/nagios-xi/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15796
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 16 guests