Time of Email 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.
TBlaine27
Posts: 10
Joined: Tue Apr 17, 2018 9:08 am

Time of Email Notifications

Post by TBlaine27 »

I am using Nagios Core v3

in my objects folder, I have a hosts.cfg file containing a list of IP/hosts I am just monitoring ping to see up/down state.

I am using postfix, and email notifications work great.

The problem is, Nagios is only sending out email notifications between 9am - 5pm daily, and none on weekends.

Where do I find and set this to send alerts 24x7

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

Re: Time of Email Notifications

Post by scottwilkerson »

You would have another config for the contact that is receiving the messages, assigned to that is a timeperiod for the host_notification_period and service_notification_period.

This timeperiod is another configuration that has days and times in it. Once modified you would need to restart the nagios service for the changes to take affect
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
TBlaine27
Posts: 10
Joined: Tue Apr 17, 2018 9:08 am

Re: Time of Email Notifications

Post by TBlaine27 »

This is my current contacts.cfg ---


define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias FINY ALERT ; Full name of user
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email,notify-service-by-sms
host_notification_commands notify-host-by-email,notify-host-by-sms
email me@myemail.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
pager +15555555555 ; <<***** CHANGE THIS TO YOUR PHONE NUMBER ******
}


define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Time of Email Notifications

Post by scottwilkerson »

so this is the timeperiods specified

Code: Select all

service_notification_period 24x7
host_notification_period 24x7
now you need to find the timeperiod definition for 24x7
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
TBlaine27
Posts: 10
Joined: Tue Apr 17, 2018 9:08 am

Re: Time of Email Notifications

Post by TBlaine27 »

would this need to be specified in my hosts.cfg file for each individual host?
TBlaine27
Posts: 10
Joined: Tue Apr 17, 2018 9:08 am

Re: Time of Email Notifications

Post by TBlaine27 »

my hosts.cfg file is a long list like this..

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name WiFi-AP-HR
alias WiFi-AP-HR
address 192.168.1.7
}

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name WiFi-AP-Training
alias WiFi-AP-Training
address 192.168.1.6
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Time of Email Notifications

Post by scottwilkerson »

No, these are contact definitions
https://assets.nagios.com/downloads/nag ... ml#contact

Did you fine the timeperiod definition for 24x7?

This is what they look like but the timeperiod_name would be 24x7
https://assets.nagios.com/downloads/nag ... timeperiod
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
TBlaine27
Posts: 10
Joined: Tue Apr 17, 2018 9:08 am

Re: Time of Email Notifications

Post by TBlaine27 »

contacts.cfg

define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias FINY ALERT ; Full name of user
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email,notify-service-by-sms
host_notification_commands notify-host-by-email,notify-host-by-sms
email tim@tcnets.com,service@tcnets.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
pager +17168706854 ; <<***** CHANGE THIS TO YOUR PHONE NUMBER ******
}

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}
TBlaine27
Posts: 10
Joined: Tue Apr 17, 2018 9:08 am

Re: Time of Email Notifications

Post by TBlaine27 »

timeperiods.cfg


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


# 'workhours' timeperiod definition
define timeperiod{
timeperiod_name workhours
alias Normal Work Hours
monday 09:00-17:00
tuesday 09:00-17:00
wednesday 09:00-17:00
thursday 09:00-17:00
friday 09:00-17:00
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Time of Email Notifications

Post by scottwilkerson »

Are you sure YOUR contact isn't set to use workhours because that looks like 9-5

Are you the nagiosadmin contact only, or is that your only contact?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked