Operating System - Linux
1761416 Members
2541 Online
108901 Solutions
New Discussion юеВ

monitoring system performance

 
SOLVED
Go to solution
yongye_2
Occasional Advisor

monitoring system performance

Hi,

I want to design a system monitor solution. No biz management tools will be used. Just use UNIX command ps,sar,iostat,top,vmstat,uptime and shell script to archive the goal. But I am not familiar with the shell script. I wonder whether I can get the followed function through shell script,

1) monitor system performance.Like CPU usage, disk I/O usage, Swap usage, Memory usage and so on.
2) Ability to set and monitor predefined threshold.
3) Auto send notification after perdefined threshold are exceeded.
4) Ability check system log and auto send notification when error detected.

Any advice and reference are welcome.

Yongye
10 REPLIES 10
Pedro Cirne
Esteemed Contributor

Re: monitoring system performance

Hi,

Check man of the "sar" command. It's standard on all hp-ux servers and is able to collect and store all information you want.

Enjoy :)

Pedro
Geoff Wild
Honored Contributor

Re: monitoring system performance

You can script your own if you like...

Use commands like uptime, top -d 1, sar swapinfo -tam, etc...

Or download Big Brother:

http://www.bb4.org/

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Ernesto Cappello
Trusted Contributor
Solution

Re: monitoring system performance

Hi Yongye, looks this script:

#!/bin/sh
THRESHHOLD="7[0-9]%"
THRESHHOLD1="8[0-9]%"
THRESHHOLD2="9[0-9]%"
THRESHHOLD3="100%"

# BDF ON SERVER XXXXX#1
echo "#####################" > bdf_on_servers.txt
echo "# BDF ON XXXX#1 #" >> bdf_on_servers.txt
echo "#####################" >> bdf_on_servers.txt
echo "\n" >> bdf_on_servers.txt
echo "Filesystem kbytes used avail %used Mounted on \n" >> bdf_on_servers.txt
bdf -l | grep -e $THRESHHOLD -e $THRESHHOLD1 -e $THRESHHOLD2 -e $THRESHHOLD3 >> bdf_on_servers.txt

# BDF ON SERVER XXXXX#2
echo "#####################" > bdf_on_servers.txt
echo "# BDF ON XXXX#2 #" >> bdf_on_servers.txt
echo "#####################" >> bdf_on_servers.txt
echo "\n" >> bdf_on_servers.txt
echo "Filesystem kbytes used avail %used Mounted on \n" >> bdf_on_servers.txt
remsh XXXXX#2 -n "bdf -l | grep -e $THRESHHOLD -e $THRESHHOLD1 -e $THRESHHOLD2 -e $THRESHHOLD3" >> bdf_on_servers.txt


ux2dos bdf_on_servers.txt | mailx -s "BDF on UNIX SERVERS" yongye@xxx.com


# TOP ON SERVER XXXXX#1
echo "#####################" > top_on_servers.txt
echo "# TOP ON XXXX#1 #" >> top_on_servers.txt
echo "#####################" >> top_on_servers.txt
top >> top_on_servers_tmp.txt
more top_on_servers_tmp.txt | grep Memory >> top_on_servers.txt

ux2dos top_on_servers.txt | mailx -s "TOP on UNIX SERVERS" yongye@xxx.com


Where XXXX#1 are yopur servers.
Regards, Ernesto.
Marvin Strong
Honored Contributor

Re: monitoring system performance

You could create a shell script, more like applicaton. To do what you looking for, but its no small task. And since you have no scripting experience, the first thing you may want to do is get some shell books, or training.



Victor Fridyev
Honored Contributor

Re: monitoring system performance

Hi,

Look at the attached script. I hope it can do most of needed things.
Entities are not to be multiplied beyond necessity - RTFM
yongye_2
Occasional Advisor

Re: monitoring system performance

Hi Fridyev and Ernesto,

Thank you very much for your help. I have already assigned point to you. The sample script really gives me a good start.
But I still wonder whether it is posible to get the function from shell script for auto send notification when threshold or error occured. Would you please give me more informaiton on this? Thanks.

Hi Geoff Wild, For the security and cost reason, either free ware or biz software are not allowed to use on our system.Thanks.

Hi Pedro Cirne and Marvin Strong, also thanks for your help.

Regards,
Yonyge
Borislav Perkov
Respected Contributor

Re: monitoring system performance

Hi,

You could solve your problem by adding monitors request in SAM like for filesystems' usage.

Resource Management>Event Monitoring Service
Actions>Add Monitoring Request...
choose in Resource Class system than filesystem, availMB. Than choose Resorce Instance like root, press OK. After you can set the monitorig parameters and the way how the notification would be sent.

Best Regards,
Borislav
yongye_2
Occasional Advisor

Re: monitoring system performance

Hi Borislav Perkov,

Thanks for your reply. I think you are right. EMS is a good tools to monitor the system status. But many of its function is to monitor the target for up and down status. For performance monitoring it does little. I will consider it as the tools used in the event management.

Thanks again.

Yongye
Victor Fridyev
Honored Contributor

Re: monitoring system performance

Hi Yongye,

AFAIK, the best and the simplest way to receive messages in case of some overloading is using of standard SNMP monitors (OV, CA, BigBrother, BigSister etc). Some of the are free e.g. Big Brother. But if you want to do this by yourself, you can analyze output of commands like sar or swapinfo.

You can see a part of such a script below.

/usr/sbin/sar -d 60 1 > $TMF
TEST=$(cat $TMF | cut -c10-|
awk '/c0t8d0/||/c0t10d0/ {if($2>85)fl=1}
END {if(fl)print "GO"; else print "STOP"}')


HTH
Entities are not to be multiplied beyond necessity - RTFM