473,889 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unix performance monitoring script

2 New Member
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 14502
ramudukamudu
16 New Member
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","iosta t" utilities give.
Could you suggest the solution??
regards,
ramudu.
Jan 12 '07 #2
arne
315 Recognized Expert Contributor
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","iosta t" 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 Recognized Expert Expert
In Unix it's du and df for disk usage.
I found this.
Jan 12 '07 #4
ramudukamudu
16 New Member
Thanks flocks,
That's really helpful.
Jan 13 '07 #5
cybervegan
36 New Member
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 New Member
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 Recognized Expert Contributor
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
3611
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 trying to investigate what size implementations can be placed onto Windows 2000 / Windows 2003 as opposed to UNIX but cannot find much data. Any information would be much appreciated. Cheers.
0
1287
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
395
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. Thanks! -Mike
2
3148
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 take, how much memory the application is using, what percentage of cpu capacity the application is using. I assume a good idea would be to use a PermanceCounter (or several). I have read a little about them on the web, but I've not really come...
2
1536
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 installed 1.. From the Start button, click Run. 2.. Enter perfmon in the Open text box and then click OK. 3.. In PerfMon click View Report.
0
838
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 available from a main machine. My code works fine, but I'm reading various requirements......C:/ drives must be shared, registry hives that must be shared....etc. Does anyone know the real minimum requirements? I'd like to do this without...
1
1755
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 wondering if this is something that could be done using JavaScript. This is a server side scripting task and JavaScript seems not to be the appropriate language for it. Any thoughts? Thank you.
7
2558
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 answer some questions like: Which of the following loops is faster? for (i=0; i<10000; i++) for (j=0; j<1000; j++)
0
970
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 crontab and you're off: #*/3 01-03 * * * (~/sqllib/db2profile 2>&1 /dev/null ; cd /mydir ; /mydir/snapshot.sh 2>&1 | mail -s "snapshot" aj) cheers aj
0
9969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11203
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10794
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10896
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9612
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7999
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7151
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5830
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3257
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.