Multiple Thresholds for Different Time Periods

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
louissiong
Posts: 32
Joined: Wed Nov 20, 2019 1:07 am

Multiple Thresholds for Different Time Periods

Post by louissiong »

Hi Nagios,

At present, there is a requirement for us to create a service in Nagios Xi with different thresholds
over varied timeframes. The objective is to find out the 'Active Connections' of our transport system
which tend to fluctuate widely over time. Eg. we need to set critical threshold as 700 from 0000 to 0100
from Mon to Fri and 1200 from 0500 onward. The threshold values will change on an hourly basis whether
weekdays or weekends. Should it exceed the threshold, Nagios will trigger alerts.
On exploring the functions in CCM Services and Time Periods, we realize there are no options and features
that allow us to perform such tasks.

Please give us your valuable advice. Thanks a lot.



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

Re: Multiple Thresholds for Different Time Periods

Post by scottwilkerson »

Unfortunately, the only way to accomplish this is to create 2 separate services for the same check, setting the timeperiod and thresholds for each to match the requirements.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
louissiong
Posts: 32
Joined: Wed Nov 20, 2019 1:07 am

Re: Multiple Thresholds for Different Time Periods

Post by louissiong »

Oh I see. Is there a better method as I am afraid we are likely to create many more services ?
Can we just add a time option in the argument option ? Thanks
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Multiple Thresholds for Different Time Periods

Post by scottwilkerson »

louissiong wrote:Oh I see. Is there a better method as I am afraid we are likely to create many more services ?
Can we just add a time option in the argument option ? Thanks
If you created a custom wrapper plugin you could have the wrapper plugin determine the current time and run the real plugin with the threshold values you want, that would be a possibility you could custom create.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
louissiong
Posts: 32
Joined: Wed Nov 20, 2019 1:07 am

Re: Multiple Thresholds for Different Time Periods

Post by louissiong »

Thanks. Will you be able to shed some light on how we can proceed with this wrapper plugin ?
Any document that we can reference from or sample scripts ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Multiple Thresholds for Different Time Periods

Post by scottwilkerson »

I can't write it for you, but the logic would looks something like this

Code: Select all

if time is from 0000 to 0100 AND day of week is Mon to Fri 
  critical=700
elif time is from 0500 to 2359 AND day of week is Mon to Fri 
  critical=1200
else
  critical=normal value

/path/to/plugin -c $critical
Here' s a doc showing how to add the plugin to XI and add a command that you can assign
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked