monitors:messaging.sh

messaging.sh

Author Stuart Carmichael
Compatibility Xymon 4.2
Requirements Linux, unix
Download messaging.sh.gz
Last Update 2009-12-16

I want a way to message the sysadmin of my server. The message might be a status message from a backup (success/fail), or any sort of automated job. It could be a reminder to myself (“don't forget to bring home bread”).

The way I have implemented this is as separate text files in a messaging directory. When an automated job/application/user creates a text file in the $MESSAGEDIR, Xymon will display the status under the “messaging” column. There may be any number of messages in the messaging directory (the highest priority message will be the status of the entire group for this host). A keyword 'red', 'yellow' or 'green' determines the priority of the message.

This script continually monitors the $MESSAGEDIR, and will remove message details from Xymon once the message files themselves have been dealt with (for example: automatically via a cron job; manually deleted/edited once the issue has been dealt with).

If no messages appear in $MESSAGEDIR, the status for this host is “clear”.

Example: To create the “Backup” message above the following command would be used on the client:

echo "green Backup completed at `date` > /usr/local/xymon/messages/Backup

This is a client side script. The following must be completed on all Xymon client which you want to send messages to the server.

Client side

1. Download the script (see download link, above), copy into the Client's ext directory and unzip. Ensure script is executable by the xymon user.

2. Update the client's etc/clientlaunch.cfg to include the following:

[messaging]
        ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg
        CMD $HOBBITCLIENTHOME/ext/messaging.sh
        LOGFILE $HOBBITCLIENTHOME/logs/messaging.log
        INTERVAL 5m

3. (optional) review the messaging.sh script, and change the location of $MESSAGEDIR to somewhere more appropriate to your server (default is /usr/local/xymon/messages

4.Create the $MESSAGEDIR directory. Ensure the xymon user can read files in this directory

Script will create “messaging” alerts of the appropriate severity level when text files are created in the $MESSAGEDIR directory. The first word on the first line of each text message file defines the severity level. Severity levels can be one of: green, yellow, red. Any other severity level is assumed to mean 'red'. The remaining text in the messaging file is displayted as additional information in the messaging window.

Server side

No actions required

See download link, above.

  • 2009-12-16
    • Initial release
  • monitors/messaging.sh.txt
  • Last modified: 2009/12/17 19:30
  • by 127.0.0.1