mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Major updates on the road to 0.7
git-svn-id: http://www.observium.org/svn/observer/trunk@492 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,25 +1,34 @@
|
||||
<?php
|
||||
|
||||
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '".mres($_GET['a'])."' and D.device_id = E.device_id"));
|
||||
|
||||
switch ($sensor['entSensorType']) {
|
||||
case 'celsius':
|
||||
case 'watts':
|
||||
case 'voltsDC':
|
||||
case 'amperes':
|
||||
$scale_min = "0";
|
||||
break;
|
||||
}
|
||||
|
||||
include("common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $sensor['hostname'] . "/ces-" . $sensor['entPhysicalIndex'] . ".rrd";
|
||||
|
||||
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '".mres($_GET['a'])."' and D.device_id = E.device_id"));
|
||||
$type = str_pad($sensor['entSensorType'], 8);
|
||||
$type = substr($type,0,8);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $sensor['hostname'] . "/ces-" . $sensor['entPhysicalIndex'] . ".rrd";
|
||||
|
||||
$type = str_pad($sensor['entSensorType'], 8);
|
||||
$type = substr($type,0,8);
|
||||
$rrd_options .= " DEF:avg=$rrd_filename:value:AVERAGE";
|
||||
$rrd_options .= " DEF:min=$rrd_filename:value:MIN";
|
||||
$rrd_options .= " DEF:max=$rrd_filename:value:MAX";
|
||||
$rrd_options .= " COMMENT:' Last Min Max Ave\\n'";
|
||||
$rrd_options .= " AREA:max#a5a5a5";
|
||||
$rrd_options .= " AREA:min#ffffff";
|
||||
$rrd_options .= " LINE1.25:avg#aa2200:'".$type."'";
|
||||
$rrd_options .= " GPRINT:avg:AVERAGE:%5.2lf%s";
|
||||
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
||||
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
||||
$rrd_options .= " GPRINT:avg:LAST:%5.2lf%s";
|
||||
$rrd_options .= " DEF:avg=$rrd_filename:value:AVERAGE";
|
||||
$rrd_options .= " DEF:min=$rrd_filename:value:MIN";
|
||||
$rrd_options .= " DEF:max=$rrd_filename:value:MAX";
|
||||
$rrd_options .= " COMMENT:' Last Min Max Ave\\n'";
|
||||
$rrd_options .= " AREA:max#a5a5a5";
|
||||
$rrd_options .= " AREA:min#ffffff";
|
||||
$rrd_options .= " LINE1.25:avg#aa2200:'".$type."'";
|
||||
$rrd_options .= " GPRINT:avg:AVERAGE:%5.2lf%s";
|
||||
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
||||
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
||||
$rrd_options .= " GPRINT:avg:LAST:%5.2lf%s";
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -14,8 +14,8 @@ if($_GET['legend'] == "no") { $rrd_options = " -g"; }
|
||||
|
||||
if(!$scale_min && !$scale_max) { $rrd_options .= " --alt-autoscale-max"; }
|
||||
|
||||
if($scale_min) { $rrd_options .= " -l $scale_min"; }
|
||||
if($scale_max) { $rrd_options .= " -u $scale_max"; }
|
||||
if(isset($scale_min)) { $rrd_options .= " -l $scale_min"; }
|
||||
if(isset($scale_max)) { $rrd_options .= " -u $scale_max"; }
|
||||
|
||||
|
||||
$rrd_options .= " -E --start ".$from." --end " . ($to - 150) . " --width ".$width." --height ".$height." ";
|
||||
|
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
if($os == "Linux" || $os == "NetBSD" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "Windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfSense" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||
$os = strtolower($os);
|
||||
|
||||
if($os == "linux" || $os == "netbsd" || $os == "freebsd" || $os == "dragonfly" || $os == "openbsd" || $os == "windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfsense" || $os == "dragonfly" || $os == "openbsd") {
|
||||
include("device_cpu_unix.inc.php");
|
||||
}
|
||||
|
||||
|
@@ -1,3 +1,9 @@
|
||||
<?php
|
||||
|
||||
$os = strtolower($os);
|
||||
|
||||
if($os == "linux" || $os == "netbsd" || $os == "freebsd" || $os == "dragonfly" || $os == "openbsd" || $os == "windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfsense" || $os == "dragonfly" || $os == "openbsd") {
|
||||
include("device_memory_unix.inc.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -1,7 +1,12 @@
|
||||
<?php
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
include("common.inc.php");
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
|
||||
$sql = mysql_query("SELECT * FROM temperature where temp_id = '$temp'");
|
||||
$temperature = mysql_fetch_array(mysql_query("SELECT * FROM temperature where temp_id = '".mres($_GET['id'])."'"));
|
||||
|
||||
@@ -16,10 +21,13 @@ include("common.inc.php");
|
||||
|
||||
$rrd_options .= " DEF:temp=$rrd_filename:temp:AVERAGE";
|
||||
$rrd_options .= " CDEF:tempwarm=temp,".$temperature[temp_limit].",GT,temp,UNKN,IF";
|
||||
$rrd_options .= " CDEF:tempcold=temp,20,LT,temp,UNKN,IF";
|
||||
$rrd_options .= " AREA:temp#FFFF99";
|
||||
$rrd_options .= " AREA:tempwarm#FF9999";
|
||||
$rrd_options .= " AREA:tempcold#CCCCFF";
|
||||
$rrd_options .= " LINE1.5:temp#cc0000:'" . quotemeta($temperature[temp_descr_fixed]."'");
|
||||
$rrd_options .= " LINE1.5:tempwarm#660000";
|
||||
$rrd_options .= " GPRINT:temp:LAST:%3.0lfC";
|
||||
$rrd_options .= " GPRINT:temp:MAX:%3.0lfC\\\\l";
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -1,23 +1,23 @@
|
||||
<?php
|
||||
|
||||
$daily_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
||||
$daily_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
||||
$daily_traffic .= $args;
|
||||
$daily_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
|
||||
$daily_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
|
||||
$daily_url .= $args;
|
||||
|
||||
$weekly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
||||
$weekly_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
||||
$weekly_traffic .= $args;
|
||||
$weekly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_url .= $args;
|
||||
|
||||
$monthly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
||||
$monthly_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
||||
$monthly_traffic .= $args;
|
||||
$monthly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_url .= $args;
|
||||
|
||||
$yearly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||
$yearly_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||
$yearly_traffic .= $args;
|
||||
$yearly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_url .= $args;
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||
|
@@ -6,17 +6,17 @@
|
||||
|
||||
if(!$device) { $device['device_id'] = getifhost($interface['interface_id']); }
|
||||
|
||||
$daily_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
||||
$daily_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
|
||||
$daily_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
||||
$daily_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
|
||||
|
||||
$weekly_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
||||
$weekly_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
|
||||
$weekly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
||||
$weekly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
|
||||
|
||||
$monthly_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
||||
$monthly_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
|
||||
$monthly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
||||
$monthly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
|
||||
|
||||
$yearly_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||
$yearly_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
|
||||
$yearly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||
$yearly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
|
||||
|
||||
echo("<a href='/device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_traffic' border=0></a> ");
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
#echo("<pre>");
|
||||
#print_r($interface);
|
||||
#echo("</pre>");
|
||||
|
||||
# This file prints a table row for each interface
|
||||
|
||||
$interface['device_id'] = $device['device_id'];
|
||||
@@ -11,8 +15,8 @@
|
||||
|
||||
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
|
||||
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
|
||||
if($interface['ifInErrors_delta'] > 0 || $interface['ifOutErrors_delta'] > 0) {
|
||||
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>","port_errors");
|
||||
} else { $error_img = ""; }
|
||||
|
||||
if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){
|
||||
@@ -48,22 +52,24 @@
|
||||
echo("</td><td width=100>");
|
||||
|
||||
if($port_details) {
|
||||
$interface['graph_type'] = "bits";
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=bits&if=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||
$interface['graph_type'] = "pkts";
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=pkts&if=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||
$interface['graph_type'] = "errors";
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=errors&if=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||
$interface['graph_type'] = "port_bits";
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=port_bits&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||
$interface['graph_type'] = "port_upkts";
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=port_upkts&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||
$interface['graph_type'] = "port_errors";
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=port_errors&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||
}
|
||||
|
||||
echo("</td><td width=120>");
|
||||
if($interface['ifOperStatus'] == "up") {
|
||||
$interface['in_rate'] = $interface['ifInOctets_rate'] * 8;
|
||||
$interface['out_rate'] = $interface['ifOutOctets_rate'] * 8;
|
||||
$in_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
||||
$out_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
||||
echo("<img src='images/16/arrow_left.png' align=absmiddle> <span style='color: " . percent_colour($in_perc) . "'>" .
|
||||
formatRates($interface['in_rate']) . "</span><br />");
|
||||
formatRates($interface['in_rate']) . "<br />".format_bi($interface['ifInUcastPkts_rate'])."pps</span><br />");
|
||||
echo("<img align=absmiddle src='images/16/arrow_out.png'> <span style='color: " . percent_colour($out_perc) . "'>" .
|
||||
formatRates($interface['out_rate']) . "</span>");
|
||||
formatRates($interface['out_rate']) . "<br />".format_bi($interface['ifOutUcastPkts_rate'])."pps</span>");
|
||||
}
|
||||
|
||||
echo("</td><td width=75>");
|
||||
@@ -198,7 +204,6 @@ echo("</td>");
|
||||
unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
|
||||
|
||||
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
// If we're showing graphs, generate the graph and print the img tags
|
||||
@@ -206,17 +211,17 @@ echo("</td>");
|
||||
|
||||
$type = $graph_type;
|
||||
|
||||
$daily_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=210&height=100";
|
||||
$daily_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=500&height=150";
|
||||
$daily_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=210&height=100";
|
||||
$daily_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=500&height=150";
|
||||
|
||||
$weekly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=210&height=100";
|
||||
$weekly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=500&height=150";
|
||||
$weekly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=210&height=100";
|
||||
$weekly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=500&height=150";
|
||||
|
||||
$monthly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=210&height=100";
|
||||
$monthly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=500&height=150";
|
||||
$monthly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=210&height=100";
|
||||
$monthly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=500&height=150";
|
||||
|
||||
$yearly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=210&height=100";
|
||||
$yearly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=500&height=150";
|
||||
$yearly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=210&height=100";
|
||||
$yearly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=500&height=150";
|
||||
|
||||
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=7>");
|
||||
|
@@ -13,7 +13,7 @@ $interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS
|
||||
$interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifOperStatus = 'down' AND I.ifAdminStatus = 'up' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0);
|
||||
$interfaces['shutdown'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifAdminStatus = 'down' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0);
|
||||
$interfaces['ignored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '1' OR D.ignore = '1')"),0);
|
||||
$interfaces['errored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '0' OR D.ignore = '0') AND (I.in_errors > '0' OR I.out_errors > '0')"),0);
|
||||
$interfaces['errored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '0' OR D.ignore = '0') AND (I.ifInErrors_delta > '0' OR I.ifOutErrors_delta > '0')"),0);
|
||||
|
||||
|
||||
$services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services"),0);
|
||||
|
Reference in New Issue
Block a user