Nummber waiting process using this same resources


Script check process with status waiting for disk resourcess  sort list and present

proc manual show states

 state  %c
                        One of the following characters, indicating process
                        state:

                        R  Running
                        S  Sleeping in an interruptible wait
                        D  Waiting in uninterruptible disk sleep
                        Z  Zombie
                        T  Stopped (on a signal) or (before Linux 2.6.33)
                           trace stopped
                        t  Tracing stop (Linux 2.6.33 onward)
                        W  Paging (only before Linux 2.6.0)
                        X  Dead (from Linux 2.6.0 onward)
                        x  Dead (Linux 2.6.33 to 3.13 only)
                        K  Wakekill (Linux 2.6.33 to 3.13 only)
                        W  Waking (Linux 2.6.33 to 3.13 only)


                        P  Parked (Linux 3.9 to 3.13 only)

we ned find D waiting for Disk

ps aux | awk '$8 ~ /D/  { print $0 }'
lsof -p $(ps aux | awk '$8 ~ /D/ { print $2 }'| \
grep -o -E '[0-9]+' |tr '\n' ',' ) | awk '{print $9}' | \
sort | uniq -c | sort -s -n -k 1,1

effect

waiting-process

We see 98 processes waiting to 14 different resources of  /opt/oracle/data… this all frozen process waiting for this same resources Fibre Channel Adapter this is sign of damage HBA card.

in one line :

lsof -p $(ps aux | awk ‘$8 ~ /D/ { print $2 }’| grep -o -E ‘[0-9]+’ |tr ‘\n’ ‘,’ ) | awk ‘{print $9}’ | sort | uniq -c | sort -s -n -k 1,1

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

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 )

Google+ photo

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

Connecting to %s