Hallo
Als erstes wenn das nicht hierher gehört bitte verschieben!!
Also kann man eine datei schreiben, die die CPU und RAM Auslastung ausliest
und dann auf einer Homepage anzeigt??
Wenn ja würde das einer für meine Comuunity schreiben, oder gibt es schon so ein script??
Wäre sehr dankbar!!!
MFG Leppii
CPU und RAM
-
- Project Manager
- Posts: 11182
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: CPU und RAM
Bis die nötigen Daten verarbeitet und zur Präsentation auf der Website aufbereitet sind, vergehen dermassen viele Taktzyklen, dass man nichtmal auf eine Genauigkeit von einem Promille kommen kann. Willst Du ernsthaft dermassen ungenaue Werte als Aussagekräftig bezeichnen? Ich nicht...
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings 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.
Wings for Life ● Wings 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.
-
- Posts: 2223
- Joined: 2002-07-28 13:02
- Location: Berlin
Re: CPU und RAM
... und wenn es eh schon hapert, kann es sein, daß dann gar nix mehr geht.
-
- Anbieter
- Posts: 232
- Joined: 2005-07-14 14:13
Re: CPU und RAM
Der Vollständigkeitshalber
musst halt die tabelle noch anpassen
musst halt die tabelle noch anpassen
Code: Select all
<?php
exec("cat /proc/meminfo",$array);
for($i=0; $i < count($array); $i++)
{
if(!strstr($array[$i],"flags")) $speicherinfo .= $array[$i]."n";
}
$array = "";
$time = exec("date");
list($system, $host, $kernel) = split(" ", exec("uname -a"), 5);
$uptime = exec("uptime");
exec("cat /proc/cpuinfo",$array);
for($i=0; $i < count($array); $i++)
{
if(!strstr($array[$i],"flags")) $prozessor .= $array[$i]."n";
}
$array = "";
exec ("df -h", $array);
for($i=0; $i < count($array); $i++) $plattenspace .= $array[$i]."n";
$time = exec("date");
exec("zgrep CONFIG_HZ /proc/config.gz",$array_HZ);
for($i=0; $i < count($array_HZ); $i++)
{
if(!strstr($array_HZ[$i],"flags")) $gameserver .= $array_HZ[$i]."n";
}
$registerG = ini_get('register_globals');
if ($registerG == 1){
$registerG = "ON";
}else{
$registerG = "OFF";
}
$safemodevar = ini_get('safe_mode');
$safemodevar = strtoupper($safemodevar);
if ($safemodevar == 1){
$safemodevar = "ON";
}else{
$safemodevar = "OFF";
}
$uptime = explode(",",$uptime);
?>
<table width="60%" align="left">
<tr>
<td>
<div id="screenTabs">
<div id="tabs">
<ul id="484">
<li class="first" id="current">
<a href="#" onClick="return showTab(this);" id="1">
<span>System</span>
</a>
</li>
<li>
<a href="#" onClick="return showTab(this);" id="2">
<span>Prozessor</span>
</a>
</li>
<li>
<a href="#" onClick="return showTab(this);" id="3">
<span>Speicherinfo</span>
</a>
</li>
<li>
<a href="#" onClick="return showTab(this);" id="4">
<span>Plattenplatz</span>
</a>
</li>
<li>
<a href="#" onClick="return showTab(this);" id="5">
<span>Kernel HZ</span>
</a>
</li>
<li>
<a href="#" onClick="return showTab(this);" id="6">
<span>PHP</span>
</a>
</li>
<li class="last">
<a href="#" onClick="return showTab(this);" id="8">
<span>About</span>
</a>
</li>
</ul>
</div>
</div>
<div id="1/content" style="display: block">
<table width="100%" align="left" class="tabsramen">
<tr>
<td>
<table width="100%" class="serverpfad">
<tr>
<td>System: </td>
<td><?php echo $system ?></td>
</tr>
<tr>
<td>Hostname: </td>
<td><?php echo $host ?></td>
</tr>
<tr>
<td>Kernelversion: </td>
<td><?php echo $kernel ?></td>
</tr>
<tr>
<td>Serverzeit: </td>
<td><?php echo $time ?></td>
</tr>
<tr>
<td>Serveruptime: </td>
<td><?php echo $uptime['0'] ?></td>
</tr>
<tr>
<td>Angemeldete User: </td>
<td><?php echo $uptime['1'] ?></td>
</tr>
<tr>
<td>Serverauslastung: </td>
<td><?php echo $uptime['2'].", ".$uptime['3'].", ".$uptime['4'] ?></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="2/content" style="display: none">
<table width="100%" align="left" class="tabsramen">
<tr>
<td>
<table width="100%" class="serverpfad">
<tr>
<td><pre><?php echo $prozessor ?></pre></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="3/content" style="display: none">
<table width="100%" align="left" class="tabsramen">
<tr>
<td>
<table width="100%" class="serverpfad">
<tr>
<td><pre><?php echo $speicherinfo ?></pre></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="4/content" style="display: none">
<table width="100%" align="left" class="tabsramen">
<tr>
<td>
<table width="100%" class="serverpfad">
<tr>
<td><pre><?php echo $plattenspace ?></pre></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="5/content" style="display: none">
<table width="100%" align="left" class="tabsramen">
<tr>
<td>
<table width="100%" class="serverpfad">
<tr>
<td><pre><?php echo $gameserver ?></pre></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="6/content" style="display: none">
<table width="100%" align="left" class="tabsramen">
<tr>
<td>
<table width="100%" class="serverpfad">
<tr>
<td>PHP Version: </td>
<td><?php echo phpversion(); ?></td>
</tr>
<tr>
<td>Register Globals: </td>
<td><?php echo $registerG ?></td>
</tr>
<tr>
<td>Safemode: </td>
<td><?php echo $safemodevar ?></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="8/content" style="display: none">
<table width="100%" align="left" class="tabsramen">
<tr>
<td>
<table width="100%" class="serverpfad">
<tr>
<td>##</td>
<td>##</td>
</tr>
<tr>
<td>## </td>
<td>------</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
-
- Posts: 7
- Joined: 2007-04-04 23:43
Re: CPU und RAM
Moin
@ twisterchen: Danke geht, aberwenn ich die datei öffne, wöfür sind dann oben die links: System, Prozessor, Speicherinfo,usw?? kann man die auch verwenden?
denn bei mir wird wenn ich da drauf klicke nichts angezeigt...
MFG
@ twisterchen: Danke geht, aberwenn ich die datei öffne, wöfür sind dann oben die links: System, Prozessor, Speicherinfo,usw?? kann man die auch verwenden?
denn bei mir wird wenn ich da drauf klicke nichts angezeigt...
MFG
-
- Posts: 150
- Joined: 2004-12-15 16:48
Re: CPU und RAM
Ich finde collectd nett. Unter den Contributions findet sich ein CGI-Skript zum Generieren der RRD-Graphiken.leppii wrote:Hallo
Also kann man eine datei schreiben, die die CPU und RAM Auslastung ausliest
und dann auf einer Homepage anzeigt??
Wenn ja würde das einer für meine Comuunity schreiben, oder gibt es schon so ein script??
-
- Anbieter
- Posts: 232
- Joined: 2005-07-14 14:13
Re: CPU und RAM
Ich sagte ja du musst dir die tabelle noch anpassen es geht ja eigentlich nur um die Variablen die du mit dem php code auslesen kannst
die Tabelle wirst du wohl noch hinbekommen oder soll ich dir noch eine fertige Tabelle posten ?
die Tabelle wirst du wohl noch hinbekommen oder soll ich dir noch eine fertige Tabelle posten ?
-
- Posts: 7
- Joined: 2007-04-04 23:43
Re: CPU und RAM
naja wenn du das machen würdest??
nee scherz mach ich schon!!
danke!!!!
Nur gibt er mir leider nicht das gewünschte aus was ich brauche.
Eigentlich wollte ich, das der zb dann ausschreibt: CPU-Auslastung: 5,3 %
Habe das schon öfters gesehen! aber aus der php hier kannich das nicht entnehmen!!
MFG
nee scherz mach ich schon!!
danke!!!!
Nur gibt er mir leider nicht das gewünschte aus was ich brauche.
Eigentlich wollte ich, das der zb dann ausschreibt: CPU-Auslastung: 5,3 %
Habe das schon öfters gesehen! aber aus der php hier kannich das nicht entnehmen!!
MFG