Swatch


Swatch

Build-Swatch-Config

Install

Tips

Mail_em

Page_em

Ping-Swatch

Pong-Swatch

Silence-Swatch

Swatch.conf.solaris

Swatch.conf.new


Swatch

Swatch is a popular tool used for watching syslog and reacting to strings it sees. I used this Swatch.conf when I lived in a Solaris environment; I use this one currently, along with Mail_em and Page_em, Perl-based wrapper scripts called from swatch.conf. The wrapper scripts rely on the in-house Netops Toolkit.

In addition, I run Ping-Swatch from cron. This script sets a shared memory variable and then logs a particular string to syslog, which swatch.conf is configured to watch for. When swatch sees that string, the relevant config file snippet in swatch.conf invokes Pong-Swatch, which resets that shared memory variable. If Ping-Swatch does not see the shared memory variable change, it attempts to fix the problem by restarting swatch; if that fails, it shrieks via alpha page.

When I want to quiet Swatch, while working on a particular device, for example, I use silence-swatch to edit swatch.conf and restart swatch. I would like to build our swatch.conf file programmatically, and I've written build-swatch-config to do this for APC traps -- it parses the APC Enterprise MIB file, consults some business logic, and produces a swatch.conf. But I haven't figured out how to generalize this yet.

I collect my tips around Swatch; the details are peculiar to my installation and keep track of how I install Swatch.


Prepared by:
Stuart Kendrick

Last modified: 20-March-2011