I couldn’t figure out if there is a method to check how our services are healthy.
For example, I need a tool to send a notification for me if one of my services are stopped suddenly or any failure happened to my services.
I need any method to make a periodic check on my services.
Any suggestion for that?
Best,
Rawan
Thanks in advance.
Hi All
Please check with this to find status of map services health
# -*- coding: utf-8 -*-
import requests
r = requests.get('http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer')
print r.status_code
print'ESRI_Census_USA'
r = requests.get('http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsBasemap/MapServer')
print r.status_code
print'TaxParcel/AssessorsBasemap'
r = requests.get('http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsBasemap/MapServer1')
print r.status_code
print'TaxParcel/AssessorsBasemap1'
Result
==================== RESTART: D:/Avinash Test/probing.py ====================
200
ESRI_Census_USA
200
TaxParcel/AssessorsBasemap
404
TaxParcel/AssessorsBasemap1
>>>
let me know for any issue
This won't necessarily test the health of the services, only if they're up or not. Data issues could cause the service to return a 200 when checking to see if the service itself is accessible, but making any type of request for data, (query or exportMap), will fail. I'd suggest you just run a simple query to see if it returns data and also use built-in modules, (even though requests is far easier to work with), (where 1=1 and returnCountOnly = True). If you do want to query all services, keep in mind that it will submit a bit of load on the Server and, if the data is coming from a geodatabase, the geodatabase as well.
Thanks!
I'll try this.
Best,
Alaa