Simple System Thermometer (systher)

Karel Kubat, e-tunity

e-tunity

2006

Table of Contents

1: Introduction

1.1: Prerequisites
1.2: Legalese

2: Obtaining and Installing Systher

3: Running Systher

3.1: Stand-Alone Mode
3.2: Daemon Mode
3.3: CGI-BIN Mode

4: Technical Information

4.1: Availability of Unix tools
4.2: Coping with Unix Flavors


1: Introduction

Systher is a small Perl tool that collects system information and presents it as an XML document. The information is collected using standard Unix tools, such as netstat, uptime and lsof.

Systher can be used in many ways:

In order to make the obtained information readable for humans, Systher is equipped with an XSLT processing stylesheet to convert the XML information into HTML. That way, the information can be made visible in a browser.

1.1: Prerequisites

In order to succesfully use Systher, you'll need:

1.2: Legalese

Systher is distributed under the GNU "copyleft" licence, as-is, without assumption of usability, and without guarantee. Which basically means that you can use Systher without restrictions, and you may redistribute it in any form you want, provided that you make sure that the source of Systher remains available to the public and and provided that you make sure that this copyright notice remains intact.

You're even free to modify Systher in any way you like. Though I'd very much like to see your modifications (especially if they are bug fixes!); I'll then incorporate your changes in the next release, stating full credits.

2: Obtaining and Installing Systher

Systher can be obtained from e-tunity's site http://public.e-tunity.com. The distribution comes as an archive systher-X.YY.tar.gz, where X.YY is a version number like 1.00. Alternatively you may find systher-latest.tar.gz.

To install Systher, follow these steps:

3: Running Systher

There are basically three methods of running Systher:

3.1: Stand-Alone Mode

The first method is stand-alone mode. Change-dir to the systher/bin (relative to the path where you installed Systher) and type ./systher.

If all goes well, you should see an XML document onscreen that shows the system state. If not, stop right here, fix the error condition, or contact me (e.g. as mailto:karel@e-tunity.com).

3.2: Daemon Mode

The daemon mode can be run either as a plain XML daemon, which returns just an XML document representing the system status, or as an HTTP daemon that responds to the browser. The HTTP daemon mode can optionally include a reference to an XSLT sheet to render XML as human-readable HTML.

When running Systher as daemon, only one request is served at a time. The daemon is designed in that way; the reason being that querying the state shouldn't add to the load of a system. The daemon mode is a very lightweight way of enabling remote system state querying: not even a webserver is needed.

3.3: CGI-BIN Mode

To run Systher in CGI-BIN mode under supervision of a webserver, follow these steps:

Next, point your browser at http://myserver:6666/ to see the result. Note also that the XML output is now rendered as HTML. That's caused by the fact that sister.cgi, the called script, calls systher with a flag -x and an href to the XSLT sheet xslt/systher-xml2html.xslt.

4: Technical Information

This section describes some concepts of the technical implementation of Systher

4.1: Availability of Unix tools

In order to collect system statistics, Systher needs to run standard Unix tools such as df, netstat. These utilities are searched for in the following order:

When no utility can be found, a fatal error occurs. This will show up as a <failure> element in the generated XML.

4.2: Coping with Unix Flavors

The above mentioned Unix utilities unfortunately report their output in different formats given different Unix flavors. Here's an example.

TCP network connections are reported in the following ways:

In order to cope with such differences, the script systher has a map %helpermap (defined at the top of the script). This map defines per Unix flavor (actually: what uname reports): the command to run, the order of fields, if applicable: the number of initial lines to skip in the helper program output, and if applicable: the lines to take from the helper program output (other lines are then ignored). That way, systher can be easily configured for other Unix flavors than the ones already known in this version.

If you have such tweaks, please don't hesitate to contact me with the specific configuration. That way, Systher becomes more widely usable.