Query Regarding Cloudflare Health Check API
I'm seeking assistance regarding the Cloudflare Health Check API. Specifically, I'm looking for a way to retrieve information on when the status of a health check last changed.
Link to API Call: https://developers.cloudflare.com/api/operations/health-checks-list-health-checks
Is there a timestamp provided in the response? I couldn't locate one.
In the dashboard under Traffic --> Health Check Analytics, it's possible to filter timestamps for a health check through the Event Log. This is precisely the information I need, specifically the timestamp of the last "Health Status Change" event log.
Does anyone know of a solution for this?
It seems that through Analytics GraphQL, one could likely access this data. However, it would be preferable to achieve this without using GraphQL. Does anyone have an example of how to query the data from the API call "health-checks-list-health-checks" along with the Event Log for "Health Status Change" solely through GraphQL?
Thank you in advance for any assistance or insights you can provide.
Best regards,
Stefan
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
1 Reply
When it comes to analytics, the vast majority, and all of the new analytics, all live in GraphQL and are accessable through them.
If you wanted to get the last healthChange for a specific check, you could filter by healthChanged and by datetime, and limit by 1, ex:
that would only give you the event if it happened within that date though
to get more of a usable log with more then one health check, you could use the groups dataset variant and filter just by healthChanged:
you'd get output like this:
I would recommend getting a nice graphql client like graphiql
https://github.com/skevy/graphiql-app, which has introspection/ability to look through schemas built in, look at Dev tools for the graphql requeste the dashboard is using, and play around with it a bit
any sort of analytics the dashboard shows, you can get, and often with more precision/extra fields/etc, graphql is really powerful