Get memory and networking information

Hi,

I need to retrieve following memory information:

  • available memory
  • free memory
  • used memory

and following networking information:

  • sent bytes
  • received amount of bytes

for my system. How/where can I retrieve these data?

pidin info

nicinfo /dev/io-net/enX

OK, to clarify that a bit: I’m looking for a way to get these information within my program directly and not by parsing te output of shell commands.

Look for pidin and nicinfo sources?? :slight_smile:

For 6.4+ you can use the SIOCGIFDATA ioctl for the network stats.

-seanb

Actually, it is quite easy to parse the outputs from a program. Using head, tail etc., you can strip down the output to the numbers you want, then use atoi() function - done.