mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
adding more junose and foundry/brocade. adding new mibs. unifying processor polling
git-svn-id: http://www.observium.org/svn/observer/trunk@831 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,4 +1,37 @@
|
||||
<?php
|
||||
|
||||
$query = mysql_query("SELECT * FROM `processors` where `device_id` = '".mres($device_id)."'");
|
||||
|
||||
$i=0;
|
||||
while($proc = mysql_fetch_array($query)) {
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/$hostname/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd");
|
||||
|
||||
if(is_file($rrd_filename)) {
|
||||
|
||||
$descr = short_hrDeviceDescr($proc['processor_descr']);
|
||||
$descr = str_replace(":", "\:", $descr);
|
||||
|
||||
$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;
|
||||
|
||||
if ($rrd_list) {
|
||||
include ("generic_multi_line.inc.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
$query = mysql_query("SELECT * FROM `cpmCPU` where `device_id` = '".mres($device_id)."'");
|
||||
|
||||
$i=0;
|
||||
while($proc = mysql_fetch_array($query)) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/$hostname/" . safename("cpmCPU-" . $proc['cpmCPU_oid'] . ".rrd");
|
||||
if(is_file($rrd_filename)) {
|
||||
$descr = str_pad($proc['entPhysicalDescr'], 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;
|
||||
|
||||
if($rrd_list) {include ("generic_multi_line.inc.php"); } else {
|
||||
include("common.inc.php");
|
||||
$database = $config['rrd_dir'] . "/" . $hostname . "/ios-cpu.rrd";
|
||||
$rrd_options .= " DEF:5m=$database:LOAD5M:AVERAGE";
|
||||
$rrd_options .= " DEF:5m_max=$database:LOAD5M:MAX";
|
||||
$rrd_options .= " DEF:5m_min=$database:LOAD5M:MIN";
|
||||
$rrd_options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
|
||||
$rrd_options .= " AREA:5m#ffee99: LINE1.25:5m#aa2200:Load\ %";
|
||||
$rrd_options .= " GPRINT:5m:LAST:%6.2lf\ GPRINT:5m_min:AVERAGE:%6.2lf\ ";
|
||||
$rrd_options .= " GPRINT:5m_max:MAX:%6.2lf\ GPRINT:5m:AVERAGE:%6.2lf\\\\n";
|
||||
}
|
||||
|
||||
?>
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$scale_min = "0";
|
||||
$scale_max = "100";
|
||||
|
||||
include("common.inc.php");
|
||||
|
||||
$iter = "1";
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `processors` AS P, `devices` AS D where P.`processor_id` = '".mres($_GET['id'])."' AND P.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'] = substr(str_pad(short_hrDeviceDescr($proc['hrDeviceDescr']), 28),0,28);
|
||||
$proc['descr_fixed'] = str_replace(":", "\:", $proc['descr_fixed']);
|
||||
$rrd = $config['rrd_dir'] . "/".$proc['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".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++;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -42,7 +42,8 @@ echo('<li class="' . $select['graphs'] . '">
|
||||
$health = mysql_result(mysql_query("select count(*) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(temp_id) from temperature WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
|
||||
if($health) {
|
||||
echo('<li class="' . $select['health'] . '">
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
#include("cpu.inc.php");
|
||||
#include("memory.inc.php");
|
||||
include("temperatures.inc.php");
|
||||
include("netstats.inc.php");
|
||||
include("uptime.inc.php");
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
include("cpu.inc.php");
|
||||
include("temperatures.inc.php");
|
||||
include("netstats.inc.php");
|
||||
include("uptime.inc.php");
|
||||
?>
|
||||
@@ -6,16 +6,17 @@ $cemp = mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_
|
||||
$cmp = mysql_result(mysql_query("select count(*) from cmpMemPool 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);
|
||||
$processor = mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$fans = mysql_result(mysql_query("select count(*) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$volts = mysql_result(mysql_query("select count(*) from voltage WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
|
||||
|
||||
if ($temp) { $datas[] = 'temp'; }
|
||||
if ($storage) { $datas[] = 'storage'; }
|
||||
if ($cemp) { $datas[] = 'cemp'; }
|
||||
if ($cpm) { $datas[] = 'cpm'; }
|
||||
if ($cmp) { $datas[] = 'cmp'; }
|
||||
if ($hrprocessor) { $datas[] = 'hrprocessors'; }
|
||||
if ($processor) { $datas[] = 'processors'; }
|
||||
if ($fans) { $datas[] = 'fanspeeds'; }
|
||||
if ($volts) { $datas[] = 'voltages'; }
|
||||
|
||||
@@ -25,6 +26,7 @@ $type_text['cemp'] = "Memory Enh Pools";
|
||||
$type_text['cpm'] = "Processor Usage";
|
||||
$type_text['storage'] = "Disk Usage";
|
||||
$type_text['hrprocessors'] = "Processor Usage";
|
||||
$type_text['processors'] = "Processor Usage";
|
||||
$type_text['voltages'] = "Voltages";
|
||||
$type_text['fanspeeds'] = "Fanspeeds";
|
||||
|
||||
|
||||
@@ -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 `processors` WHERE device_id = '" . $device['device_id'] . "'");
|
||||
while($proc = mysql_fetch_array($procs)) {
|
||||
|
||||
$proc_url = "?page=device/".$device['device_id']."/health/processors/";
|
||||
|
||||
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['processor_descr'];
|
||||
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$month&to=$now&width=400&height=125\'>";
|
||||
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
|
||||
|
||||
if($proc['processor_usage'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
|
||||
echo("<tr><td class=tablehead width=450><a href='' $proc_popup>" . $proc['processor_descr'] . "</a></td>
|
||||
<td><a href='#' $proc_popup>
|
||||
<img src='percentage.php?per=" . $proc['processorLoad'] . "&width=500'></a></td>
|
||||
<td style='font-weight: bold; color: $proc_colour'>" . $proc['processor_usage'] . "%</td>
|
||||
</tr>");
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=5>");
|
||||
|
||||
$daily_graph = "graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $proc['processor_id'] . "&type=processor&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>");
|
||||
|
||||
|
||||
?>
|
||||
@@ -19,9 +19,7 @@ $services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM
|
||||
if($services['down']) { $services_colour = $warn_colour_a; } else { $services_colour = $list_colour_a; }
|
||||
if($interfaces['down']) { $interfaces_colour = $warn_colour_a; } else { $interfaces_colour = $list_colour_a; }
|
||||
|
||||
echo("
|
||||
<table width=100% cellspacing=0 cellpadding=0>
|
||||
<tr><td width=50% valign=top>");
|
||||
echo("<div style='width: 50%; float: left;'>");
|
||||
|
||||
#if(file_exists("includes/dev-data-" . strtolower($device[os]) . ".inc.php")) {
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
@@ -31,32 +29,6 @@ echo("
|
||||
echo("</div>");
|
||||
#}
|
||||
|
||||
include("overview/hrProcessors.inc.php");
|
||||
include("overview/cpmCPU.inc.php");
|
||||
include("overview/cemp.inc.php");
|
||||
include("overview/cmp.inc.php");
|
||||
include("overview/hrStorage.inc.php");
|
||||
include("overview/temperatures.inc.php");
|
||||
include("overview/fanspeeds.inc.php");
|
||||
include("overview/voltages.inc.php");
|
||||
|
||||
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p class=sectionhead>Recent Events</p>");
|
||||
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%d/%b/%y %T') as humandate FROM `eventlog` WHERE `host` = '$_GET[id]' ORDER BY `datetime` DESC LIMIT 0,10";
|
||||
$data = mysql_query($query);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=2 width=100%>");
|
||||
|
||||
while($entry = mysql_fetch_array($data)) {
|
||||
|
||||
include("includes/print-event-short.inc");
|
||||
|
||||
}
|
||||
echo("</table></div>");
|
||||
|
||||
echo("</td><td width=50% valign=top>");
|
||||
|
||||
include("overview/ports.inc.php");
|
||||
|
||||
@@ -93,6 +65,34 @@ echo("
|
||||
|
||||
}
|
||||
|
||||
echo("</td></tr></table>");
|
||||
echo("</div>");
|
||||
|
||||
echo("<div style='float:right; width: 50%;'>");
|
||||
|
||||
|
||||
### Right Pane
|
||||
include("overview/processors.inc.php");
|
||||
include("overview/hrProcessors.inc.php");
|
||||
include("overview/cemp.inc.php");
|
||||
include("overview/cmp.inc.php");
|
||||
include("overview/hrStorage.inc.php");
|
||||
include("overview/temperatures.inc.php");
|
||||
include("overview/fanspeeds.inc.php");
|
||||
include("overview/voltages.inc.php");
|
||||
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p class=sectionhead>Recent Events</p>");
|
||||
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%d/%b/%y %T') as humandate FROM `eventlog` WHERE `host` = '$_GET[id]' ORDER BY `datetime` DESC LIMIT 0,10";
|
||||
$data = mysql_query($query);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=2 width=100%>");
|
||||
|
||||
while($entry = mysql_fetch_array($data)) {
|
||||
include("includes/print-event-short.inc");
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
echo("</div>");
|
||||
?>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
if(mysql_result(mysql_query("SELECT count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"),0)) {
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p class=sectionhead>Processors</p>");
|
||||
echo("<table width=100%>");
|
||||
$i = '1';
|
||||
$procs = mysql_query("SELECT * FROM `cpmCPU` WHERE device_id = '" . $device['device_id'] . "'");
|
||||
while($proc = mysql_fetch_array($procs)) {
|
||||
|
||||
$proc_url = "?page=device/".$device['device_id']."/health/cpm/";
|
||||
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['entPhysicalDescr'];
|
||||
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&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><a href='$proc_url' $proc_popup>" . $proc['entPhysicalDescr'] . "</a></td>
|
||||
<td><a href='#' $proc_popup><img src='percentage.php?per=" . $proc['cpmCPUTotal5minRev'] . "'></a></td>
|
||||
<td style='font-weight: bold; color: $drv_colour'>" . $proc['cpmCPUTotal5minRev'] . "%</td>
|
||||
</tr>");
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if($interfaces['total']) {
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>
|
||||
<p class=sectionhead>Ports</p>" . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . "");
|
||||
" . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . "");
|
||||
|
||||
echo("<div style='height: 5px;'></div>");
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
if(mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"),0)) {
|
||||
$processor_rows = 0;
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead>Processors</p>");
|
||||
echo("<table width=100% cellspacing=0 cellpadding=5>");
|
||||
$i = '1';
|
||||
$procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "'");
|
||||
while($proc = mysql_fetch_array($procs)) {
|
||||
if(is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$proc_url = $config['base_url'] . "/device/".$device['device_id']."/health/processors/";
|
||||
|
||||
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['processor_descr'];
|
||||
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$month&to=$now&width=400&height=125\'>";
|
||||
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
|
||||
|
||||
$mini_url = $config['base_url'] . "/graph.php?id=".$proc['processor_id']."&type=processor&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4";
|
||||
|
||||
$text_descr = $proc['processor_descr'];
|
||||
# $text_descr = short_processor_descr($proc['processor_descr']);
|
||||
|
||||
if($proc['processor_usage'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
|
||||
echo("<tr bgcolor=$row_colour><td class=tablehead width=350><a href='".$proc_url."' $proc_popup>" . $text_descr . "</a></td>
|
||||
<td width=100><a href='".$proc_url."'><img src='$mini_url'></a></td>
|
||||
<td width=160><a href='".$proc_url."' $proc_popup>
|
||||
<img src='percentage.php?per=" . $proc['processor_usage'] . "&width=150'></a></td>
|
||||
<td style='font-weight: bold; color: $proc_colour'>
|
||||
" . $proc['processor_usage'] . "%</td>
|
||||
</tr>");
|
||||
$processor_rows++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -33,7 +33,7 @@ if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE device
|
||||
$temp_link_a = $temp_link . $temp['temp_descr'] . "</a>";
|
||||
|
||||
$temp['temp_descr'] = truncate($temp['temp_descr'], 25, '');
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$temp_link_a</strong></td><td width=80 align=right class=tablehead>$temp_link_b<td width=80 align=right class=tablehead>$temp_link_c</td></tr>");
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$temp_link_a</strong></td><td width=80 align=right class=tablehead>$temp_link_b<td width=35 align=right class=tablehead>$temp_link_c</td></tr>");
|
||||
if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
|
||||
$i++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user