Aynı sorunu çözdüm ve bu çözümü buldum. Python'da aşağıdaki kodu yazdım (URL'deki "localhost", AGS sunucunuzun adını değiştirir):
# -*- coding: cp1250 -*-
import smtplib, urllib
from email import Encoders
from email.MIMEBase import MIMEBase
from email.MIMEMultipart import MIMEMultipart
from email.Utils import formatdate
from email.MIMEText import MIMEText
from email.MIMEMessage import MIMEMessage
COMMASPACE = ', '
SERVER = "IP adresss of post server"
FROM = "email adress from"
TO = ['1.email adress to','2.email adress to']
SUBJECT = "Some services on ArcGIS Server are down"
ServicesDown = []
CountOfServicesDown=0
TEXT="No problem"
# 1. Service - mapservice1
print "Test of service - mapservice1"
opener = urllib.FancyURLopener({})
f = opener.open("http://"localhost"/arcgis/rest/services/mapservice1/MapServer?wsdl")
code = urllib.urlopen("http://"localhost"/arcgis/rest/services/mapservice1/MapServer?wsdl"?wsdl").getcode()
if code is not 200:
print "code: ", code
print "mapservice1 is down"
ServicesDown.append("mapservice1")
CountOfServicesDown=CountOfServicesDown+1
else:
print "service is OK"
# 2. Service - mapservice2
print "Test of service - mapservice2"
opener = urllib.FancyURLopener({})
f = opener.open("http://"localhost"/arcgis/rest/services/mapservice2/MapServer?wsdl")
code = urllib.urlopen("http://"localhost"/arcgis/rest/services/mapservice2/MapServer?wsdl"?wsdl").getcode()
if code is not 200:
print "code: ", code
print "mapservice1 is down"
ServicesDown.append("mapservice2")
CountOfServicesDown=CountOfServicesDown+1
else:
print "service is OK"
print "\r\n"+"ServicesDown: ",ServicesDown
print "CountOfServicesDown= ",CountOfServicesDown
if CountOfServicesDown > 0:
TEXT = "There are down this services: "+str(ServicesDown[:CountOfServicesDown])
print "TEXT: ", TEXT
# Prepare actual message
message = """\
From: %s
To: %s
Subject: %s
%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, message)
server.quit()
print "\r\n"+"Email was send"
else:
print "\r\n"+"There is no problem on AGS services"