Load mittels PHP auslesen

Bash, Shell, PHP, Python, Perl, CGI
evilh
Posts: 126
Joined: 2004-03-25 17:45

Load mittels PHP auslesen

Post by evilh » 2005-02-16 22:50

gibt es möglichkeiten, den aktuellen serverload per PHP abzufragen ?

wenn ja wie ?

vielen dank !

User avatar
Joe User
Project Manager
Project Manager
Posts: 11602
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Load mittels PHP auslesen

Post by Joe User » 2005-02-16 22:57

Auswerten musst Du es selbst:

Code: Select all

cat /proc/loadavg
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

bierhasser
Posts: 19
Joined: 2003-05-09 06:23

Re: Load mittels PHP auslesen

Post by bierhasser » 2005-02-16 23:02

Code: Select all

$ServerLoad = @exec('/usr/bin/uptime 2>&1');
if (preg_match("#: ([d.,]+),s+([d.,]+),s+([d.,]+)$#", $ServerLoad, $regs)) {
$OUT = '<b>Server Load: </b>'.$regs[1] . ' : ' . $regs[2] . ' : ' . $regs[3];
echo $OUT;
}

evilh
Posts: 126
Joined: 2004-03-25 17:45

Re: Load mittels PHP auslesen

Post by evilh » 2005-02-17 10:37

super ! vielen dank !