vasion
vasion

Reputation: 1247

how do i get system stats in PHP

i am launching a beta version of a web app and i want to log system information about resources. system monitors eat up way too much resources and do a lot more than what i need. What i want to do is get key stats and log them every time a user logs in.

these are the stats i am interested in:

so how do i get outgoing traffic and free memory statistics?

Upvotes: 3

Views: 3063

Answers (4)

Alister Bulman
Alister Bulman

Reputation: 35167

On a Linux/Unix based system, you can read the files in /proc/, such as /proc/meminfo and /proc/net/dev (though for networking, the output of the command 'netstat -i' is a lot easier to parse).

Upvotes: 0

wimvds
wimvds

Reputation: 12850

If you want to see how it's done, have a look at phpSysInfo.

Upvotes: 4

qmega
qmega

Reputation: 1241

As far as network traffic, you might want to look into ntop.

Upvotes: 0

OverLex
OverLex

Reputation: 2521

If you are using a *nix machine you should be able to do:

free -t -m

and it will give you information on free memory in MB.

It is easy to create a simple script that you can schedule in crontab.

Upvotes: 0

Related Questions