mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
updates additions
git-svn-id: http://www.observium.org/svn/observer/trunk@505 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -43,7 +43,7 @@ if($row['username'] && $row['username'] == $_SESSION['username']) {
|
||||
setcookie("username", $_SESSION['username'], time()+60*60*24*100, "/");
|
||||
setcookie("password", $_SESSION['password'], time()+60*60*24*100, "/");
|
||||
}
|
||||
} else {
|
||||
} elseif ($_SESSION['username']) {
|
||||
$auth_message = "Authentication Failed";
|
||||
unset ($_SESSION['authenticated']);
|
||||
mysql_query("INSERT INTO authlog (`user`,`address`,`result`) VALUES ('".$_SESSION['username']."', '".$_SERVER["REMOTE_ADDR"]."', 'authentication failure')");
|
||||
|
||||
@@ -1,9 +1,41 @@
|
||||
<?php
|
||||
|
||||
include("common.inc.php");
|
||||
$query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".mres($device_id)."' AND hrDeviceType = 'hrDeviceProcessor'");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/" . "cpu.rrd";
|
||||
$i=0;
|
||||
while($proc = mysql_fetch_array($query)) {
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/$hostname/hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd";
|
||||
|
||||
if(is_file($rrd_filename)) {
|
||||
|
||||
$descr = str_pad($proc['hrDeviceDescr'], 8);
|
||||
$descr = substr($descr,0,8);
|
||||
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['rra'] = "usage";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$unit_text = "Load %";
|
||||
|
||||
$units='%';
|
||||
$total_units='%';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
$scale_max = "100";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
include ("generic_multi_line.inc.php");
|
||||
|
||||
if ($not) {
|
||||
|
||||
include("common.inc.php");
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/" . "ucd_cpu.rrd";
|
||||
$rrd_options .= " DEF:user=$rrd_filename:user:AVERAGE";
|
||||
$rrd_options .= " DEF:nice=$rrd_filename:nice:AVERAGE";
|
||||
$rrd_options .= " DEF:system=$rrd_filename:system:AVERAGE";
|
||||
@@ -31,4 +63,6 @@ include("common.inc.php");
|
||||
$rrd_options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
|
||||
$rrd_options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,9 +1,41 @@
|
||||
<?php
|
||||
|
||||
include("common.inc.php");
|
||||
$query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".mres($device_id)."' AND hrDeviceType = 'hrDeviceProcessor'");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/" . "cpu.rrd";
|
||||
$i=0;
|
||||
while($proc = mysql_fetch_array($query)) {
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/$hostname/hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd";
|
||||
|
||||
if(is_file($rrd_filename)) {
|
||||
|
||||
$descr = str_pad($proc['hrDeviceDescr'], 8);
|
||||
$descr = substr($descr,0,8);
|
||||
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['rra'] = "usage";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$unit_text = "Load %";
|
||||
|
||||
$units='%';
|
||||
$total_units='%';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
$scale_max = "100";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
include ("generic_multi_line.inc.php");
|
||||
|
||||
if ($not) {
|
||||
|
||||
include("common.inc.php");
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/" . "ucd_cpu.rrd";
|
||||
$rrd_options .= " DEF:user=$rrd_filename:user:AVERAGE";
|
||||
$rrd_options .= " DEF:nice=$rrd_filename:nice:AVERAGE";
|
||||
$rrd_options .= " DEF:system=$rrd_filename:system:AVERAGE";
|
||||
@@ -31,4 +63,6 @@ include("common.inc.php");
|
||||
$rrd_options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
|
||||
$rrd_options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -12,10 +12,8 @@ include("common.inc.php");
|
||||
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
|
||||
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
|
||||
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
|
||||
|
||||
$descr = str_pad($fs[hrStorageDescr], 14);
|
||||
$descr = substr($descr,0,14);
|
||||
$text = str_replace("/", "_", $fs['hrStorageDescr']);
|
||||
$rrd = $config['rrd_dir'] . "/$hostname/hrStorage-".$fs['hrStorageIndex'].".rrd";
|
||||
$rrd_options .= " DEF:$fs[storage_id]=$rrd:used:AVERAGE";
|
||||
$rrd_options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
include("common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/load.rrd";
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/ucd_load.rrd";
|
||||
|
||||
$rrd_options .= " DEF:1min=$rrd_filename:1min:AVERAGE";
|
||||
$rrd_options .= " DEF:5min=$rrd_filename:5min:AVERAGE";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
include("common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/mem.rrd";
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/ucd_mem.rrd";
|
||||
|
||||
$rrd_options .= " -b 1024";
|
||||
|
||||
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
$scale_min = "0";
|
||||
$scale_max = "100";
|
||||
|
||||
include("common.inc.php");
|
||||
|
||||
$iter = "1";
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `hrDevice` AS C, `devices` AS D where C.`hrDevice_id` = '".mres($_GET['id'])."' AND C.device_id = D.device_id");
|
||||
$rrd_options .= " COMMENT:' Cur Max\\n'";
|
||||
while($proc = mysql_fetch_array($sql)) {
|
||||
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
|
||||
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
|
||||
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
|
||||
$proc['descr_fixed'] = str_pad($proc['hrDeviceDescr'], 28);
|
||||
$proc['descr_fixed'] = substr($proc['descr_fixed'],0,28);
|
||||
$proc['descr_fixed'] = str_replace(":", "\:", $proc['descr_fixed']);
|
||||
$rrd = $config['rrd_dir'] . "/".$proc['hostname']."/hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd";
|
||||
$rrd_options .= " DEF:proc" . $proc['hrDeviceIndex'] . "=$rrd:usage:AVERAGE ";
|
||||
$rrd_options .= " LINE1:proc" . $proc['hrDeviceIndex'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
|
||||
$rrd_options .= " GPRINT:proc" . $proc['hrDeviceIndex'] . ":LAST:%3.0lf";
|
||||
$rrd_options .= " GPRINT:proc" . $proc['hrDeviceIndex'] . ":MAX:%3.0lf\\\l ";
|
||||
$iter++;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -14,9 +14,8 @@ $rrd_options .= " -b 1024";
|
||||
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
|
||||
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
|
||||
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
|
||||
$descr = str_pad($fs[hrStorageDescr], 12);
|
||||
$descr = substr($descr,0,12);
|
||||
$text = str_replace("/", "_", $fs['hrStorageDescr']);
|
||||
$descr = substr(str_pad($fs[hrStorageDescr], 12),0,12);
|
||||
$descr = str_replace(":","\:",$descr);
|
||||
$rrd = $config['rrd_dir'] . "/$hostname/hrStorage-".$fs['hrStorageIndex'].".rrd";
|
||||
$rrd_options .= " DEF:$fs[storage_id]=$rrd:used:AVERAGE";
|
||||
$rrd_options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
|
||||
|
||||
@@ -4,16 +4,22 @@ $temp = mysql_result(mysql_query("select count(*) from temperature WHERE temp_ho
|
||||
$storage = mysql_result(mysql_query("select count(*) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0);
|
||||
$cemp = mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$cpm = mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$hrprocessor = mysql_result(mysql_query("select count(*) from hrDevice WHERE device_id = '" . $device['device_id'] . "' AND `hrDeviceType` = 'hrDeviceProcessor'"), 0);
|
||||
|
||||
|
||||
if($temp) { $datas[] = 'temp'; }
|
||||
if($storage) { $datas[] = 'storage'; }
|
||||
if($cemp) { $datas[] = 'cemp'; }
|
||||
if($cpm) { $datas[] = 'cpm'; }
|
||||
if($hrprocessor) { $datas[] = 'hrprocessors'; }
|
||||
|
||||
|
||||
$type_text['temp'] = "Temperatures";
|
||||
$type_text['cemp'] = "Memory Pools";
|
||||
$type_text['cpm'] = "Processor Usage";
|
||||
$type_text['storage'] = "Disk Usage";
|
||||
$type_text['hrprocessors'] = "Processor Usage";
|
||||
|
||||
|
||||
echo("<div style='margin:auto; text-align: center; margin-top: 0px; margin-bottom: 10px;'>
|
||||
<b class='rounded'>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
echo("<div style='margin-top: 5px; padding: 0px;'>");
|
||||
echo("<table width=100% cellpadding=6 cellspacing=0>");
|
||||
$i = '1';
|
||||
$procs = mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '" . $device['device_id'] . "' AND hrDeviceType = 'hrDeviceProcessor'");
|
||||
while($proc = mysql_fetch_array($procs)) {
|
||||
|
||||
$proc_url = "?page=device/".$device['device_id']."/health/hrprocessors/";
|
||||
|
||||
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['entPhysicalDescr'];
|
||||
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$month&to=$now&width=400&height=125\'>";
|
||||
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
|
||||
|
||||
if($proc['cpuCPMTotal5minRev'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
|
||||
echo("<tr><td class=tablehead width=350><a href='' $proc_popup>" . $proc['entPhysicalDescr'] . "</a></td>
|
||||
<td><a href='#' $proc_popup><img src='percentage.php?per=" . $proc['hrProcessorTotal5minRev'] . "&width=600'></a></td>
|
||||
<td style='font-weight: bold; color: $drv_colour'>" . $proc['hrProcessorTotal5minRev'] . "%</td>
|
||||
</tr>");
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=5>");
|
||||
|
||||
$daily_graph = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_graph = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_graph = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_graph = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_graph' border=0></a> ");
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$weekly_graph' border=0></a> ");
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$monthly_graph' border=0></a> ");
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$yearly_graph' border=0></a>");
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user