# Ruby system programs

**URL:** <https://www.ruby-forum.com/t/ruby-system-programs/148819>\
**Category:** Ruby\
**Created:** [September 17, 2008, 11:24am UTC](https://www.ruby-forum.com/t/ruby-system-programs/148819 "2008-09-17T11:24:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [September 17, 2008, 11:24am UTC](https://www.ruby-forum.com/t/ruby-system-programs/148819/1 "2008-09-17T11:24:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [September 17, 2008, 12:06pm UTC](https://www.ruby-forum.com/t/ruby-system-programs/148819/2 "2008-09-17T12:06:26Z")

</div>

Heya!

On Wed, Sep 17, 2008 at 11:17 AM, Mohamed H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 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)

Try [http://rubyforge.org/projects/sysutils/](http://rubyforge.org/projects/sysutils/)

---

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [September 17, 2008, 12:11pm UTC](https://www.ruby-forum.com/t/ruby-system-programs/148819/3 "2008-09-17T12:11:45Z")

</div>

Mohamed H. ha scritto:

> 1. To find the Hard Disk space(used/available)
> 2. 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](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.

> Thanks advance  
> Regards  
> Hussain

---

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [September 17, 2008, 3:19pm UTC](https://www.ruby-forum.com/t/ruby-system-programs/148819/4 "2008-09-17T15:19:51Z")

</div>

On Wed, 2008-09-17 at 18:17 +0900, Mohamed H. wrote:

> 1. To find the Hard Disk space(used/available)
> 2. 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](http://ruby-perspectives.blogspot.com)

“A mathematician is a machine for turning coffee into theorems.” –  
AlfrÃ©d RÃ©nyi via Paul ErdÅ‘s

---

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [September 17, 2008, 12:43pm UTC](https://www.ruby-forum.com/t/ruby-system-programs/148819/5 "2008-09-17T12:43:42Z")

</div>

There is also [http://snmplib.rubyforge.org/](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.

---

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [September 17, 2008, 3:24pm UTC](https://www.ruby-forum.com/t/ruby-system-programs/148819/6 "2008-09-17T15:24:26Z")

</div>

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  
M. Edward (Ed) Borasky wrote:

> On Wed, 2008-09-17 at 18:17 +0900, Mohamed H. wrote:
> 
> > 1. To find the Hard Disk space(used/available)
> > 2. 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](http://ruby-perspectives.blogspot.com)
> 
> “A mathematician is a machine for turning coffee into theorems.” –  
> AlfrÃ©d RÃ©nyi via Paul ErdÅ‘s

---

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [September 17, 2008, 3:33pm UTC](https://www.ruby-forum.com/t/ruby-system-programs/148819/7 "2008-09-17T15:33:03Z")

</div>

> Do you have System Performance Tuning, 2nd Edition O’Reilly System  
> Administration book in ebook format? or Where can i find that book?

Google is your friend.

> **[System Performance Tuning, 2nd Edition](https://www.oreilly.com/library/view/system-performance-tuning/059600284X/)**
>
> System Performance Tuning answers one of the most fundamental questions you can ask about your computer: How can I get it to do more work without buying more hardware? In … - Selection from System Performance Tuning, 2nd Edition \[Book\]

PDF is $31.99
