drewkerrigan / nagios-http-json

A generic plugin for Nagios which checks json values from a given HTTP endpoint against argument specified rules and determines the status and performance data for that service.
Other
67 stars 60 forks source link

add: Timestamp checks #87

Closed aro-lew closed 2 months ago

aro-lew commented 4 months ago

If the JSON has a Timestamp value you can check the age/youth with --key_time.

martialblog commented 4 months ago

Hi, thanks for the PR.

Could you give some context on/reasoning for the new functionality?

There should also be some examples added to the README and the code could use some testing. Check out the existing tests on how to implement those.

aro-lew commented 4 months ago

So I have an application with an HTTP JSON API. The application has two cron jobs which should run every hour. I can check the status of the last run and I have a Timestamp when the cron job last ran. Status checks work great with this check, but the Timestamp of the last run doesn't. So I implemented a check for the age of the Timestamp. (I also added checks for the opposite - how recent the Timestamp is and also how far in the future...)

Thank you for the response. Sorry for my late reply. I will add examples to the README and will add some testing. I hope it won't take me a long time.

aro-lew commented 4 months ago

I added some tests and wrote some information + examples to the README.

@martialblog could you please review this PR again?

martialblog commented 4 months ago

Thanks for the work. I will have a look at it.