mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
much improved things :)
git-svn-id: http://www.observium.org/svn/observer/trunk@424 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -64,6 +64,7 @@ if($_GET['debug']) {
|
||||
$graph = graph_netscreen_memory ($hostname . "/netscreen-memory.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||
break;
|
||||
case 'multi_bits':
|
||||
if($_GET['if']) { $_GET['interfaces'] = $_GET['if']; }
|
||||
$graph = graph_multi_bits ($_GET['interfaces'], $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
|
||||
break;
|
||||
case 'adsl_rate':
|
||||
|
||||
@@ -3,7 +3,26 @@ if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
||||
|
||||
if($_GET['type']) {
|
||||
|
||||
$type = $_GET['type'];
|
||||
$sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like '$type: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
||||
$query = mysql_query($sql);
|
||||
while($interface = mysql_fetch_array($query)) {
|
||||
$if_list .= $seperator . $interface['interface_id'];
|
||||
$seperator = ",";
|
||||
}
|
||||
unset($seperator);
|
||||
|
||||
echo("<tr bgcolor='$bg'>
|
||||
<td><span class=list-large>Total Graph for interfaces of type : ".$type."</span></td></tr>");
|
||||
|
||||
echo("<tr bgcolor='$bg'><td>");
|
||||
$graph_type = "multi_bits";
|
||||
$interface['interface_id'] = $if_list;
|
||||
include("includes/print-interface-graphs.php");
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like '$type: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
||||
$query = mysql_query($sql);
|
||||
while($interface = mysql_fetch_array($query)) {
|
||||
|
||||
@@ -53,7 +53,8 @@ if($ipv6interfaces){
|
||||
echo("+");
|
||||
} else { echo("."); }
|
||||
$full_address = "$ipv6_address/$ipv6_prefixlen";
|
||||
$valid_v6[$full_address] = 1;
|
||||
$valid = $full_address . "-" . $interface_id;
|
||||
$valid_v6[$valid] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +64,9 @@ $sql = "SELECT * FROM ipv6_addresses AS A, interfaces AS I WHERE I.device_id =
|
||||
$data = mysql_query($sql);
|
||||
while($row = mysql_fetch_array($data)) {
|
||||
$full_address = $row['ipv6_address'] . "/" . $row['ipv6_prefixlen'];
|
||||
if(!$valid_v6[$full_address]) {
|
||||
$interface_id = $row['interface_id'];
|
||||
$valid = $full_address . "-" . $interface_id;
|
||||
if(!$valid_v6[$valid]) {
|
||||
echo("-");
|
||||
$query = @mysql_query("DELETE FROM `ipv6_addresses` WHERE `ipv6_address_id` = '".$row['ipv6_address_id']."'");
|
||||
if(!mysql_result(mysql_query("SELECT count(*) FROM ipv6_addresses WHERE ipv6_network_id = '".$row['ipv6_network_id']."'"),0)) {
|
||||
|
||||
@@ -23,6 +23,31 @@ require('collectd/functions.php');
|
||||
require('collectd/definitions.php');
|
||||
|
||||
|
||||
function mac_clean_to_readable($mac){
|
||||
|
||||
$r = substr($mac, 0, 2);
|
||||
$r .= ":".substr($mac, 2, 2);
|
||||
$r .= ":".substr($mac, 4, 2);
|
||||
$r .= ":".substr($mac, 6, 2);
|
||||
$r .= ":".substr($mac, 8, 2);
|
||||
$r .= ":".substr($mac, 10, 2);
|
||||
|
||||
return($r);
|
||||
}
|
||||
|
||||
function zeropad($num)
|
||||
{
|
||||
return (strlen($num) == 1) ? '0'.$num : $num;
|
||||
}
|
||||
|
||||
function zeropad_lineno($num, $length)
|
||||
{
|
||||
while (strlen($num) < $length)
|
||||
$num = '0'.$num;
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
function only_alphanumeric( $string )
|
||||
{
|
||||
return preg_replace('/[^a-zA-Z0-9]/', '', $string);
|
||||
|
||||
@@ -273,7 +273,7 @@ function graph_mac_acc ($id, $graph, $from, $to, $width, $height) {
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.ma_id = '".$id."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
$acc = mysql_fetch_array($query);
|
||||
$database = $config['rrd_dir'] . "/" . $acc['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['peer_ip'] . ".rrd";
|
||||
$database = $config['rrd_dir'] . "/" . $acc['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height ";
|
||||
if($height < "33") { $options .= " --only-graph"; }
|
||||
$period = $to - $from;
|
||||
|
||||
@@ -7,18 +7,36 @@
|
||||
$mac_accounting_query = mysql_query("SELECT * FROM `mac_accounting` as A, `interfaces` AS I, `devices` AS D where A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.status = '1'");
|
||||
while ($acc = mysql_fetch_array($mac_accounting_query)) {
|
||||
|
||||
echo("Polling :" . $acc['peer_ip']. " " . $acc['ifDescr']. " " . $acc['hostname'] . " ");
|
||||
echo("Polling :" . $acc['ip']. " " . $acc['ifDescr']. " " . $acc['mac'] . " " . $acc['hostname'] . " ");
|
||||
|
||||
$mac = $acc['mac'];
|
||||
|
||||
$oid = hexdec(substr($mac, 0, 2));
|
||||
$oid .= ".".hexdec(substr($mac, 2, 2));
|
||||
$oid .= ".".hexdec(substr($mac, 4, 2));
|
||||
$oid .= ".".hexdec(substr($mac, 6, 2));
|
||||
$oid .= ".".hexdec(substr($mac, 8, 2));
|
||||
$oid .= ".".hexdec(substr($mac, 10, 2));
|
||||
|
||||
$snmp_cmd = $config['snmpget'] . " -m CISCO-IP-STAT-MIB -O Uqnv -" . $acc['snmpver'] . " -c " . $acc['community'] . " " . $acc['hostname'];
|
||||
$snmp_cmd .= " " . $acc['in_oid'] . " " . $acc['out_oid'];
|
||||
$snmp_cmd .= " cipMacSwitchedBytes.". $acc['ifIndex'] .".input." . $oid;
|
||||
$snmp_cmd .= " cipMacSwitchedBytes.". $acc['ifIndex'] .".output." . $oid;
|
||||
|
||||
$snmp_output = trim(`$snmp_cmd`);
|
||||
$snmp_output = trim(shell_exec($snmp_cmd));
|
||||
|
||||
$snmp_output = preg_replace("[a-zA-Z\ ]", "", $snmp_output);
|
||||
|
||||
list($in,$out) = explode("\n", $snmp_output);
|
||||
|
||||
$acc_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/mac-accounting";
|
||||
|
||||
if(!is_dir($acc_rrd)) { mkdir($acc_rrd); echo("Created directory : $acc_rrd\n"); }
|
||||
$rrdfile = $acc_rrd . "/" . $acc['ifIndex'] . "-" . $acc['peer_ip'] . ".rrd";
|
||||
|
||||
$old_rrdfile = $acc_rrd . "/" . $acc['ifIndex'] . "-" . $acc['ip'] . ".rrd";
|
||||
$rrdfile = $acc_rrd . "/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||
|
||||
if(is_file($old_rrdfile) && !is_file($rrdfile)) { rename($old_rrdfile, $rrdfile); echo("Moved $old_rrdfile -> $rrdfile \n"); };
|
||||
|
||||
|
||||
if(!is_file($rrdfile)) {
|
||||
$woo = shell_exec($config['rrdtool'] ." create $rrdfile \
|
||||
@@ -34,7 +52,7 @@
|
||||
RRA:MAX:0.5:288:797");
|
||||
}
|
||||
|
||||
$woo = "N:$in:$out";
|
||||
$woo = "N:".($in+0).":".($out+0);
|
||||
$ret = rrdtool_update("$rrdfile", $woo);
|
||||
|
||||
$rates = interface_rates ($rrdfile);
|
||||
|
||||
@@ -8,6 +8,9 @@ mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%last
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%Connection from UDP: [%]:%'");
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%Traceback%'");
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%PM-3-INVALID_BRIDGE_PORT%'");
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%RHWatchdog%'");
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%Hardware Monitoring%'");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user