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
Multiple Thresholds for Different Time Periods
-
louissiong
- Posts: 32
- Joined: Wed Nov 20, 2019 1:07 am
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Multiple Thresholds for Different Time Periods
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.
-
louissiong
- Posts: 32
- Joined: Wed Nov 20, 2019 1:07 am
Re: Multiple Thresholds for Different Time Periods
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
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
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.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
-
louissiong
- Posts: 32
- Joined: Wed Nov 20, 2019 1:07 am
Re: Multiple Thresholds for Different Time Periods
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 ?
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
I can't write it for you, but the logic would looks something like this
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
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 $criticalhttps://assets.nagios.com/downloads/nag ... ios-XI.pdf