I would like to know RAM usage. I know there are several commands like free, top, but how can i get only the number in MB's like "3172", so i can use it in my webadmin script?
Thanks in advance.
Assuming from the given commands you mean shell commands:
Depending on which value you want you can use something like
free -m | awk '/^-/ {print $4}'
The regex between the two / selects the line you want (here it's the one starting with -), the number after the $ denotes the field you want (here it's the 4th).
free gets its information from the special file /proc/meminfo. I'm not that good at Python, but I guess you can read the "file" line by line and split it on :.