perl script to monitor ubuntu linux computer resources
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
perl script to monitor ubuntu linux computer resources
Hi,
I badly need help. Does anyone know any documentation I can refer to about monitoring the computer resources of an ubuntu linux machine (memory [RAM], hard disk, and cpu utilization). I need to make a perl script that would be able to give me the amount of how much these computer resources were used. pls help.
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043
Rep:
Quote:
Originally Posted by mokona
Hi,
I badly need help. Does anyone know any documentation I can refer to about monitoring the computer resources of an ubuntu linux machine (memory [RAM], hard disk, and cpu utilization). I need to make a perl script that would be able to give me the amount of how much these computer resources were used. pls help.
I would go with a batch script.
For memory use something like
Code:
free -m
for hard disk you can use
Code:
df -h // the -h is for human readable format
for cpu utilization you can use the top command I think there is an snapshot tag so that it won't go into realtime mode. Also for a deeper disk information look into using du it can give you a display of how much each directory is using in terms of space. Here is an example of du
if you run this from / it will give /, /root , /usr , /etc, /tmp, /var, /boot, /sbin, /bin
Code:
du -c -h --max-depth=1
Last edited by jstephens84; 06-22-2009 at 10:12 AM.
for cpu utilization you can use the top command I think there is an snapshot tag so that it won't go into realtime mode. Also for a deeper disk information look into using du it can give you a display of how much each directory is using in terms of space. Here is an example of du
if you run this from / it will give /, /root , /usr , /etc, /tmp, /var, /boot, /sbin, /bin
Code:
du -c -h --max-depth=1
ohh.. soo.. it basically displays it right? uhmm.. I was trying to make a code that would get the computer resources from the linux machine.. then it would give the result to a celphone, then it would display the result on the screen of the celphone. Do you have any idea how to do that?
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043
Rep:
Quote:
Originally Posted by mokona
ohh.. soo.. it basically displays it right? uhmm.. I was trying to make a code that would get the computer resources from the linux machine.. then it would give the result to a celphone, then it would display the result on the screen of the celphone. Do you have any idea how to do that?
So kind of like a sms message to your phone. Hmmm... well you will have to interface with your phoneswitch for that or some outside entity that will send sms messages to your phone. Probablly what you will need to do is take the commands form above put in a script of some sorts then have all the commands output to a respective variable then echo the variables values as the message.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.