Mon is a system and network monitoring system written in Perl. It runs programs to perform tests and other programs to send alerts when the tests fail. It has configuration options for how often to run the tests, when alerts should be run, and which alert scripts should be run for each failure.
To get mon working you need to install the "mon" package. To run the "monshow" program to see the status locally you need to install the "libcgi-pm-perl" (this should be installed on everything but embedded systems). To monitor freespace with the included "freespace.monitor" script you need the "libfilesys-diskspace-perl" package. Many monitor and alert scripts that are less essential are in the "mon-contrib" package, most installations will use some scripts from that package. The monitor "ps.monitor" needs the "libproc-processtable-perl" package to operate so most systems need that too. The "sendxmpp" package can be used to send Jabber alerts, in most cases it will also be part of a Mon installation.
The following apt-get command will install all the necessary packages for a typical mon configuration on Debian/Stretch:
apt-get install mon libcgi-pm-perl libfilesys-diskspace-perl mon-contrib libproc-processtable-perl sendxmpp
The only IM system supported for alerting that has clients and servers in Debian is Jabber. Installing a Jabber server will be part of the installation process for Mon, see the Prosody page in this Wiki for instructions on that.
The command "monshow" gives a status overview.
Document web interface.
The directory "/usr/lib/mon/mon-local.d" is for monitor scripts that perform local tests (EG checking that programs are running with ps.monitor).
The directory "/usr/lib/mon/mon.d" is for monitor scripts that do network tests, pinging, TCP connections, etc. For a default Debian install the difference between the monitor scripts directories doesn't matter much. But when running SE Linux different permissions are given to scripts from those directories, a monitor script that does network tests is not permitted to probe the local filesystem etc.
When a monitor determines that things are OK it will return 0, it might output a textual notification on stdout as well but most monitor scripts don't do that. When it determines that there is a problem it should return a 1 line summary of the error followed by as many lines of detail as is necessary and exit with a non-zero return code.
Most monitor scripts are written in Perl, but any language can be used. Monitor programs always have the extension ".monitor" in the file name although it should work even if you don't follow that naming scheme.
Document how to write setuid tests
The directory "/usr/lib/mon/alert.d" contains the scripts that send alerts about problems. Alert programs always have the extension ".alert" in the file name although it should work even if you don't follow that naming scheme.