Hacker News new | ask | show | jobs
by atmosx 4516 days ago
I'm writing a ruby script to gather statistics from a Raspberry Pi. All the projects I've seen so far rely on Perl/Python/PHP scripts which are executing shell commands to extract informations every X minutes.

I wonder, isn't there some sort of API to access in Unix-based systems data like CPU usage, memory usage, etc in a more natural way?

1 comments

Why, yes, there is.

Go run strace on ps or top and see what they call.

I'll save you some time: it turns out to be stat() and open() on things in /proc.