LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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

Reply
 
Search this Thread
Old 06-22-2009, 11:05 AM   #1
mokona
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Rep: Reputation: 0
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.
 
Old 06-22-2009, 11:10 AM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
Quote:
Originally Posted by mokona View Post
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 11:12 AM.
 
Old 06-22-2009, 11:46 AM   #3
mokona
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jstephens84 View Post
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
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?
 
Old 06-22-2009, 11:50 AM   #4
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
Quote:
Originally Posted by mokona View Post
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.
 
Old 06-22-2009, 11:53 AM   #5
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
found this for you. It looks pretty promosing and has a way to send messages from bash to a sms and curl.

**edit

oops would help if I included the link.
http://aql.com/site/sms-bashscript.php
 
Old 06-22-2009, 12:20 PM   #6
mokona
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jstephens84 View Post
found this for you. It looks pretty promosing and has a way to send messages from bash to a sms and curl.

**edit

oops would help if I included the link.
http://aql.com/site/sms-bashscript.php
alright.. i'll try it. thanks for the help!
 
Old 06-22-2009, 12:26 PM   #7
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
no problem. post back if it works or don't work and try and include your script if we need to work on things more.
 
Old 06-22-2009, 06:52 PM   #8
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
For collecting Linux stats: http://search.cpan.org/~bloonix/Sys-...stics/Linux.pm
 
  


Reply

Tags
computer, linux, resources


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to monitor a running script initiated from remote computer babag Programming 3 04-07-2008 04:11 PM
LXer: Perl script to monitor disk space and send an email alert LXer Syndicated Linux News 1 02-23-2007 02:12 PM
perl/bash script to monitor all processes running in my machine pudhiyavan Linux - Security 4 07-19-2005 03:09 PM
Programs Fighting For Computer Resources rsarson Fedora 0 01-30-2005 01:54 PM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 11:22 AM


All times are GMT -5. The time now is 03:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration