Solved

bash script for cpu, memory, tcp connection

Posted on 2011-03-14
3
754 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 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

632 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