In this example, we report dead system processes.
The ProcessSystemDeadUrgent script might send an alert message like the following:
-------------------------------------------------------------------------------
PIKT ALERT
Wed Oct 3 07:08:06 2002
athens2
URGENT:
ProcessSystemDeadUrgent
Report or restart 'dead' crucial system processes
The process 'syslogd' is not running
-------------------------------------------------------------------------------
ProcessSystemDeadUrgent makes reference to the =process_system_obj macro, which resolves to the name of the ProcessesSystem.obj file. The script follows.
///////////////////////////////////////////////////////////////////////////////
//
// process_alarms.cfg
//
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
ProcessSystemDeadUrgent
init
status active
level urgent
task "Report or restart 'dead' crucial system processes"
input file "=process_system_obj"
seps ":"
dat $pr1 [1]
dat $pr2 [2]
dat $cmd [3]
rule
set #norun = #false()
rule
if $pr2 ne ""
set $c = $command("=psall | =egrep '$pr2.+$pr1' |
=grep -v grep")
if $c eq ""
set #norun = #true()
#ifdef debug
=outputproc(mail, "=psall")
output mail "\$pr1 is $pr1"
output mail "\$pr2 is $pr2"
output mail "\$cmd is $cmd"
output mail "\$c is $c"
#endifdef
endif
else
if #pid($pr1) == #nil()
set #norun = #true()
endif
endif
rule
if #norun
if $cmd eq "."
output mail "The process '$pr1' is not running"
else
=execwait $cmd
endif
endif
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
This is just one program example. You could add rules, or write new scripts, for example to: report and possibly kill runaway processes, report unusually high counts of per-user processes, report and possibly kill forbidden processes, report extremely high numbers of zombie and defunct processes, log special process accounting data, etc.
[For more examples, see Samples.]
Home |
FAQ |
News |
Intro |
Samples |
Tutorial |
Reference |
Software |
Authors |
Licensing |
SiteSearch
Links |
SiteIndex |
Pikt-Users |
Pikt-Workers |
Contribute |
ContactUs |
Top of Page
Page best viewed at 1024x768.
Page last updated 2005-06-22.
This site is
PIKT®
powered.
PIKT® is a registered trademark of the University of Chicago.
Copyright © 1998-2005 Robert Osterlund. All rights reserved.
|