Repository navigation
Add healthcheck endpoint #216
Description
Activity
Hi @eheydrick!
What kind of checks are you thinking about? We already have some checks in the web interface, though of course that's not intended for automated monitoring...
One use case is a load balancer health check. Another is a check from a monitoring system. The check would return OK when the IdP is up and able to accept requests.
A load balancer could be checked from the monitoring system itself. Actually, that's the proper way, as if you do it through SimpleSAMLphp then any problem there might tell you there's a problem with your load balancers, while there isn't.
Regarding a check for a monitoring system to discern whether an IdP is up and accepting requests... What does that mean exactly? That the web server is up? That PHP scripts are interpreted? That it is possible to fetch metadata from the IdP? That the endpoints are in place where they are expected? Or that they reply correctly upon a SAML request?
As you see, there's many things involved in an IdP being "up and running", so it is not that easy to tell.
In any case, did you have a look at the sanitycheck module?
A load balancer could be checked from the monitoring system itself.
The use case is AWS Elastic Load Balancing (ELB). ELB will check your individual nodes every 10 seconds to see what nodes are healthy and should receive requests. ELB will send SimpleSAMLphp a simple HTTP request and will expect a 200 http status code. Ideally, the application implements a semi-robust health check that confirms that the database is alive and the application is ready to receive and serve requests.
Oh, I see! So you are thinking about status monitoring from the load balancers themselves...
That's quite specific, anyway. I would say the best way to achieve that is to enable the sanitycheck module, then add your own module hooking into sanitycheck to add all the checks you need.
@ottenhoff, that's exactly what I want. Looks like the sanitycheck page will suffice as a basic health check.
Oh, by the way, I forgot yesterday to give you an example on how to add hooks into sanitycheck to add your own tests. Take a look at this.
Hope that helps!
- locked as resolved and limited conversation to collaborators
on Mar 20, 2023
It would be nice if there was an endpoint that could provide basic health status. This would be used for monitoring that simplesamlphp is running properly.