The servicemon Protocol

This page documents the servicemon network protocol, should you wish to write your own application to talk to servicemon.

The protocol consists of 4 simple commands, which are as follows:

HELLO
It's nice to be polite and networked applications are no exception. Before servicemon will accept any other command, the client must send HELLO. servicemon will then respond to the client with HELLO which confirms that the connection is open and accepted.

SERVICELIST
Naturally SERVICELIST causes servicemon to respond with a list of services. These are comma-seperated, for example:
apcupsd,crond,smb

SERVICESTATUS
This returns to the client the status of each service as given in the response to the SERVICELIST command. This is in the form of a comma-seperated list of integers which relate directly to the SERVICELIST. For example:
0,0,0

In this case, the first 0 corresponds to apcupsd, the second to crond and the third to smb. A service may have one of three status values which are as follows: BYE
This causes servicemon to respond with BYE to confirm the closure of the connection, then to close the connection.

Here's a transcript of a typical servicemon session. <- is used to denote commands sent from the client to the server and -> for responses sent from the server to the client.
<- HELLO
-> HELLO
<- SERVICELIST
-> apcupsd,crond,smb
<- SERVICESTATUS
-> 0,0,0
<- BYE
-> BYE

You can have servicemon output transcripts of sessions by passing --debug. Happy hacking!
linky