alarms.cfg
The alarms.cfg file is a series of one or more Pikt alarm scripts. Use Pikt scripts for system monitoring, to report and fix problems, to enhance system security, and to handle all sorts of routine system administration tasks.
For example, here is a Pikt script to report system downages, as it might appear in alarms.cfg (or one of its #include files):
///////////////////////////////////////////////////////////////////////////////
//
// PIKT alarms.cfg -- Pikt scripts and alarm definitions
//
///////////////////////////////////////////////////////////////////////////////
...
SystemsDown
init
status =piktstatus
level =piktlevel
task "Report systems down or off the network"
input proc "=piktc -L -H down sick"
dat $host 1
keys $host
#ifdef debug
rule
output $host
#endifdef
rule // initially, assume system is up
set $state = "+"
rule // do the initial poll quickly
if =pingfail($host, 1, 1)
// if the first ping failed, try again with more retries
// and longer timeouts
if =pingfail($host, 3, 5)
set $state = "-"
// always report new downages
if $state ne %state
output mail "$host is down, or off the
network (ping failure)"
#if mission_critical // only for mission-critical systems
// report continuing downages, but just hourly
else
=hourly(output mail "$host is down, or off the
network (ping failure)", )
#endif
fi
next
fi
fi
#ifdef verbose
rule // report when systems come back up after a downage
// if state was "-", is now "+", report change
if #defined(%state) && $state ne %state
output mail "$host is back up"
fi
#endifdef
...
For a more detailed discussion of Pikt scripts, see the Pikt Script Language. Refer to the sample alarms.cfg for many more examples.
| | 1st page | next page |