Ruby system programs

M

Mohamed Hussain

Hai all,
Hope everybody fine.
But
I am not fine,because I got one assignment from my project head.

The problem is :-

1) To find the Memory usage
2) To find the CPU usage
3) To find the UPTIME Status
4) To find the Hard Disk space(used/available)
5) To find the status of Service running (like MYSQL)

I would like to know,how to write program.
Is there any way to find all the information above mentioned using Ruby?
If yes,Please let me know
Thanks advance
Regards
Hussain
 
M

mockturtle

Mohamed Hussain ha scritto:
Hai all,
Hope everybody fine.
But
I am not fine,because I got one assignment from my project head.

The problem is :-

1) To find the Memory usage
2) To find the CPU usage
3) To find the UPTIME Status
4) To find the Hard Disk space(used/available)
5) To find the status of Service running (like MYSQL)

I would like to know,how to write program.
Is there any way to find all the information above mentioned using Ruby?
If yes,Please let me know

You do not specify the OS you are working with (Windows, Linux, ...).
If you are in Linux,
I guess you can find those informations in some pseudo-files under
the /proc
filesystem (e.g. /proc/loadavg --> http://www.linuxinsight.com/proc_loadavg.html).
If you are working with other OSes, maybe you can call (with popen)
some external
utility which reports those informations and parse its output.
 
B

Brian Candler

There is also http://snmplib.rubyforge.org/

Of course you need to run SNMP agents on the platform(s) you wish to
monitor, but then you can use snmplib to query them.

This may be a good approach if (a) you have lots of remote hosts to
monitor, (b) you have a mixture of different types of hosts, and/or (c)
you're already using SNMP for other purposes.
 
M

M. Edward (Ed) Borasky

Hai all,
Hope everybody fine.
But
I am not fine,because I got one assignment from my project head.

The problem is :-

1) To find the Memory usage
2) To find the CPU usage
3) To find the UPTIME Status
4) To find the Hard Disk space(used/available)
5) To find the status of Service running (like MYSQL)

I would like to know,how to write program.
Is there any way to find all the information above mentioned using Ruby?

Yes, but it is operating-system dependent. For most flavors of Unix,
including Linux, pick up the second edition of the "Swordfish Book",
(System Performance Tuning, 2nd Edition O'Reilly System Administration).
All the command line tools are documented there -- just write Ruby
scripts to run them and parse the output.

Similar tools exist for Windows, but I don't have a book I can recommend.
--
M. Edward (Ed) Borasky
ruby-perspectives.blogspot.com

"A mathematician is a machine for turning coffee into theorems." --
Alfréd Rényi via Paul Erdős
 
M

Mohamed Hussain

Dear Edward,
Do you have System Performance Tuning, 2nd Edition O'Reilly System
Administration book in ebook format? or Where can i find that book?
Regards
Hussain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,049
Members
47,652
Latest member
Campbellamy

Latest Threads

Top