Process Resource Monitor

Current Release:
http://www.rfxn.com/downloads/prm-current.tar.gz
http://www.rfxn.com/appdocs/README.prm
http://www.rfxn.com/appdocs/CHANGELOG.prm

Description:
Process Resource Monitor (PRM) is a CPU, Memory, Processes & Run (Elapsed) Time resource monitor for Linux & BSD. The flexibility of PRM is achieved through global scoped resource limits or rule-based per-process / per-user limits. A great deal of control of PRM is maintained through a number of ignore options, ability to configure soft/hard kill triggers, wait/recheck timings and to send kill signals to parent/children process trees. Additionally, the status output is very verbose by default with support for sending log data through syslog.

There is no shortage of usage methods for PRM, especially when leveraging the ignore and kill options with the rule based system. You can easily take control of those run-away aspell/pspell processes eating 80% of memory, errant exim processes threading off 500 processes or prevent scripts executed under apache from running for hours at a time.

Features:
– global resource limits
– per-process/per-user rule based resource limits
– rules only run mode
– alert only run mode
– ignore root processes option
– process list global ignore file
– user based global ignore file
– command based global ignore file
– regex based global and/or per-rule ignore variable
– global scoped resource limits
– per-process or per user rule based resource limits
– set custom kill signals (i.e: SIGHUP)
– parent process kill option to terminate an entire process tree
– kill trigger/wait times allow rechecking usage over a period of time
– kill restart option to execute a custom restart command
– all kill/resource/ignore options can be global or rule defined
– easy to configure percentage of total CPU & MEM limits
– total number of processes limits
– elapsed run time limits

Funding:
Funding for the continued development and research into this and other projects, is solely dependent on public contributions and donations. If this is your first time using this software we ask that you evaluate it and consider a small donation; for those who frequent and are continued users of this and other projects we also ask that you make an occasional small donation to help ensure the future of our public projects.

47 Replies to “Process Resource Monitor”

  1. Hi Ryan,

    PRM currently assumes the logger command is found under “/bin/logger”, but this is not always the case, it would be very helpful if the script used the which command to find the location of the logger command before using it instead. Then it wouldn’t matter where it lived.

    If it doesn’t find the the logger command under the /bin dir then it just writes to the messages log directly which is fine unless your running a multi server setup where syslog is forwarding all messages to a central logging server, because these messages will be missed off from the logs.

      1. In v1.1.2 the “shell command paths now auto discovered” causes prm to try running /bin/$LOGGER where $LOGGER is the result of `which logger` this means if $LOGGER = /usr/bin/logger then it tries to run /bin//usr/bin/logger which won’t exist. I don’t believe the `/bin/` part before $LOGGER is needed (the if statement above checking if the file exists also only checks the $LOGGER path without the `/bin/`).

  2. The system works but I get, when a process is killed:
    prm[25271]: checking proc pid:5066 {user:root cmd:yum-updatesd} ./prm: line 376: [: : integer expression expected

  3. Hi Ryan and All!

    Trying PRM for the first time, but already excited by the possibilities it is supposed to provide. I am trying to limit CPU and RAM consumption per virtual server (account, domain, website, you name it) on my dedicated server and hope PRM can be of use in my situation.

    The last versions descriptions says “- per-process/per-user rule based resource limits”, I would love to see little bit detailed elaboration on how exactly to limit CPU and RAM resources per users, but it would be even more fantastic if PRM would allow limit resources for the whole group of users.

    If it is not possible to limit the user groups, will it be possible in the future releases of PRM?

  4. I love prm so far however it doesn’t seem to kill processes running in mono, is there anything I can tweak to get it to kill the following: (The cpu was at 199.4% and it wasn’t being killed)

    735892 1000 15 0 519m 183m 9.9m S 199.4 0.6 1154:25 mono program.exe

  5. Hi Ryan,

    First of all, thanks for your scripts. Really great work!

    I discovered some problems.
    1) I want to monitor processes named php-cgi and created the file:
    /usr/local/prm/rules/php-cgi.cmd
    But the config file being read in that case was:
    /usr/local/prm/rules/phpcgi.cmd

    I had to change the line (in /usr/local/sbin/prm):
    . $RULES/$include_cmd.cmd
    to:
    . $RULES/$cmd.cmd
    in order to make it work.

    Maybe you can fix a better solution, or give an explanation of $include_cmd and how to name .cmd files with hypen in the command name?

    2) Also when killing of an old version of prm that has hung the prm pid didn’t get updated.

    I had to add the line:
    echo “$$” > $inspath/tmp/prm.pid

    After:
    if [ -f “$inspath/tmp/prm.pid” ]; then
    opid=`cat $inspath/tmp/prm.pid`
    kill -9 $opid >> /dev/null 2>&1
    eout “cleared stale lock file ($DIFF > $LOCK_TIMEOUT) and killed pid $opid.”
    else
    eout “cleared stale lock file ($DIFF > $LOCK_TIMEOUT).”
    fi

    Maybe you can add some comments.

    Thanks

  6. Me again! I’ve realized it is a global limit.

    How can I add a limit to ALL users (so no exception rules will be needed) saying that they can’t use more than X% CPU and Y% Memory each?

  7. Hi there.

    I’ve installed this (PRM) on my servers. However I want to limit users to X% CPU and Y% Memory. I’m slightly confused about the following lines:

    MAX_CPU=”X”
    MAX_MEM=”Y”

    Do they limit the global usage (so all accounts together can’t go over X and Y) or are they for a per user basis? (so individual accounts can’t go over X and Y)

    Does this make sense?

    As soon as I’ve figured out this plugin properly (I’m a bit of a SSH and server newbie) and see whether it fits my needs or not I’ll be very happy to donate 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *