Maxuproc parameter and number of processes


 
Thread Tools Search this Thread
Operating Systems AIX Maxuproc parameter and number of processes
# 15  
Old 04-09-2019
A Unix-compatible process table is still fixed. Only LWPs are not limited on some OS.
In AIX, according to my link, it is 262144. Not tunable.
Solaris and HP-UX have 30000, tunable.
Linux has 32768, shared with LWPs, tunable.
# 16  
Old 05-21-2019
To monitor the maxuproc, I find the user's id with:
Code:
lsuser -a id user

, then use:
Code:
ps -fu $id | wc -l

to count their processes.

--- Post updated at 02:57 PM ---

If you're interested, here's a section of a script I use to monitor every users' current maxuproc.
Code:
numprocs=$(lsattr -El sys0|grep maxuproc|awk '{print $2}')
let threshprocs=$numprocs-50
lsuser -a id ALL > /tmp/maxuproc.tmp
while read uid unum
do
    kount=`ps -fu $uid|wc -l|awk '{print $1}'`
    if (( kount > threshprocs )) then
      echo " High Process Count for User: " $uid
      echo " Exceeds Threshold Value Set in this SCRIPT: " $threshprocs
      echo " Current Process Count: " $kount
      echo " Max Process Count: "     $numprocs
      echo "                    "
      ps -fu $uid
      errors_found="TRUE"
    fi
done  < /tmp/maxuproc.tmp

# 17  
Old 05-22-2019
And this is a simplified version of my Nagios check script, that checks user's threads (LWPs) and processes.
Does it run on AIX?
Code:
#!/bin/sh
set -f
PATH=/bin:/usr/bin:/usr/sbin:/sbin

limit=${1:-2850}
plimit=${2:-850}

case $limit$plimit in
*[!0-9]*)
  echo "
Usage: $0 [WARN threads] [WARN processes]"
  exit 3
  ;;
esac

check=`ps -e -L -o user= -o pid= | awk '
{++n[$1]}
p[$2]++==0 {++o[$1]}
END {
 for (u in n) {
  if (n[u]>max) max=n[uid=u]
  if (o[u]>pmax) pmax=o[puid=u]
 }
 if (max>'$limit') {print "uid="uid,"max="max}
 else if (pmax>'$plimit') {print "uid="puid,"pmax="pmax}
}
'`
if [ -z "$check" ]
then
  echo "OK: all users below $limit threads"
  exit 0
else
  eval $check
  if [ -n "$max" ]; then
    echo "WARNING: user $uid runs $max threads"
  elif [ -n "$pmax" ]; then
    echo "WARNING: user $uid runs $pmax processes"
  fi
  exit 1
fi

It can only report one user. If two or more users are above thresholds it reports the top user.
# 18  
Old 05-22-2019
Quote:
Originally Posted by MadeInGermany
And this is a simplified version of my Nagios check script, that checks user's threads (LWPs) and processes.
Does it run on AIX?
Code:
#!/bin/sh
set -f
PATH=/bin:/usr/bin:/usr/sbin:/sbin

limit=${1:-2850}
plimit=${2:-850}

case $limit$plimit in
*[!0-9]*)
  echo "
Usage: $0 [WARN threads] [WARN processes]"
  exit 3
  ;;
esac

check=`ps -e -L -o user= -o pid= | awk '
{++n[$1]}
p[$2]++==0 {++o[$1]}
END {
 for (u in n) {
  if (n[u]>max) max=n[uid=u]
  if (o[u]>pmax) pmax=o[puid=u]
 }
 if (max>'$limit') {print "uid="uid,"max="max}
 else if (pmax>'$plimit') {print "uid="puid,"pmax="pmax}
}
'`
if [ -z "$check" ]
then
  echo "OK: all users below $limit threads"
  exit 0
else
  eval $check
  if [ -n "$max" ]; then
    echo "WARNING: user $uid runs $max threads"
  elif [ -n "$pmax" ]; then
    echo "WARNING: user $uid runs $pmax processes"
  fi
  exit 1
fi

It can only report one user. If two or more users are above thresholds it reports the top user.
I don't have an AIX system available to see if your code produces the desired results there, but you might want to consider the following.

Since this code doesn't allow a user to override the default 850 for number of processes unless a first operand is given to specify the number of threads, one might consider changing:
Code:
  echo "
Usage: $0 [WARN threads] [WARN processes]"

to:
Code:
  echo "
Usage: $0 [WARN_threads_count [WARN_processes_count]]" >&2

