In this example, we report the failure of system file updates (for example, log files).
The FileUpdatesUrgent script might send an alert message like the following:
-------------------------------------------------------------------------------
PIKT ALERT
Mon Oct 20 11:44:18 2003
nantes
URGENT:
FileUpdatesUrgent
Report if various files are not being updated
/var/log/syslog is oudated, is 14967 seconds old
-------------------------------------------------------------------------------
FileUpdatesUrgent makes reference to the =fileages_obj macro, which resolves to the name of the FileAges.obj file. The script follows.
///////////////////////////////////////////////////////////////////////////////
//
// files_system_alarms.cfg
//
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
FileUpdatesUrgent
init
status active
level urgent
task "Report if various files are not being updated"
input file "=fileages_obj"
dat $name 1
dat #maxdays 2
dat #maxsecs 3
rule // if the indicated time threshold is in days only,
// check in FileUpdatesWarning instead
if #maxsecs == 0
next
endif
rule // report missing files other than lock files
if ! -e $name
if $name !~ "\\.lock$"
=outputmail "$name not found!"
endif
next
endif
rule // squelch pikt logfile messages on weekends
if $name =~ "pikt"
&& =weekend
next
endif
rule
set #maxage = #maxdays * =secs_in_day + #maxsecs
set $ll = $command("=ll $name")
=set_lineage($ll)
if #lineage > #maxage
if $name =~ "pikt"
=output_other_mail(MAIL,
'PIKT Alert on $hostname():
Urgent', =piktadmin, "$name is
outdated, is $text(#lineage)
seconds old")
else
output mail "$name is outdated, is $text(#lineage)
seconds old"
endif
endif
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
This is just one program example. You could add rules, or write new scripts, for example to report: if log file entries are outdated, if files are being updated when they shouldn't be, 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.
|