473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

unix performance monitoring script

hey,
i am in bit prob..can u help me to write a script in unix (can use perl also) to monitor
1.disk usage
2.cpu usage
3.memory usage

in every 10 seconds(for example)..
it should display the three usage result in screen in every 10 seconds.
it will be better if there is an option for user to set the monitoring time also..
pls help guys...
Jan 12 '07 #1
7 14483
Hi, I am also facing similar problem. I need to monitor the memory usage, idle %CPU percentage while my application is running. right now I am using "top" utility. But it is difficult to extact required information from "top". "top" is generating the O/P continuously. I want one shot answer as "vmstat","iostat" utilities give.
Could you suggest the solution??
regards,
ramudu.
Jan 12 '07 #2
arne
315 Expert 100+
Hi, I am also facing similar problem. I need to monitor the memory usage, idle %CPU percentage while my application is running. right now I am using "top" utility. But it is difficult to extact required information from "top". "top" is generating the O/P continuously. I want one shot answer as "vmstat","iostat" utilities give.
Could you suggest the solution??
regards,
ramudu.
For Linux, consider using the information provided under /proc:

/proc/diskstat
/proc/cpustat
/proc/meminfo

This is where many monitoring tools under Linux get their info from.
For specific processes look under /proc/<PID>/

Can't say anything about UNIX, though ...

Hope that helps.
Jan 12 '07 #3
drhowarddrfine
7,435 Expert 4TB
In Unix it's du and df for disk usage.
I found this.
Jan 12 '07 #4
Thanks flocks,
That's really helpful.
Jan 13 '07 #5
You could always make a crontab job to dump the values, but you'd probably get less of a performance hit by writing a short perl or shell script to do it, and then "daemonize" it.

I use Python the most, so that's what I'll use to prototype:

import time
cpuidle = 0 # adjust to the word index of the stat you want, counting from 0
# when you do "cat /proc/cpustat"
diskfree = 0 # adjust as per cpuidle
memfree = 9 # adjust as per cpuidle (this one is probably right)
logfile = open("/var/log/perflog","w")
while True:
logfile.write("CPU: %s DISK: %s MEM: %s\n" % (
file("/proc/cpustat").read().split(" ")[cpuidle],
file("/proc/diskstat").read().split(" ")[diskfree],
file("/proc/meminfo").read().split(" ")[memfree]))
logfile.flush()
time.sleep(10)

You could probably convert this to perl quite easily...

reagards,
-cybervegan
Jan 16 '07 #6
nano2
41
You could always make a crontab job to dump the values, but you'd probably get less of a performance hit by writing a short perl or shell script to do it, and then "daemonize" it.

I use Python the most, so that's what I'll use to prototype:

import time
cpuidle = 0 # adjust to the word index of the stat you want, counting from 0
# when you do "cat /proc/cpustat"
diskfree = 0 # adjust as per cpuidle
memfree = 9 # adjust as per cpuidle (this one is probably right)
logfile = open("/var/log/perflog","w")
while True:
logfile.write("CPU: %s DISK: %s MEM: %s\n" % (
file("/proc/cpustat").read().split(" ")[cpuidle],
file("/proc/diskstat").read().split(" ")[diskfree],
file("/proc/meminfo").read().split(" ")[memfree]))
logfile.flush()
time.sleep(10)

You could probably convert this to perl quite easily...

reagards,
-cybervegan
Will this work for hp and solaris ???
Jun 22 '07 #7
ghostdog74
511 Expert 256MB
hey,
i am in bit prob..can u help me to write a script in unix (can use perl also) to monitor
1.disk usage
2.cpu usage
3.memory usage

in every 10 seconds(for example)..
it should display the three usage result in screen in every 10 seconds.
it will be better if there is an option for user to set the monitoring time also..
pls help guys...
have you tried to code anything yet? read up anything on shell scripting before this?
Jun 22 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Rob | last post by:
Does anyone know if there are any good comparisons between Windows and Unix performance? Or does anyone have examples of Oracle databases running large numbers (200+) of concurrent users. I am...
0
by: Leo | last post by:
What tool exist in vb.net to do performance monitoring of a web site, like conters, logs and how to use them. Many thanks. Leo
1
by: Michael Riggio | last post by:
Hi, Does anyone know if there are any free performance monitoring tools similar to Intel VTune. I need to be able to see how long I spend in certain methods and how expensive some statements are....
2
by: Peter Kirk | last post by:
Hi I would like some general pointers about monitoring some performance parameters of an application we have written. For example: how many threads it has currently running, how long the threads...
2
by: Jimmy | last post by:
Hi all I have tried this to enable asp.net performance monitoring but in step 3 I do not see the 'View Report'...? To view the available ASP.NET counters on a Windows XP computer with IIS...
0
by: Sam Marrocco | last post by:
What are the exact requirements for remote performance monitoring from one XP workstation to another XP workstation? I'd like to keep a vb.net-based display of the CPU monitors of several machines...
1
by: nanosuna | last post by:
Hi, I was given a task to translate a unix bourne shell script that does file renaming and string replacement on a server . I am not too familiar with the capabilites of JavaScript, so I was...
7
by: developer28 | last post by:
Hi, I am looking for some performance monitoring tools and was suggested to ask you for the same. Can anyone please provide some help on the same? What i basically want is a tool that can...
0
by: aj | last post by:
I wrote the following little *nix monitoring script when I needed to know more about a nocturnal critter that was grabbing too much CPU.. Perhaps you can use it. Just put something like this in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.