Page 1 of 1

Passive check, freshness at a custom date

Posted: Mon Mar 30, 2020 12:44 pm
by Nikoo
Hello team,

I am currently having an issue on a Passive check: I have a custom script that will be run each first day of the month at 05AM (I do not have control about running time, it could take some minutes to an hour up to 3 hours), I need to monitor this behavior and found the following Nagios' cases:
  • my Bash script has crashed: I handle sending notification to nagios via NSCA.
  • my Bash script worked: same behavior as above.
The last case, my script did not run (crontab disabled, permission modified on my script...): in that case Nagios did not receive freshness update on this passive check.

I have the following questions :
  • How can I set-up my passive check to be only performed on the 1st day of each month ?
  • How is calculated the freshness_threshold based on the previous passive check ?
I am currently using the following test templates on my lab to perform some try and error, but no good answer at the moment:

timeperiod configuration:

Code: Select all

define timeperiod {

    name                    mondayonly
    timeperiod_name         mondayonly
    alias                   Monday Work Hours

    monday                  19:20-19:22
    #day 1                  11:00-11:02
}
localhost config:

Code: Select all

define service {
   service_description           FOLDER-clean
   check_command                 no-folder-report
   host_name                     localhost
   contact_groups                admins
   flap_detection_enabled        0
   event_handler_enabled         0
   max_check_attempts		 1
   check_interval          	 1
   retry_interval          	 1
   active_checks_enabled   	 0
   passive_checks_enabled  	 1
   notifications_enabled   	 1
   check_freshness         	 1
   freshness_threshold     	 90
   check_period            	 mondayonly
}


define command {
    command_name    no-folder-report
    command_line    /usr/lib64/nagios/plugins/check_dummy 2 "CRITICAL: Results of job were not reported!"
}
As I do not know when my script could finished (at least, it could be less than 2 hours), my goal is to start my scrip at 05AM, and if at 11AM, Nagios did not received a status update (OK or Critical), it will generate a critical alert.

Reagrds,

Nicolas

Re: Passive check, freshness at a custom date

Posted: Mon Mar 30, 2020 7:39 pm
by Box293
From what I understand, freshness checks do not adhere to timeperiods. It is simply checking the age of the last check result against the freshness threshold. There is a good explanation here in the documentation:

https://assets.nagios.com/downloads/nag ... hness.html

Re: Passive check, freshness at a custom date

Posted: Tue Mar 31, 2020 2:38 am
by Nikoo
Yes you're right,

I discover that page too.

I may have missed some documentation, but is it possible to set-up nagios passive check to await an update on a given number of day; such as "day 1 + 39600".

With this setting, we know that a service update will occure the first day of each month before 11AM. If the update is delayed after 11AM or not send at all, the freshness will be over 11AM and triggered an alert.

Regards,

Nicolas

Re: Passive check, freshness at a custom date

Posted: Tue Mar 31, 2020 8:36 am
by scottwilkerson
Nikoo wrote:Yes you're right,

I discover that page too.

I may have missed some documentation, but is it possible to set-up nagios passive check to await an update on a given number of day; such as "day 1 + 39600".

With this setting, we know that a service update will occure the first day of each month before 11AM. If the update is delayed after 11AM or not send at all, the freshness will be over 11AM and triggered an alert.

Regards,

Nicolas
No, this is not possible

Re: Passive check, freshness at a custom date

Posted: Tue Mar 31, 2020 11:04 am
by Nikoo
Hello,

Could I submit a feature request on github ?

Best regards,

Nicolas

Re: Passive check, freshness at a custom date

Posted: Tue Mar 31, 2020 11:13 am
by scottwilkerson
Nikoo wrote:Hello,

Could I submit a feature request on github ?

Best regards,

Nicolas
sure
https://github.com/NagiosEnterprises/nagioscore/issues