I am currently trying to write a python script to check whether map services are up and responding. The first thing that came to mind for me to do this was to use the REST API and get a status response and/or to query the map service. This appears to be working so far but I am not sure if this is a true indication of whether a map service is available and responding. Does anyone have any experience with checking map service health or can verify that I am going about this the right way?
querying individual layers makes sense to me. As you know REST resources are most likely get cached, therefore that is not highly reliable to check if layers in a map service are all in good health. Whereas query will definitely give you that confidence.
I'd probably simply make a query call with returnRecordCount=True parameter and make sure the result matches my expectation or non-zero (whichever works better for you); or just get attributes for a feature of layer if you want to.
hope this helps
Thanks for the tip about query. Part of my check was to use the server admin endpoint to check the status. Usually this returns STARTED if the map service is available, but I was thinking it might not give a response if for some reason the service got into some kind of error state. That is why I added the query as a kind of second check.
All of our map services are public. One of our users created a simple ASP.NET page that will send 15 queries spread accross 10 map services and the geometry service. The results are displayed in a table. If the 15 query results match the expected result the then the text in the table is green. If the results do not match then the corresponding table row is red.
The user created this ASP.NET page to test our map services that they are using in an application. They posted it to a public web server so we could also take advantage of it as a diagnostic / monitoring tool. It is simple but it is very helpful. Send me a private message if you want more info.