473,434 Members | 1,430 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,434 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 14484
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.