A simple but complete config file for Wily follows. Both WilyMail and the servlet use the same config file format.
<wily>
<mailConfig>
<smtp>tigger.seis.sc.edu</smtp>
<from>wily@test.edu</from>
<minutesToWait>15</minutesToWait>
<wilyURL>http://piglet.seis.sc.edu:8080/wily/Check<wilyUrl>
</mailConfig>
<connections>
<connection>
<description>IRIS DMC</description>
<url>http://www.iris.edu</url>
<type>http</type>
<lastStatus>SUCCESSFUL</lastStatus>
</connection>
<connection>
<description>IRIS nameserver</description>
<url>corbaloc:iiop:dmc.iris.washington.edu:6371/NameService</url>
<type>nameserver</type>
<lastStatus>SUCCESSFUL</lastStatus>
<recipient>wily@test.edu</recipient>
</connection>
<connection>
<description>IRIS EventDC</description>
<type>EventDC</type>
<dns>edu/iris/dmc</dns>
<serverName>IRIS_EventDC</serverName>
<lastStatus>SUCCESSFUL</lastStatus>
<recipient>wily@test.edu</recipient>
</connection>
</connections>
</wily>
The servlet uses the config file unpacked from wily.war by Tomcat. This should appear in wily/WEB-INF/classes in your webapps directory when Tomcat detects the war file in its webapps directory. The servlet reads this config file every time the tests are reinitialized. So if you want to add a server, add a connection element for it in this config file and reinitialize the tests by clicking on the "Reinitialize Tests" link on the main Wily page.
wily.sh sets the config file used with the $CONFIG variable. When it runs, it writes an updated XML file to the location specified by $UPDATED_CONFIG. This file contains the same connections and mailConfig as the config file it was run with, except the lastStatus values reflect the results of the last run. If it finds the $UPDATED_CONFIG file it uses the lastStatus values in it. Otherwise it uses the lastStatus values in the $CONFIG config file.
WilyMail and the servlet query every connection in their config file, so to add a new server, add a new connection element in the connections element.
<connection>
<description>IRIS NetworkDC</description>
<type>NetworkDC</type>
<dns>edu/iris/dmc</dns>
<serverName>IRIS_NetworkDC</serverName>
<lastStatus>SUCCESSFUL</lastStatus>
<recipient>wily@test.edu</recipient>
<recipient>nosy@seis.sc.edu</recipient>
</connection>
The above element specifies a connection to the IRIS NetworkDC. WilyMail and the servlet will query this server if this element is added to the sample config file in the connections element. If the status changes from SUCCESSFUL on the next run of WilyMail, an email will be sent to wily@test.edu and nosy@seis.sc.edu.
A connection element consists of the elements description, lastStatus, zero or more recipients and type. Depending on the value of type it has either a url or serverName and dns elements.
The value in the description element is displayed in the Connection Description column in the table on Wily's main page, and identifies the servers in WilyMail's emails.
WilyMail uses the lastStatus element to store the results of the previous query. The value can be SUCCESSFUL, FAILED or TRYING. As eternal optimists, we've set the lastStatus to be SUCCESSFUL on all of the servers in the config file that comes with Wily. When WilyMail runs for the first time, it uses the values in the config file passed into it to see if there have been any changes with the current values. It writes out a copy of this config file to the location specified in wily.sh with updated lastStatus values. It uses this copy in subsequent runs to get the previous status values for servers.
Each connection can have multiple recipient elements. When WilyMail runs, if the status it gets for a query is different than the one in lastStatus it sends an email to every recipient. The sample configuration above sends mail to wily@test.edu if the IRIS event data center or the IRIS nameserver goes down, but doesn't send anything if only the IRIS webserver goes down.
The type element is used to specify what type of server Wily is querying. The types Wily knows about are http, nameserver, EventDC, NetworkDC, and SeismogramDC. For the http and nameserver types, the connection element must also contain a URL element. For the DC types the type must contain serverName and dns elements.
The url element is used by the nameserver and http types to specify the location to query. So, to query Google the type should be http and http://www.google.com should be put in the url element. For the IRIS nameserver, the type is nameserver and corbaloc:iiop:dmc.iris.washington.edu:6371/NameService should be in the url element like in the sample config above.
WilyMail is configured by the same xml file that configures the servlet. This XML file has an element called mailConfig that contains all of the configuration options for mailing. The box below contains the mailConfig element for USC's wily setup.
<mailConfig>
<smtp>tigger.seis.sc.edu</smtp>
<from>wily@test.edu</from>
<minutesToWait>15<minutesToWait>
<wilyURL>http://piglet.seis.sc.edu:8080/wily/Check<wilyUrl>
</mailConfig>
WilyMail waits for this number of minutes before seeing if a server has changed status. The default is 15 minutes like this:
<minutesToWait>15<minutesToWait>
With this config, after the 15 minutes WilyMail checks if the results from the query are different than the ones from the previous queries. If they are an email is sent. To test WilyMail you can set this to a much lower value like .01. This will tell WilyMail to wait one hundreth of a minute, or .6 seconds, for results from its queries. Unless some of the DHI servers increase in performance, they'll still be TRYING after .6 seconds so there will be a status change from the default value of SUCCESSFUL and WilyMail will fire off an email to any recipients on the servers that are still trying.