Process Count Limits

This per_user_process_counts_objects.cfg example specifies process count limits, which if exceeded, the count may be logged, alert e-mail may be sent, systems administrators may be paged, and/or the indicated processes may be killed.  This objects file might be referenced by a Pikt script such as PerUserProcessCounts.

///////////////////////////////////////////////////////////////////////////////
//
// per_user_process_counts_objects.cfg
//
///////////////////////////////////////////////////////////////////////////////

PerUserProcessCounts

// 0 signifies take no action; 1 signifies always take action

// note:  the process counts are per-user counts, not overall counts; many
// processes, for example sendmail, are root-owned

#setdef deftmp = test
#setdef test = FALSE

#ifndef test

//      process         log             alert           page            kill

        inetd           2               3               4               0

#  if mailserver
#    if moscow
        // root-owned
        sendmail        100             200             300             500
        python          50              100             150             200
        sh              50              100             150             200
        // user-owned
        popper          5               10              20              30
        imapd           3               4               999             5
#    else
        sendmail        50              100             150             200
#    endif
#  else
        sendmail        10              20              40              60
#  endif

#  if webserver
        httpd           10              20              40              80
#  endif

#  if nisserver
        ypserv          2               4               5               0
#  endif

//      crack           1               1               1               1
//      sniffit         1               1               1               1
//      ...

[...]

// wildcard should be last in PerUserProcessCounts list
#  if milan
        \\*             20              60              100             0
#  else
        \\*             20              40              60              0
#  endif

#elsedef  // test

//      process         log             alert           page            kill

#  if moscow
        imapd           1               3               999             0
#  endif
#  if mailserver
        sendmail        1               3               999             0
#  else
        sendmail        1               2               999             0
#  endif
#  if webserver
        httpd           1               3               999             0
#  endif
#  if nisserver
        ypserv          1               3               999             0
#  endif
        crack           1               1               1               1
        sniffit         1               1               1               1
//      ...
// wildcard should be last in PerUserProcessCounts list
        \\*             1               5               999             0

#endifdef  // test

#setdef test = deftmp

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

On the piktmaster system, we would install the PerUserProcessCounts.obj file to each PIKT slave system with the command:

# piktc -iv +O PerUserProcessCounts +H all        [or: ... -H down]

For more examples, see Samples.

 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
Learn about the
script development &
testing process