Solved

bash script for cpu, memory, tcp connection

Posted on 2011-03-14
3
747 Views
Last Modified: 2012-06-27
Hi,

I need a bash script that could perform/ check the following on a Linux server,

1. CPU usage with top consuming processes
2. Memory allocation vs Memory available
3. I/O connection
4. TCP connections to apache
5. TCP connectons to Mysql
6. quick health check of mysql db.

would be helpful needed one bash script for above situation.

thanks in advance
0
Comment
Question by:luser9999
3 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 250 total points
ID: 35130569
Top two consuming processes
top -b -n1 | head -10 | tail -2

Memory Usage with top two consuming processes
top -b -n1 | head -10

Memory available vs. memory allocation
free -m

I/O connection
iostat or netstat -anptu

TCP connections to apache
netstat -entd | grep -i http

TCP connection for mysql
netstat -entd | grep -i mysql

If you want to include listening also, do netstat -antd, -entd would do established connections only

0
 
LVL 12

Assisted Solution

by:mccracky
mccracky earned 250 total points
ID: 35130944
If this is an ongoing concern, I'd set up cacti to constantly monitor and graph it.  But, rather than bash, it uses snmp.  See: http://www.cacti.net/
0
 

Author Closing Comment

by:luser9999
ID: 35276374
thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now