Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

bash script for cpu, memory, tcp connection

Posted on 2011-03-14
3
Medium Priority
?
756 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 1000 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 1000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses

671 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