PIKT

Samples: High Load Averages

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


In this example, we report perilously high load averages.

The LoadAverageEmergency script might send an alert message like the following:

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

                                PIKT ALERT
                         Tue Feb 26 16:54:09 2002
                                 murmansk

EMERGENCY:
    LoadAverageEmergency
        Report perilously high system load averages

        4:54pm  up 13 min,  0 users,  load average: 131.92, 99.22, 50.60

        USER     PID %CPU %MEM   VSZ  RSS TTY  STAT START  TIME COMMAND
        root       1  1.4  0.0  1020  460 ?    S    16:40  0:11 init [2]
        ...
        www-data 269  1.9  0.6  8548 6140 ?    R    16:41  0:14 /usr/sbin/apache
        mysql    271  0.0  0.8 33764 8608 ?    S    16:41  0:00 /usr/sbin/mysqld
        ...

-------------------------------------------------------------------------------
The script follows.

///////////////////////////////////////////////////////////////////////////////
//
// process_alarms.cfg
//
///////////////////////////////////////////////////////////////////////////////

[other alarms omitted...]

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

LoadAverageEmergency

        init
                status active
                level emergency
                task "Report perilously high system load averages"
                input proc "=uptime"
                dat $a1 $-2
                dat $a5 $-1
                dat $a15 $

        rule
                set #la1 = #value($chop($a1,1))

        rule
#if perf | mus | warsaw | moscow
                if    #la1 > 15.0
#else
                if    #la1 > 10.0
#endif
                        output mail $trim($inline)
                        =toptop(20)
                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.

Computer Books at Amazon.com

Essential CVS
Essential CVS

UNIX System Administration Handbook
UNIX System Administration Handbook

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

Red Hat Linux Bible: Fedora and Enterprise Edition
Red Hat Linux Bible: Fedora and Enterprise Edition

From Bash to Z Shell: Conquering the Command Line
From Bash to Z Shell: Conquering the Command Line