Unix Monitoring Commands

Use this commands from Java Telnet Application and monitor any number of servers.

CPU Usage *****
>top -b -n 1 | grep java | awk ‘{sum +=$9}; END {print sum}’

Memory Usage *****
>top -b -n 1 | grep java | awk ‘{sum +=$10}; END {print sum}’

Gives total wait threads *****
>netstat -anp | grep TIME_WAIT | wc -l

Provides all states of connections change port number as required.
>netstat -an|grep “:80″|awk ‘/tcp/ {print $6}’|sort| uniq -c

===Established connections *****
>netstat -anp | grep ESTABLISHED | wc -l

===Database connections *****
>netstat -anp | grep 1521 | wc -l

=== Get diskspace utilization for given folder *****
>df | grep local | tail -1 | rev | cut -f2 -d’ ‘|rev
>df | grep apps | tail -1 | rev | cut -f2 -d’ ‘|rev

================ Check given web service is working or not ====================

curl –header ‘content-type: text/xml’ –data @test_request.xml -X POST http://server:1234/XYZWebService

Advertisements

One thought on “Unix Monitoring Commands

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 )

Google+ photo

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

Connecting to %s