[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

proposal: xml status output

From: Jan-Henrik Haukeland
Subject: proposal: xml status output
Date: Fri, 07 Nov 2003 04:07:30 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux)

In light of the recent discussion I propose another task for our TODO
list; the monit daemon
should print status in XML format.

When monit from the console now ask a monit daemon for service status
it gets back "unformated" plain text. The setup is illustrate below:

      request service status from monit a daemon over HTTP
     |                                                    |
     |                                                    V

 monit status                                      monit daemon

     ^                                                    |
     |   Status is sent back to the client as ascii text  |
         receive status from the monit daemon over HTTP

A must better design would be if the monit daemon sent back text
formated with XML. This opens up for other applications to easier
query a monit daemon for status because it will be easier to parse.

Now the status output looks something like this

hauk:[~]monit status
The monit daemon uptime: 28h 12m 
Device 'disk1' is accessible
        Space: 27.8% [6841.6 MB] Inodes: 8.7% [277643 objects]
        UID: 0 GID: 0 Permission: 755
        Monitoring status: monitored
Host ''
        Port 21 is not available
        Monitoring status: monitored
Process 'apache' is running with pid [2367]
        Uptime: 0m  CPU: 0.0% Memory w/o children: 0.0% [0kB]
        Children: 0 Memory w/ children: 0.0% [0kB]
        Monitoring status: monitored
File 'httpd.bin' exist
        Size: 2187487B UID: 0 GID: 0 Permission: 755
        Monitoring status: monitored
File 'httpd.conf' exist
        Size: 36156B UID: 501 GID: 501 Permission: 644
        Monitoring status: monitored

If status was sent back as XML the monit client could parse and print
it out like above or in another way, but the important thing is that
other applications, e.g. m/monit (or a plugin for Nagios) can read,
parse and present the status output much easier.

The XML output sent from the monit daemon could look something like
this. (The exact format must be discussed and we should *not* need to
define a DTD):

<Monit uptime="28h 12m">

    <Service type=process>

    <Service type=host>


It would be great if someone (Martin/Christian?) could use time to
define the actual XML output format.

Christian Hopp <address@hidden> writes:

> Do you have a tight xml lib in mind or should we parse it
> ourselves... shan't be a big deal.

I simply suggest that we parse it ourself. Either by hand or
preferably by using bison and a lexer[1], unless we can find a small
GPL'ed *reentrant* xml parser (libxml is probably out of the question,
it's to big.)

Would you like to give it a stab Christian? If not, I can do it after
I'm done with the 1. version of m/monit (in X weeks).

[1] NOTE: The parser/lexer will need to be *reentrant* [2] and flex is
not reentrant last time I checked, bison can be made to be reentrant.
One option is to hand-code the lexer but use bison as the parser.

[2] Well since we only use one httpd thread in monit, strictly
speaking, the parser and lexer does not need to be reentrant (meaning
that flex could be used), but it is nice to do it properly :)

Jan-Henrik Haukeland

reply via email to

[Prev in Thread] Current Thread [Next in Thread]