Count open connections for a process – SOLARIS

October 14, 2010 at 4:49 pm Leave a comment

Had an issue in SIT server , where all the connections of the MQManager server got exhausted.

This was because some process was holding the entire available connections and not releasing it.

The following code finds all the process id’s for a particular user and finds the count of all connections opened by each of that processes . This will be logged to a file.

username – the user name for which the process belongs
/folder/data.txt – the file which stores process id’s.
result.txt – results with PID – COUNT generated
AF_INET 127.0.0.1 – denotes the server to which connections are made

#!/bin/bash
ps -eaf -u username -opid > /folder/data.txt
echo > result.txt
while IFS= read -r file
do
[ -f "$file" ] && rm -f "$file"
cnt=$(pfiles $file |egrep 'AF_INET 127.0.0.1' | wc -l)
if [ $cnt -ne "0" ]
then
echo $file $cnt >> result.txt
fi
done < "/folder/data.txt"

This script helped me zero in on the process holding up all the connections

~HTH

Advertisement

Entry filed under: tips and tricks. Tags: , , .

Java , Unix & Spanish Characters Unexpected Error Initializing Deployer: weblogic.management.ManagementException

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


 

October 2010
M T W T F S S
« Sep   Jan »
 123
45678910
11121314151617
18192021222324
25262728293031

Follow

Get every new post delivered to your Inbox.