I added the redirection because this usage statement is a diagnostic that should be written to stderr instead of stdout. I added the underscores and the "count"s so a naive user running your code and seeing your Usage printout would be less likely to think your script was expecting "WARN threads" and "WARN processes" to be literal strings.
This User Gave Thanks to Don Cragun For This Post:
# 19  
Old 05-22-2019
Of course your usage text is better.
The original script is named "check_user_threads.sh" and that's what it did from the beginning. The procs measurement was added later, in a hurry, as Solaris servers with a proc limit (in /etc/system) showed up.
The usage message is sent to stdout on purpose, because stdout *must* go to the Nagios console. Not so with stderr. But maybe it works meanwhile.?
This User Gave Thanks to MadeInGermany For This Post:
# 20  
Old 05-22-2019
Quote:
Originally Posted by MadeInGermany
Of course your usage text is better.
The original script is named "check_user_threads.sh" and that's what it did from the beginning. The procs measurement was added later, in a hurry, as Solaris servers with a proc limit (in /etc/system) showed up.
The usage message is sent to stdout on purpose, because stdout *must* go to the Nagios console. Not so with stderr. But maybe it works meanwhile.?
Hi MadeInGermany,
Thanks for the information. I'm just used to writing utilities that work directly on BSD, Linux, and UNX platforms where we all know what is supposed to happen and users know how to separate diagnostics from normal output. I hate using things like Nagios that think that diagnostic messages should be hidden from users (making it hard or impossible for those users to find out what went wrong when underlying utilities report problems)

Oh, well.

Cheers,
Don
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Increase maxuproc value

Hi Guys, I am running RHEL6 and now my processes reach maximum limit. How do I increase the maxuproc value? Can I increase the value without rebooting the server? Thanks in advance... Please Help!!! (5 Replies)
Discussion started by: Phuti
5 Replies

2. UNIX for Dummies Questions & Answers

Maxuproc and limit

// AIX 6.1 & Power 7 server I have maxuproc set to 16384. lsattr -El sys0 -a maxuproc maxuproc 16384 Maximum number of PROCESSES allowed per user True What is the maximum number of maxuproc we can go for? If I increase maxuproc to the higher number, what would be ramifications? I... (1 Reply)
Discussion started by: Daniel Gate
1 Replies

3. AIX

Maxuproc vs ulimit -u [processes(per user)]

Morning, Somebody can tell me in AIX 6.1 what is the different between the maxuproc (lsattr -El sys0 | grep max) and the for a user. Example: Oracle is limited by : #ulimit -u processes(per user) unlimited But lsattr -El sys0| grep maxuproc show me : maxuproc 16384 So... (1 Reply)
Discussion started by: bacup540
1 Replies

4. AIX

Maximum number of processes kernel parameter

Hi, Is there a maximum number of processes kernel parameter in AIX. Solaris has max_nprocs, HP-UX has nproc, I can only find max user process (maxuproc) for AIX. Thanks, Wilson. (3 Replies)
Discussion started by: wilsonee
3 Replies

5. Shell Programming and Scripting

Check parameter is number or string

Hey I'm new in linux, I'm looking for a code to check whether the parameter is a number or a string. I have already tried this code: eerste=$(echo $1 | grep "^*$">aux) if But it doesn't work.:confused: Thanks (2 Replies)
Discussion started by: Eclecticaa
2 Replies

6. Shell Programming and Scripting

How to Control Number of Processes Running

Hi Is there a way to count how many processes a script has started, count how many of these have finished, and make the script wait if their difference goes over a given threshold? I am using a script to repeatedly execute a code (~100x) which converts 2 data files into one .plt which is in... (4 Replies)
Discussion started by: drbones
4 Replies

7. Shell Programming and Scripting

Dynamic number of parameter

Hi all Is there away to create a script with dynamic number of parameter.. like the kill command in UNIX kill -9 xxx xxx cheers (4 Replies)
Discussion started by: co0oly
4 Replies

8. Programming

How to limit the number of child processes

I need a mechanism to fork child processes and all child processes should connect to a server.but the number of child processes should be limited(for ex:50) Here's my pseudo, but I cant figure out how to limit the child process number. Should I use a semaphore? or what? for(;;)... (3 Replies)
Discussion started by: xyzt
3 Replies

9. UNIX for Dummies Questions & Answers

checking if parameter passed is a number

I have written a function that fills an array and another function where if a parameter is supplied it will jump to that part of the array and cat it to the screen. I need to put in some checks to make sure the parameter supplied is firstly a number and then not a number great than the length of... (2 Replies)
Discussion started by: magnia
2 Replies

10. Solaris

How to find number of processes ?

Hi , I need to count all processes contains the pattren "FND" For Example: I was reteriving the details of all processes related to "FND" by this command $ ps -ef | grep FND but now I just wanna count them . Regards Adel (2 Replies)
Discussion started by: ArabOracle.com
2 Replies
Login or Register to Ask a Question