Monitoring your services with a script

Paul Dodd of ESRI Technical Marketing recently posted a utility on ArcScripts
that monitors your critical services and will e-mail you if a service goes
offline.

The Service Monitor script uses a combination of public-domain/freeware
utilities and a configuration file in which you list the services you want to
be monitored. With minimal effort, you can schedule the Service Monitor to run
using the Windows Scheduler.

You can:

  • Specify the URL for a service WSDL or web site to monitor (even include user
    authentication if needed)
  • Specify a day of the week or time window for maintenance of a service
  • Specify days of the week that you don’t want the service to be monitored
  • Specify e-mail recipients for each service or a group of services

Optionally you can override other script defaults like:

  • Retry limits, retry delay, and send e-mail limits
  • E-mail Subject line and From origin
  • E-mail server
  • Log file location
This entry was posted in Services and tagged , , . Bookmark the permalink.

Leave a Reply

10 Comments

  1. sterlingdq says:

    Some comments from Paul on the e-mail questions:

    I haven’t specifically provided a parameter setting for this, but you could do the following:

    - Alter the ‘set EmailServer= -u -pw ‘

    The above would add the optional Blat ‘-u’ (user) and ‘-pw’ (password) parameters to the call of the Blat.exe e-mail utility. See ‘Blat -h’ for full details and usage.

    Version 1.2 includes an E-mail specific log file that records the e-mail transfer attempts. The default filename for this is ServiceMonitor_Email_Log.txt. Check this file for any details.

  2. sterlingdq says:

    The error from the web page is expected. When the ArcGIS Server Object Manager Service is shut down, it should in turn, kill all ArcGIS Server SOCs, rendering the WSDL end-points inaccessible.You should receive a “404 Not Found” error on the URL.

    If you in fact received a 404 not found message, check the logs and configuration of the ServiceMonitor. Do you have a MaintWindows or MaintTimes setting affecting this?

  3. sterlingdq says:

    Tim- The URL would be http://server01/arcgis/services/RealProperty/MapServer?wsdl

    Entering this in a browser should normally return some XML showing what methods could be called on the map service. If you see that, you know that your service is running.

    -Sterling

  4. ddp_developer says:

    I keep getting an error from blat regarding the sender’s address/name being incorrect. I have tried to modify the set From= setting but it doesn’t seem to help. The error is below. Any ideas what I need to configure?

    2008.01.10 15:13:35 (Thu)————Start of Session—————–
    Blat v2.6.2 w/GSS encryption (build : Feb 25 2007 12:06:19)
    2008.01.10 15:13:38 (Thu): Sending ServiceMonitor.bdy to dbutz@davisdemographics.com
    2008.01.10 15:13:38 (Thu): Subject: Alert: Service Monitor – Service Failure Detected!
    2008.01.10 15:13:38 (Thu): Login name is davidbutz.net@gmail.com
    2008.01.10 15:13:38 (Thu): Attached text file: Log1.txt
    2008.01.10 15:13:38 (Thu): The SMTP server does not like the sender name.
    Have you set your mail address correctly?
    2008.01.10 15:13:38 (Thu)————-End of Session——————

  5. paul2221 says:

    Hi Andrew,

    Looking closely at the issue you described, I see that retrieving a Map image from an ArcGIS Server MapService requires sending a Serialized object to the Service in order to provide the details required to generate the map. Currently, the ServiceMonitor is not capable of doing this without assistance from an external routine.

    So, I recently released an update, ServiceMonitor v1.4, that allows for external User defined routines. If the external routine were to request a map and then receive an empty image, it could set the exit flag to reflect a value greater than zero. The ServiceMonitor can respond to this error exit and report the failure. Keep in mind that this external routine still needs to be created, but this should open the door for a detection method.

    Along with this enhancement, the new ServiceMonitor supports nested If-Else-Endif conditions, parameter value stacks using PUSH and POP functions, a new User’s Guide build with MHTML, and many more features.

    I hope this helps, Paul

  6. ama054000 says:

    I came up with a script that may also help to monitor ArcGIS services. I’d be interested in some feedback.

    MapServerMonitor-0.1:
    http://arcscripts.esri.com/details.asp?dbid=16602

    Thanks,
    Allan Adair

  7. paul2221 says:

    All,

    I want to let everyone know that I posted a recent update to ArcScripts.

    Version 1.5 of the ServiceMonitor now supports Map Service Image verification, REST service support, ArcSDE Instance availability checking, Secured Service support for REST and SOAP services, Locator Service support, and many more updates.

    Paul

  8. dsau461 says:

    I have upgraded from version 1.4 to 1.6.1 and have ArcIMS and ArcGIS Server monitoring working. Am attempting to add ArcSDE monitoring but cannot get it to work. I have added the following line to the services.txt file:

    CallAsService CheckArcSDE –s ecydblcyadpsde –i 5151 –u sde_r –p xxxxxx –a 90

    but get the following result:

    Tue 03/09/2010 11:04:41.31
    ——————————-
    Command syntax: ‘CallAsService CheckArcSDE –s ecydblcyadpsde –i 5151 –u sde_r –p xxxxxx –a 90′

    Usage ERROR: Unknown parameter ‘–s’

    Usage: CheckArcSDE [-s server] [-i instance] [-D database] [-u user] [-p password] [-a alert_percentage] [-k age] [-l]

    server = ArcSDE server Name
    instance = ArcSDE server Instance
    database = ArcSDE database Name
    user = ArcSDE database user Name
    password = ArcSDE database user Password
    alert_percent = Connection limit percentage of MAX Connections allowed
    Alert is triggered once this percentage is reached
    age (in Days) = Kill connections that are at least this old. This will
    not terminate connections made by Direct-Connect
    clients
    -l = Report the existance of Orphaned LOCKS

    * NOTE * ‘-k’ and ‘-l’ options NOT available on Direct-Connect Instance

    * Error: Failed to access Service in ‘services/Services.txt’, URL/CMD: ‘CallAsService CheckArcSDE’

  9. paul2221 says:

    Dsau461,

    Looks like you may have edited your Service Configuration file using an editor that substitutes a specific Font formatted Dash for the ‘-’ character. Here’s the ‘text’ representation of what was entered (taked from this post) this is what the script sees:

    ‘CallAsService CheckArcSDE –s ecydblcyadpsde –i 5151  â€“u sde_r –p xxxxxx
    –a 90′

    The script is looking for a text or UniCode Dash (hex 002d).

    Try saving the Service Configuration file as text formatted, using WordPad or NotePad.

    Paul

  10. valraa says:

    In free time I worked on a Python script that generates a web request to the ArcGIS server REST url and evaluates the response of the service.
    If the answer is negative will be sent an email alert to a specific e-mail address.
    I think it is simple but useful for monitoring individual services of ArcGIS Server.
    I hope that is helpful for someone.

    All info in our blog:
    http://oneteamgis.wordpress.com/2014/03/24/uno-script-python-che-monitora-i-servizi-di-arcgis-server/

    Damiano