In this example, we report group file problems.
The GroupFileProblemsWarning script might send an alert message like the following:
-------------------------------------------------------------------------------
PIKT ALERT
Wed Aug 13 02:19:34 2003
milan
WARNING:
GroupFileProblemsWarning
Report group file problems
the size of /etc/group has changed by >= 20%, was 43 lines,
is now 24 lines
-------------------------------------------------------------------------------
The script follows.
///////////////////////////////////////////////////////////////////////////////
//
// accounts_alarms.cfg
//
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
GroupFileProblemsWarning
init
status active
level warning
task "Report group file problems"
input proc "=sort -t: +2n =group"
seps ":"
=groupdata
rule // system group?
set #sysgrp = #value($gid) < 100
rule // report bogus comment line
if $left($group,1) eq "#"
output mail "Bogus comment line: $inline"
next
endif
rule // non-root gid 0s
if $gid eq "0"
&& $group ne "root"
output mail "Group $group has GID OF 0!"
output syslog "Group $group has GID OF 0!"
endif
rule // no gid
if $gid eq ""
output mail "Group $group has NO GID!"
endif
rule // duplicate gids
if $gid eq @gid
&& ! #sysgrp
output mail "Groups $group and @group have duplicate gids"
endif
end // drastic change in group file size
set #lines = #innum()
if =deviated(lines, 20%)
output mail "the size of =group has changed by >= 20%,
was $text(%lines) lines,
is now $text(#lines)"
endif
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
This is just one program example. You could add rules, or write new scripts, for example to report: illegal group names, non-existent users, malformed lines, 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.
|