In this example, we report if important system files disappear, or their file sizes shrink to zero.
The SystemFileNotExistEmergency script might send an alert message like the following:
-------------------------------------------------------------------------------
PIKT ALERT
Mon Feb 25 12:06:05 2002
milan
EMERGENCY:
SystemFileNotExistEmergency
Report if system files have disappeared, or been zeroed out
/etc/group not found!
-------------------------------------------------------------------------------
SystemFileNotExistEmergency makes reference to the =files_system_obj macro, which resolves to the name of the FilesSystem.obj file. The script follows.
///////////////////////////////////////////////////////////////////////////////
//
// files_system_alarms.cfg
//
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
SystemFileNotExistEmergency
init
status active
level emergency
task "Report if system files have disappeared, or been zeroed out
input file "=files_system_obj"
filter "=egrep -iv 'pikt'" // check PIKT files elsewhere
dat $name 1
keys $name
rule // every $name (file) has its own #hr value
set #hr = #hour()
rule
if -e $name // file exists
if -z $name // file is zero length
set $state = "0"
if $state ne %state // report initial
// zeroing out
|| #hr < %hr // repeat daily
// if still empty
output mail "$name zero bytes!"
endif
else
set $state = "+"
endif
else // file does not exist
set $state = "-"
if $state ne %state // report initial
// disappearance
|| #hr < %hr // repeat daily
// if still not found
output mail "$name not found!"
endif
endif
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
This is just one program example. You could add rules, or write new scripts, for example to: report system files that you don't want (such as startup files), report changes in modification times or link counts, report outdated files that should be updating regularly, report and possibly also rm core files, 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.
|