Page 1 of 1

send alert once in a day evenif the status is "OK"

Posted: Wed Mar 18, 2015 8:43 am
by itzforu
Hello Everybody,

I am using nagios to monitor more than 50 linux servers and its working perfectly.

Now I would like to get an email alert from for services on each day morning evenif the status is okay. is it possible to do with nagios?

Thanks in advance

Re: send alert once in a day evenif the status is "OK"

Posted: Wed Mar 18, 2015 11:43 am
by abrist
Just to clarify, are you looking to receive an OK email once a day?
If so, do you want to do so for specific services, or all services?
What is the use case for this?

Re: send alert once in a day evenif the status is "OK"

Posted: Thu Mar 19, 2015 10:31 am
by itzforu
Thanks for you reply.

yes, i need to receive OK email once a day.

I want to do this for only one service.

Re: send alert once in a day evenif the status is "OK"

Posted: Thu Mar 19, 2015 2:14 pm
by jdalrymple
There is no simple way to do this - especially if you want it to be done at a set time each day. The best method that comes to mind would be to write a script in your language of choice that parses the status.dat file and polls the information you seek and E-mails you. I've searched the exchange for such a script and don't see one so you may have to write it yourself or aggregate a group of similarly functioning scripts to achieve your goal.

Re: send alert once in a day evenif the status is "OK"

Posted: Tue Jan 19, 2016 12:27 am
by AlexZ0nder
Hi everyone!
Today I tried to resolve this issue and realized that we have time periods in Nagios and what if you could create new time period for one hour in the morning for every day... and set this time period in your service as this one.
:D
I have created one like this and right now just waiting the result.

P.S. itzforu, please let me know if it will help you. ;)

Re: send alert once in a day evenif the status is "OK"

Posted: Tue Jan 19, 2016 1:32 pm
by hsmith
@AlexZ0nder thanks for the information. Let us know how it goes!

Re: send alert once in a day evenif the status is "OK"

Posted: Thu Jan 21, 2016 1:05 am
by AlexZ0nder
Hi there!
So... about my thought... It's alive!!! :D

Here is my config files:

/usr/local/nagios/etc/services/puppet_filed_nodes_prod.cfg

Code: Select all

....
define service {
        host_name                       prod-puppet
        service_description             Puppet failed nodes PROD
        display_name                    Puppet_failed_nodes_PROD
        check_command                   check_puppet_failed!!!!!!!!
        initial_state                   u
        max_check_attempts              5
        check_interval                  1
        retry_interval                  1
        check_period                    24x7
        notification_interval           60
        first_notification_delay        0
        notification_period             Once_a_day_morning
        notification_options            w,c,u,r,f,s,
        notifications_enabled           1
        contact_groups                  PROD
        register                        1
        }
....
/usr/local/nagios/etc/timeperiods.cfg

Code: Select all

....

define timeperiod {
        timeperiod_name                         Once_a_day_morning
        alias                                   Once in a day in the morning
        sunday                                  09:00-09:50
        monday                                  09:00-09:50
        tuesday                                 09:00-09:50
        wednesday                               09:00-09:50
        thursday                                09:00-09:50
        friday                                  09:00-09:50
        saturday                                09:00-09:50
        }

.....
P.S. We use Nagios XI Version : 2012R2.9

Re: send alert once in a day evenif the status is "OK"

Posted: Thu Jan 21, 2016 10:47 am
by rkennedy
Is this working as expected then, or did you have a question about your configuration?