healthchecks / healthchecks

Open-source cron job and background task monitoring service, written in Python & Django

Home Page:https://healthchecks.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Checks API field for last successful ping

Kemichal opened this issue · comments

The /checks API already contains a field last_ping, this value will be the date for the last ping, including start or fail pings (AFAIK).

What I would like to know, via the API, is when the last successful ping happened.
Adding a new field like last_successful_ping would be very helpful.

We don't currently track the last successful ping in the database, so making this work would not be as simple as exposing an additional database field.

Out of curiosity, what is your use case, how would you use the last successful ping timestamp?

We don't currently track the last successful ping in the database, so making this work would not be as simple as exposing an additional database field.

I see

Out of curiosity, what is your use case, how would you use the last successful ping timestamp?

One of my use cases is to monitor background jobs (backups etc) on a lot of servers.
When these jobs start I send a start ping and then a success/fail ping when the job is done/crashed.

The thing is that some of these systems I'm monitoring are in environments where it's not unsual that the internet or power goes out for a few days.

So if some of my jobs goes down for a day or so I'm not going to start investigating the problem most of the time, but after a few days I'm more keen to look into it.

Therefor I have made an internal status page (using the API) that sorts the jobs in order of last successful ping (I thought) with extra visuals to signal a system that has been off for longer than 2 days.

With what's available today, you could look at using the List check's status changes API. For checks that are currently down, you can use this API endpoint to determine when they went down (and so, for how long they have been down).

The downside of this approach is the additional HTTP requests to fetch this information.

@cuu508 Thanks for the suggestion, I think I could get it to work with flips. The extra requests are no big deal for my use case.

This issue can be closed unless you want to track it.