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.
In reply to get system info using perl by saurabh.hirani
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |