swatch-2.2

Description

Swatch is designed to monitor system activity. Swatch requires a configuration file which contains pattern(s) to look for and action(s) to do when each pattern is found.

Configuration

  • Edit /etc/swatch.conf
    /login/         bell,mail=root
    /failure/       bell,mail=root
    
    1st column Search word for perl
    2nd column echo
    bell
    mail
    3rd column Interval
    SS
    MM:SS
    HH:MM:SS

    Run and Stop

  • Run
    # swatch -c /etc/swatch.conf -t /var/log/messages &
    
  • Stop
    # ps aux
    ...
    root       970  2.3  3.9  2420 1228 pts/0    S    16:41   0:00 swatch
    root       971  0.0  4.0  2420 1232 pts/0    S    16:41   0:00 swatch
    root       972  4.1  4.6  2588 1416 pts/0    S    16:41   0:00 /usr/bin/perl -
    root       974  0.2  1.1  1068  364 pts/0    S    16:41   0:00 /usr/bin/tail -f
    ...
    
    # kill 970
    # kill 971
    # kill 972
    # kill 974
    

    Message sample

    Return-Path: <root>
    Recieved: (from root@localhost)
    by hoge.bt (8.9.3) id MAA12485
    for root; Sun, 20 Feb 2000 12:01:05 +0600
    Date: Sun, 20 Feb 2000 12:01:05 +0600
    From; root <root@hoge.bt>
    Message-Id: <200002200301.MAA12485@hoge.bt>
    To: root@hoge.bt
    Subject: ** ATTENTION **
    Status: RO
    	
    Feb 20 12:01:04 hoge login: ROOT LOGIN ON tty2
    

    Back
    Google
    Web www.grape-info.com