PIKT

Samples: System Patches

PIKT Logo
Home FAQ News Intro Samples Tutorial Reference Software Authors Licensing SiteSearch


In this example, we monitor the state of system patches and report if they are not installed.

The PatchesSystemNotExistWarning script might send an alert message like the following example:

-------------------------------------------------------------------------------

                                PIKT ALERT
                         Fri Mar  8 08:40:01 2002
                                 athens2

WARNING:
    PatchesSystemNotExistWarning
        Report the absence of critical system patches

        patch 109320-04 not installed!
        patch 108869-12 not installed!

-------------------------------------------------------------------------------
PatchesSystemNotExistWarning makes reference to the =patches_system_obj macro, which resolves to the name of the PatchesSystem.obj file.  The script follows.

///////////////////////////////////////////////////////////////////////////////
//
// patches_alarms.cfg
//
///////////////////////////////////////////////////////////////////////////////

[other alarms omitted...]

///////////////////////////////////////////////////////////////////////////////

#if solaris

PatchesSystemNotExistWarning

        init
                status active
                level warning
                task "Report the absence of critical system patches"
                input file "=patches_system_obj"
                dat $patch 1
                keys $patch

        rule    // bypass placeholder
                if $patch eq "000000-00"
                        next
                endif

        rule    // every $patch has its own #dn value
                set #dn = #daynumber()

        rule
                set $log = "/var/sadm/patch/$patch/log"

        rule    // initialize state
                set $state = "-"

        rule    // look for evidence of successful patch
                if    -e $log
                   && #val($command("=grep -c 'was successful' $log"))
                        set $state = "+"
                endif

        rule    // report if not found or unsuccessful
                if $state eq "-"
                        if    $state ne %state       // report initial
                           || #dn < %dn              // repeat weekly
                                output mail "patch $patch not installed!"
                        endif
                endif

#endif  // solaris

///////////////////////////////////////////////////////////////////////////////

[other alarms omitted...]

///////////////////////////////////////////////////////////////////////////////

[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.

Computer Books at Amazon.com

Essential CVS
Essential CVS

UNIX System Administration Handbook
UNIX System Administration Handbook

Red Hat Linux Administration: A Beginner's Guide
Red Hat Linux Administration: A Beginner's Guide

SuSE Linux Enterprise Server 9 Administrator's Handbook
SuSE Linux Enterprise Server 9 Administrator's Handbook

Unix Power Tools
Unix Power Tools