The ServerStatsEmail command provides one way to monitor the "health" of your server. For example, if you stop receiving these emails, then you know that there is trouble with the server because it is no longer sending the report out. The values obtained in the report can also be useful in indicating upcoming problems (such as excessive heap space allocation).
A second way to monitor the health of your server installation is with a Hackystat utility called PingMail, available via the sensorshell.jar binary. It takes three arguments: a hackystat host (such as "http://hackystat.ics.hawaii.edu"), an email address (such as "johnson@hawaii.edu"), and a mail server (such as "mail.hawaii.edu"). When invoked, PingMail attempts to ping the specified hackystat host, and then sends the results of the ping to the specified user via the specified mail server.
PingMail is complementary to the ServerStatsEmail program, and provides a different kind of health check. Because the PingMail program can be located on a machine separate from the server itself, you can use it to detect problems with the network that might not be observable with ServerStatsEmail. For example, if a network administrator changes the firewall configuration such that the port used by your Hackystat server is closed, PingMail will detect this change.
The PingMail program is also useful for detecting SOAP transmission problems resulting from unexpected restarts of the server. Recall that whenever a Hackystat server is restarted, you must manually invoke 'ant -q hackyCore_Build.deploySoap' in order to re-enable the SOAP services required for successful sensor data transmission to the server. The PingMail program will send an email indicating failure if SOAP services are not running correctly, and thus will help you detect when a Hackystat server was restarted without the invocation of the deploySoap target.
Here is an example invocation of the PingMail program:
C:\svn\hackyCore_Build\build\war\download>java -cp sensorshell.jar org.hackystat.core.kernel.util.PingMail http://localhost:8080/ mail.lava.net johnson@hawaii.edu Contacting hackystat server at: http://localhost:8080/ Emailing results to johnson@hawaii.edu Using mail server mail.lava.net Pinging hackystat host http://localhost:8080/ result: success
As you can see, you must invoke java, indicate sensorshell.jar as the binary, then indicate the fully qualified class name of the PingMail program along with its three arguments. In this case, the output indicates that the Hackystat server was successfully pinged, indicating that it was alive and able to receive sensor data.
The output also indicates that an email was sent to johnson@hawaii.edu. Figure 9.13, “ The PingMail email message ” illustrates the email that was sent as a result of this invocation.
Administrators wishing to use the PingMail program to monitor their Hackystat installation will normally want to set up a cron job (or, in Windows, a "scheduled task") to invoke the PingMail program with appropriate arguments at regular intervals (such as once per day). Then, if the system running the Hackystat server crashes, the administrator will receive an email within a day indicating that the Ping failed. Note that when the server is down, sensor data is not lost; it is cached on the client's machine.