#
#   This is example configuration file for sysfence
#
#   - Config file consists of rules.
#   - Each rule has condition part and action part.
#   - Condition is enclosed in block.
#   - Action description follows the condition.
#
#   Here is an example:
#

rule "high load" {
   la1 >= 5.0 and
   {
       { la5 > 3.0 and la5 < 5.0 }
       or
       { la15 > 2.0 and la15 < 5.0 }
   }
} 
run once 'echo "system load is high and still growing" | mail me@email.com'
log

#
#   Notice the 'once' keyword. You may use it right after 'run' or 'log'.
#  It means that run/log action will take place only once after condition
#  becomes true.
#
#   In example above, echo command will be run once when system load exceeds
#  given thresholds, but logging will be performed periodically unless load
#  falls below limits.
#
#   If the load falls (making condition false) and then rises again, the echo
#  command will be invoked as well.
#
#   Log entry will contain rule name (the string right after rule keyword)
#  and current value of all stats checked in condition.
#
#   The values you may check, are:
#
#       la1         - system load during last minute
#       la5         -           -"-           5 minutes
#       la15        -           -"-           15 minutes
#       freemem     - free memory amount
#       usedmem     - used memory (w/o disk cache)
#       freeswap    - free swap space
#       usedswap    - used swap
#       freespace   - free disk (or other fs-device)  space
#       usedspace   - used disk space
#       availspace  - available disk space (free - space reserved for superuser)
#       nproc       - active processes (threads)
#

when "memory low" {
   freemem < 128M
   or
   swapused > 256M
} invoke once 'echo "go buy some memory" | mail me@email.com'
log once
step 60

#
#   The 'step' keyword specifies time interval (in seconds) between rule
#   checks. Default is 10.
#
#   Noticed 'when' and 'invoke'? Yes, you may use differrent keywords:
#
#       if          when        on          rule
#       run         invoke      exec        execute
#       once        onlyonce
#       step        stepping
#
# for load:
#       la1         load1       loadavg1    (same with 5 and 15)
#
# for memory:
#       memfree     freemem     freememory
#       usedmem     memused     usedmemory
#
# for swap:
#       swapfree    freeswap
#       usedswap    swapused
#
# for filesystem:
#       spaceused   usedspace
#       spacefree   freespace
#       spaceavail  availspace  spaceavailable availablespace
#
# for processes:
#       nproc       processes   numproc     procnum
#       run         running
#       stop        stopped     traced
#       sleep       sleeping
#       unint       io          uninterruptible
#       zombie      defunct
#
#   ...and operators:
#
#       =   ==
#       !=  <>
#       >=  =>
#       <=  =<
#
#       and     andalso     &&
#       or      orelse      ||
#
#
#
# To watch active processes, use:

rule "proc watcher" {
    nproc "root", "emes"    > 100
    or
    nproc "emes"            > 80
    or
    nproc "httpd" zombie    > 0
    or
    nproc "mysql", "postgresql" uninterruptible, stopped > 0
}
run 'echo "example rule hit"'


#
#   Good luck!
#
# $Id: example.conf,v 1.9 2004/06/21 16:13:09 emes Exp $
