Hey all,

I am writing a daemon in perl which will check for load average, free disk space on a particular partition and free memory and send it as an updation query to another daemon.

I am supposed to check for these params at least twice in a minute. I was looking at perl modules which would give me this info - but after looking under their hood - most of them fire system command to launch a shell. Some of them do it via /proc which I would rather do myself. My queries are

1. What is faster - reading /proc/loadavg or uptime? I would say /proc/loadavg.

2. Are there any perl modules which are using XS to get these queries done faster without opening a shell?

3. Load average I can get through /proc/loadavg, free memory through /proc/meminfo. But how to obtain free disk space through proc? I am talking about 2.6.x kernels on RHEL4. I want to use /proc as much as I can because I would be reading from a file and not launching a shell.

Are there any other suggestions that you guys think would be useful in writing such daemons which do frequent updates? Thanks for going through my post.


regards,
Saurabh.

In reply to get system info using perl by saurabh.hirani

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.