mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
revert r1957 patch
git-svn-id: http://www.observium.org/svn/observer/trunk@1960 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+131
-131
@@ -2,190 +2,190 @@
|
||||
|
||||
function getDates($dayofmonth)
|
||||
{
|
||||
$dayofmonth = zeropad($dayofmonth);
|
||||
list($year, $month) = split('-', date('Y-m'));
|
||||
$dayofmonth = zeropad($dayofmonth);
|
||||
list($year, $month) = split('-', date('Y-m'));
|
||||
|
||||
if (date('d') > $dayofmonth)
|
||||
if (date('d') > $dayofmonth)
|
||||
{
|
||||
$newmonth = $month + 1;
|
||||
if ($newmonth == 13)
|
||||
{
|
||||
$newmonth = $month + 1;
|
||||
if ($newmonth == 13)
|
||||
{
|
||||
$newmonth = 1;
|
||||
$newyear = year + 1;
|
||||
} else {
|
||||
$newyear = $year;
|
||||
}
|
||||
|
||||
$date_from = $year . $month . $dayofmonth;
|
||||
$date_to = $newyear . $newmonth . $dayofmonth;
|
||||
$dt_q = mysql_query("SELECT DATE_SUB(DATE_ADD('$date_from', INTERVAL 1 MONTH), INTERVAL 1 DAY);");
|
||||
$date_to = mysql_result($dt_q,0);
|
||||
$date_to = str_replace("-","",$date_to);
|
||||
}
|
||||
else
|
||||
{
|
||||
$newmonth = $month - 1;
|
||||
if ($newmonth == 0)
|
||||
{
|
||||
$newmonth = 12;
|
||||
$newyear = $year - 1;
|
||||
} else {
|
||||
$newyear = $year;
|
||||
}
|
||||
|
||||
$date_from = $newyear . $newmonth . $dayofmonth;
|
||||
$date_to = $year . $month . $dayofmonth;
|
||||
$dt_q = mysql_query("SELECT DATE_SUB(DATE_ADD('$date_to', INTERVAL 1 MONTH, INTERVAL 1 DAY);");
|
||||
$date_from = mysql_result($dt_q,0);
|
||||
$date_from = str_replace("-","",$date_from);
|
||||
$newmonth = 1;
|
||||
$newyear = year + 1;
|
||||
} else {
|
||||
$newyear = $year;
|
||||
}
|
||||
|
||||
$lq_from = mysql_query("SELECT DATE_SUB('$date_from', INTERVAL 1 MONTH);");
|
||||
$last_from = mysql_result($lq_from,0);
|
||||
$last_from = str_replace("-","",$last_from);
|
||||
$date_from = $year . $month . $dayofmonth;
|
||||
$date_to = $newyear . $newmonth . $dayofmonth;
|
||||
$dt_q = mysql_query("SELECT DATE_SUB(DATE_ADD('$date_from', INTERVAL 1 MONTH), INTERVAL 1 DAY);");
|
||||
$date_to = mysql_result($dt_q,0);
|
||||
$date_to = str_replace("-","",$date_to);
|
||||
}
|
||||
else
|
||||
{
|
||||
$newmonth = $month - 1;
|
||||
if ($newmonth == 0)
|
||||
{
|
||||
$newmonth = 12;
|
||||
$newyear = $year - 1;
|
||||
} else {
|
||||
$newyear = $year;
|
||||
}
|
||||
|
||||
$lq_to = mysql_query("SELECT DATE_SUB('$date_to', INTERVAL 1 MONTH);");
|
||||
$last_to = mysql_result($lq_to,0);
|
||||
$last_to = str_replace("-","",$last_to);
|
||||
$date_from = $newyear . $newmonth . $dayofmonth;
|
||||
$date_to = $year . $month . $dayofmonth;
|
||||
$dt_q = mysql_query("SELECT DATE_SUB(DATE_ADD('$date_to', INTERVAL 1 MONTH, INTERVAL 1 DAY);");
|
||||
$date_from = mysql_result($dt_q,0);
|
||||
$date_from = str_replace("-","",$date_from);
|
||||
}
|
||||
|
||||
$return['0'] = $date_from . "000000";
|
||||
$return['1'] = $date_to . "235959";
|
||||
$return['2'] = $last_from . "000000";
|
||||
$return['3'] = $last_to . "235959";
|
||||
$lq_from = mysql_query("SELECT DATE_SUB('$date_from', INTERVAL 1 MONTH);");
|
||||
$last_from = mysql_result($lq_from,0);
|
||||
$last_from = str_replace("-","",$last_from);
|
||||
|
||||
return($return);
|
||||
$lq_to = mysql_query("SELECT DATE_SUB('$date_to', INTERVAL 1 MONTH);");
|
||||
$last_to = mysql_result($lq_to,0);
|
||||
$last_to = str_replace("-","",$last_to);
|
||||
|
||||
$return['0'] = $date_from . "000000";
|
||||
$return['1'] = $date_to . "235959";
|
||||
$return['2'] = $last_from . "000000";
|
||||
$return['3'] = $last_to . "235959";
|
||||
|
||||
return($return);
|
||||
}
|
||||
|
||||
|
||||
function getValue($host, $port, $id, $inout)
|
||||
{
|
||||
global $config;
|
||||
global $config;
|
||||
|
||||
$oid = "IF-MIB::ifHC" . $inout . "Octets." . $id;
|
||||
$device = mysql_fetch_assoc(mysql_query("SELECT * from `devices` WHERE `hostname` = '" . $host . "' LIMIT 1"));
|
||||
$value = snmp_get($device, $oid, "-O qv");
|
||||
$oid = "IF-MIB::ifHC" . $inout . "Octets." . $id;
|
||||
$device = mysql_fetch_assoc(mysql_query("SELECT * from `devices` WHERE `hostname` = '" . $host . "' LIMIT 1"));
|
||||
$value = snmp_get($device, $oid, "-O qv");
|
||||
|
||||
if (!is_numeric($value))
|
||||
{
|
||||
$oid = "IF-MIB::if" . $inout . "Octets." . $id;
|
||||
$value = snmp_get($device, $oid, "-Oqv");
|
||||
}
|
||||
if (!is_numeric($value))
|
||||
{
|
||||
$oid = "IF-MIB::if" . $inout . "Octets." . $id;
|
||||
$value = snmp_get($device, $oid, "-Oqv");
|
||||
}
|
||||
|
||||
return $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
function getLastPortCounter($port_id,$inout)
|
||||
{
|
||||
$query = mysql_query("SELECT count(counter) from port_" . $inout . "_measurements WHERE port_id=" . $port_id);
|
||||
$rows = mysql_result($query, 0);
|
||||
$query = mysql_query("SELECT count(counter) from port_" . $inout . "_measurements WHERE port_id=" . $port_id);
|
||||
$rows = mysql_result($query, 0);
|
||||
|
||||
if ($rows > 0)
|
||||
{
|
||||
$query = mysql_query("SELECT counter,delta FROM port_" . $inout . "_measurements WHERE port_id=$port_id ORDER BY timestamp DESC");
|
||||
$row = mysql_fetch_row($query);
|
||||
$return[counter] = $row[0];
|
||||
$return[delta] = $row[1];
|
||||
$return[state] = "ok";
|
||||
} else {
|
||||
$return[state] = "failed";
|
||||
}
|
||||
if ($rows > 0)
|
||||
{
|
||||
$query = mysql_query("SELECT counter,delta FROM port_" . $inout . "_measurements WHERE port_id=$port_id ORDER BY timestamp DESC");
|
||||
$row = mysql_fetch_row($query);
|
||||
$return[counter] = $row[0];
|
||||
$return[delta] = $row[1];
|
||||
$return[state] = "ok";
|
||||
} else {
|
||||
$return[state] = "failed";
|
||||
}
|
||||
|
||||
return($return);
|
||||
return($return);
|
||||
}
|
||||
|
||||
function getLastMeasurement($bill_id)
|
||||
{
|
||||
$query = mysql_query("SELECT count(delta) from bill_data WHERE bill_id=" . $bill_id);
|
||||
$rows = mysql_result($query, 0);
|
||||
$query = mysql_query("SELECT count(delta) from bill_data WHERE bill_id=" . $bill_id);
|
||||
$rows = mysql_result($query, 0);
|
||||
|
||||
if ($rows > 0)
|
||||
{
|
||||
$query = mysql_query("SELECT timestamp,delta,in_delta,out_delta FROM bill_data WHERE bill_id=$bill_id ORDER BY timestamp DESC");
|
||||
$row = mysql_fetch_row($query);
|
||||
$return[delta] = $row[1];
|
||||
$return[delta] = $row[2];
|
||||
$return[delta] = $row[3];
|
||||
$return[timestamp] = $row[0];
|
||||
$return[state] = "ok";
|
||||
} else {
|
||||
$return[state] = "failed";
|
||||
}
|
||||
if ($rows > 0)
|
||||
{
|
||||
$query = mysql_query("SELECT timestamp,delta,in_delta,out_delta FROM bill_data WHERE bill_id=$bill_id ORDER BY timestamp DESC");
|
||||
$row = mysql_fetch_row($query);
|
||||
$return[delta] = $row[1];
|
||||
$return[delta] = $row[2];
|
||||
$return[delta] = $row[3];
|
||||
$return[timestamp] = $row[0];
|
||||
$return[state] = "ok";
|
||||
} else {
|
||||
$return[state] = "failed";
|
||||
}
|
||||
|
||||
return($return);
|
||||
return($return);
|
||||
}
|
||||
|
||||
function get95thin($bill_id,$datefrom,$dateto)
|
||||
{
|
||||
$mq_text = "SELECT count(delta) FROM bill_data WHERE bill_id = $bill_id";
|
||||
$mq_text .= " AND timestamp > $datefrom AND timestamp <= $dateto";
|
||||
$m_query = mysql_query($mq_text);
|
||||
$measurements = mysql_result($m_query,0);
|
||||
$measurement_95th = round($measurements /100 * 95) - 1;
|
||||
$mq_text = "SELECT count(delta) FROM bill_data WHERE bill_id = $bill_id";
|
||||
$mq_text .= " AND timestamp > $datefrom AND timestamp <= $dateto";
|
||||
$m_query = mysql_query($mq_text);
|
||||
$measurements = mysql_result($m_query,0);
|
||||
$measurement_95th = round($measurements /100 * 95) - 1;
|
||||
|
||||
$q_95_text = "SELECT (in_delta / period / 1000 * 8) AS rate FROM bill_data WHERE bill_id = $bill_id";
|
||||
$q_95_text .= " AND timestamp > $datefrom AND timestamp <= $dateto ORDER BY in_delta ASC";
|
||||
$q_95th = mysql_query($q_95_text);
|
||||
$m_95th = mysql_result($q_95th,$measurement_95th);
|
||||
$q_95_text = "SELECT (in_delta / period / 1000 * 8) AS rate FROM bill_data WHERE bill_id = $bill_id";
|
||||
$q_95_text .= " AND timestamp > $datefrom AND timestamp <= $dateto ORDER BY in_delta ASC";
|
||||
$q_95th = mysql_query($q_95_text);
|
||||
$m_95th = mysql_result($q_95th,$measurement_95th);
|
||||
|
||||
return(round($m_95th, 2));
|
||||
return(round($m_95th, 2));
|
||||
}
|
||||
|
||||
function get95thout($bill_id,$datefrom,$dateto)
|
||||
{
|
||||
$mq_text = "SELECT count(delta) FROM bill_data WHERE bill_id = $bill_id";
|
||||
$mq_text .= " AND timestamp > $datefrom AND timestamp <= $dateto";
|
||||
$m_query = mysql_query($mq_text);
|
||||
$measurements = mysql_result($m_query,0);
|
||||
$measurement_95th = round($measurements /100 * 95) - 1;
|
||||
$mq_text = "SELECT count(delta) FROM bill_data WHERE bill_id = $bill_id";
|
||||
$mq_text .= " AND timestamp > $datefrom AND timestamp <= $dateto";
|
||||
$m_query = mysql_query($mq_text);
|
||||
$measurements = mysql_result($m_query,0);
|
||||
$measurement_95th = round($measurements /100 * 95) - 1;
|
||||
|
||||
$q_95_text = "SELECT (out_delta / period / 1000 * 8) AS rate FROM bill_data WHERE bill_id = $bill_id";
|
||||
$q_95_text .= " AND timestamp > $datefrom AND timestamp <= $dateto ORDER BY out_delta ASC";
|
||||
$q_95th = mysql_query($q_95_text);
|
||||
$m_95th = mysql_result($q_95th,$measurement_95th);
|
||||
$q_95_text = "SELECT (out_delta / period / 1000 * 8) AS rate FROM bill_data WHERE bill_id = $bill_id";
|
||||
$q_95_text .= " AND timestamp > $datefrom AND timestamp <= $dateto ORDER BY out_delta ASC";
|
||||
$q_95th = mysql_query($q_95_text);
|
||||
$m_95th = mysql_result($q_95th,$measurement_95th);
|
||||
|
||||
return(round($m_95th, 2));
|
||||
return(round($m_95th, 2));
|
||||
}
|
||||
|
||||
function getRates($bill_id,$datefrom,$dateto)
|
||||
{
|
||||
$mq_text = "SELECT count(delta) FROM bill_data ";
|
||||
$mq_text = $mq_text . " WHERE bill_id = $bill_id";
|
||||
$mq_text = $mq_text . " AND timestamp > $datefrom AND timestamp <= $dateto";
|
||||
$m_query = mysql_query($mq_text);
|
||||
$measurements = mysql_result($m_query,0);
|
||||
$measurement_95th = round($measurements /100 * 95) - 1;
|
||||
$mq_text = "SELECT count(delta) FROM bill_data ";
|
||||
$mq_text = $mq_text . " WHERE bill_id = $bill_id";
|
||||
$mq_text = $mq_text . " AND timestamp > $datefrom AND timestamp <= $dateto";
|
||||
$m_query = mysql_query($mq_text);
|
||||
$measurements = mysql_result($m_query,0);
|
||||
$measurement_95th = round($measurements /100 * 95) - 1;
|
||||
|
||||
$q_95_text = "SELECT delta FROM bill_data WHERE bill_id = $bill_id";
|
||||
$q_95_text = $q_95_text . " AND timestamp > $datefrom AND timestamp <= $dateto ORDER BY delta ASC";
|
||||
$q_95th = mysql_query($q_95_text);
|
||||
$m_95th = mysql_result($q_95th,$measurement_95th);
|
||||
$q_95_text = "SELECT delta FROM bill_data WHERE bill_id = $bill_id";
|
||||
$q_95_text = $q_95_text . " AND timestamp > $datefrom AND timestamp <= $dateto ORDER BY delta ASC";
|
||||
$q_95th = mysql_query($q_95_text);
|
||||
$m_95th = mysql_result($q_95th,$measurement_95th);
|
||||
|
||||
$mt_q = mysql_query("SELECT SUM(delta) FROM bill_data WHERE bill_id = '$bill_id' AND timestamp > '$datefrom' AND timestamp <= '$dateto'");
|
||||
$mtot = mysql_result($mt_q,0);
|
||||
$data['rate_95th_in'] = get95thIn($bill_id,$datefrom,$dateto);
|
||||
$data['rate_95th_out'] = get95thOut($bill_id,$datefrom,$dateto);
|
||||
$mt_q = mysql_query("SELECT SUM(delta) FROM bill_data WHERE bill_id = '$bill_id' AND timestamp > '$datefrom' AND timestamp <= '$dateto'");
|
||||
$mtot = mysql_result($mt_q,0);
|
||||
$data['rate_95th_in'] = get95thIn($bill_id,$datefrom,$dateto);
|
||||
$data['rate_95th_out'] = get95thOut($bill_id,$datefrom,$dateto);
|
||||
|
||||
if ($data['rate_95th_out'] > $data['rate_95th_in'])
|
||||
{
|
||||
$data['rate_95th'] = $data['rate_95th_out'];
|
||||
$data['dir_95th'] = 'out';
|
||||
} else {
|
||||
$data['rate_95th'] = $data['rate_95th_in'];
|
||||
$data['dir_95th'] = 'in';
|
||||
}
|
||||
if ($data['rate_95th_out'] > $data['rate_95th_in'])
|
||||
{
|
||||
$data['rate_95th'] = $data['rate_95th_out'];
|
||||
$data['dir_95th'] = 'out';
|
||||
} else {
|
||||
$data['rate_95th'] = $data['rate_95th_in'];
|
||||
$data['dir_95th'] = 'in';
|
||||
}
|
||||
|
||||
$data['total_data'] = round($mtot / 1000 / 1000, 2);
|
||||
$data['rate_average'] = round($mtot / $measurements / 1000 / 300 * 8, 2);
|
||||
$data['total_data'] = round($mtot / 1000 / 1000, 2);
|
||||
$data['rate_average'] = round($mtot / $measurements / 1000 / 300 * 8, 2);
|
||||
|
||||
return($data);
|
||||
return($data);
|
||||
}
|
||||
|
||||
function getTotal($bill_id,$datefrom,$dateto)
|
||||
{
|
||||
$mt_q = mysql_query("SELECT sum(delta) FROM bill_data WHERE bill_id = $bill_id AND timestamp > $datefrom AND timestamp <= $dateto");
|
||||
$mtot = mysql_result($mt_q,0);
|
||||
$mt_q = mysql_query("SELECT sum(delta) FROM bill_data WHERE bill_id = $bill_id AND timestamp > $datefrom AND timestamp <= $dateto");
|
||||
$mtot = mysql_result($mt_q,0);
|
||||
|
||||
return($mtot);
|
||||
return($mtot);
|
||||
}
|
||||
|
||||
$dayofmonth = date("j"); //FIXME is this used anywhere?
|
||||
|
||||
+18
-18
@@ -3,23 +3,23 @@
|
||||
## List of real names for cisco entities
|
||||
|
||||
$entPhysicalVendorTypes = array (
|
||||
'cevC7xxxIo1feTxIsl' => 'C7200-IO-FE-MII',
|
||||
'cevChassis7140Dualfe' => 'C7140-2FE',
|
||||
'cevChassis7204' => "C7204",
|
||||
'cevChassis7204Vxr' => 'C7204VXR',
|
||||
'cevChassis7206' => 'C7206',
|
||||
'cevChassis7206Vxr' => 'C7206VXR',
|
||||
'cevCpu7200Npe200' => 'NPE-200',
|
||||
'cevCpu7200Npe225' => 'NPE-225',
|
||||
'cevCpu7200Npe300' => 'NPE-300',
|
||||
'cevCpu7200Npe400' => 'NPE-400',
|
||||
'cevCpu7200Npeg1' => 'NPE-G1',
|
||||
'cevCpu7200Npeg2' => 'NPE-G2',
|
||||
'cevPa1feTxIsl' => 'PA-FE-TX-ISL',
|
||||
'cevPa2feTxI82543' => 'PA-2FE-TX',
|
||||
'cevPa8e' => 'PA-8E',
|
||||
'cevPaA8tX21' => 'PA-8T-X21',
|
||||
'cevMGBIC1000BaseLX' => '1000BaseLX GBIC',
|
||||
'cevPort10GigBaseLR' => '10GigBaseLR');
|
||||
'cevC7xxxIo1feTxIsl' => 'C7200-IO-FE-MII',
|
||||
'cevChassis7140Dualfe' => 'C7140-2FE',
|
||||
'cevChassis7204' => "C7204",
|
||||
'cevChassis7204Vxr' => 'C7204VXR',
|
||||
'cevChassis7206' => 'C7206',
|
||||
'cevChassis7206Vxr' => 'C7206VXR',
|
||||
'cevCpu7200Npe200' => 'NPE-200',
|
||||
'cevCpu7200Npe225' => 'NPE-225',
|
||||
'cevCpu7200Npe300' => 'NPE-300',
|
||||
'cevCpu7200Npe400' => 'NPE-400',
|
||||
'cevCpu7200Npeg1' => 'NPE-G1',
|
||||
'cevCpu7200Npeg2' => 'NPE-G2',
|
||||
'cevPa1feTxIsl' => 'PA-FE-TX-ISL',
|
||||
'cevPa2feTxI82543' => 'PA-2FE-TX',
|
||||
'cevPa8e' => 'PA-8E',
|
||||
'cevPaA8tX21' => 'PA-8T-X21',
|
||||
'cevMGBIC1000BaseLX' => '1000BaseLX GBIC',
|
||||
'cevPort10GigBaseLR' => '10GigBaseLR');
|
||||
|
||||
?>
|
||||
|
||||
+95
-96
@@ -1,186 +1,185 @@
|
||||
<?php
|
||||
|
||||
|
||||
## Common Functions
|
||||
|
||||
function get_port_by_id($port_id)
|
||||
{
|
||||
if (is_numeric($port_id))
|
||||
{
|
||||
$port = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '".$port_id."'"));
|
||||
}
|
||||
if (is_array($port))
|
||||
{
|
||||
return $port;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
if (is_numeric($port_id))
|
||||
{
|
||||
$port = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '".$port_id."'"));
|
||||
}
|
||||
if (is_array($port))
|
||||
{
|
||||
return $port;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function get_application_by_id($application_id)
|
||||
{
|
||||
if (is_numeric($application_id))
|
||||
{
|
||||
$application = mysql_fetch_assoc(mysql_query("SELECT * FROM `applications` WHERE `app_id` = '".$application_id."'"));
|
||||
}
|
||||
if (is_array($application))
|
||||
{
|
||||
return $application;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
if (is_numeric($application_id))
|
||||
{
|
||||
$application = mysql_fetch_assoc(mysql_query("SELECT * FROM `applications` WHERE `app_id` = '".$application_id."'"));
|
||||
}
|
||||
if (is_array($application))
|
||||
{
|
||||
return $application;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function get_sensor_by_id($sensor_id)
|
||||
{
|
||||
if (is_numeric($sensor_id))
|
||||
{
|
||||
$sensor = mysql_fetch_assoc(mysql_query("SELECT * FROM `sensors` WHERE `sensor_id` = '".$sensor_id."'"));
|
||||
}
|
||||
if (is_array($sensor))
|
||||
{
|
||||
return $sensor;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
if (is_numeric($sensor_id))
|
||||
{
|
||||
$sensor = mysql_fetch_assoc(mysql_query("SELECT * FROM `sensors` WHERE `sensor_id` = '".$sensor_id."'"));
|
||||
}
|
||||
if (is_array($sensor))
|
||||
{
|
||||
return $sensor;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function get_device_id_by_interface_id($interface_id)
|
||||
{
|
||||
if (is_numeric($interface_id))
|
||||
{
|
||||
$device_id = mysql_result(mysql_query("SELECT `device_id` FROM `ports` WHERE `interface_id` = '".$interface_id."'"),0);
|
||||
}
|
||||
if (is_numeric($device_id))
|
||||
{
|
||||
return $device_id;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
if (is_numeric($interface_id))
|
||||
{
|
||||
$device_id = mysql_result(mysql_query("SELECT `device_id` FROM `ports` WHERE `interface_id` = '".$interface_id."'"),0);
|
||||
}
|
||||
if (is_numeric($device_id))
|
||||
{
|
||||
return $device_id;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function ifclass($ifOperStatus, $ifAdminStatus)
|
||||
{
|
||||
$ifclass = "interface-upup";
|
||||
$ifclass = "interface-upup";
|
||||
|
||||
if ($ifAdminStatus == "down") { $ifclass = "interface-admindown"; }
|
||||
if ($ifAdminStatus == "up" && $ifOperStatus== "down") { $ifclass = "interface-updown"; }
|
||||
if ($ifAdminStatus == "up" && $ifOperStatus== "up") { $ifclass = "interface-upup"; }
|
||||
if ($ifAdminStatus == "down") { $ifclass = "interface-admindown"; }
|
||||
if ($ifAdminStatus == "up" && $ifOperStatus== "down") { $ifclass = "interface-updown"; }
|
||||
if ($ifAdminStatus == "up" && $ifOperStatus== "up") { $ifclass = "interface-upup"; }
|
||||
|
||||
return $ifclass;
|
||||
return $ifclass;
|
||||
}
|
||||
|
||||
function device_by_id_cache($device_id)
|
||||
{
|
||||
global $device_cache;
|
||||
global $device_cache;
|
||||
|
||||
if (is_array($device_cache[$device_id]))
|
||||
{
|
||||
$device = $device_cache[$device_id];
|
||||
} else {
|
||||
$device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device_id."'"));
|
||||
$device_cache[$device_id] = $device;
|
||||
}
|
||||
if (is_array($device_cache[$device_id]))
|
||||
{
|
||||
$device = $device_cache[$device_id];
|
||||
} else {
|
||||
$device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device_id."'"));
|
||||
$device_cache[$device_id] = $device;
|
||||
}
|
||||
|
||||
return $device;
|
||||
return $device;
|
||||
}
|
||||
|
||||
function truncate($substring, $max = 50, $rep = '...')
|
||||
{
|
||||
if (strlen($substring) < 1){ $string = $rep; } else { $string = $substring; }
|
||||
$leave = $max - strlen ($rep);
|
||||
if (strlen($string) > $max){ return substr_replace($string, $rep, $leave); } else { return $string; }
|
||||
if (strlen($substring) < 1){ $string = $rep; } else { $string = $substring; }
|
||||
$leave = $max - strlen ($rep);
|
||||
if (strlen($string) > $max){ return substr_replace($string, $rep, $leave); } else { return $string; }
|
||||
}
|
||||
|
||||
function mres($string)
|
||||
{ // short function wrapper because the real one is stupidly long and ugly. aestetics.
|
||||
return mysql_real_escape_string($string);
|
||||
return mysql_real_escape_string($string);
|
||||
}
|
||||
|
||||
function getifhost($id)
|
||||
{
|
||||
$sql = mysql_query("SELECT `device_id` from `ports` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
$sql = mysql_query("SELECT `device_id` from `ports` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function gethostbyid($id)
|
||||
{
|
||||
$sql = mysql_query("SELECT `hostname` FROM `devices` WHERE `device_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
$sql = mysql_query("SELECT `hostname` FROM `devices` WHERE `device_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function strgen ($length = 16)
|
||||
{
|
||||
$entropy = array(0,1,2,3,4,5,6,7,8,9,'a','A','b','B','c','C','d','D','e',
|
||||
'E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n',
|
||||
'N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w',
|
||||
'W','x','X','y','Y','z','Z');
|
||||
$string = "";
|
||||
$entropy = array(0,1,2,3,4,5,6,7,8,9,'a','A','b','B','c','C','d','D','e',
|
||||
'E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n',
|
||||
'N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w',
|
||||
'W','x','X','y','Y','z','Z');
|
||||
$string = "";
|
||||
|
||||
for ($i=0; $i<$length; $i++)
|
||||
{
|
||||
$key = mt_rand(0,61);
|
||||
$string .= $entropy[$key];
|
||||
}
|
||||
for ($i=0; $i<$length; $i++)
|
||||
{
|
||||
$key = mt_rand(0,61);
|
||||
$string .= $entropy[$key];
|
||||
}
|
||||
|
||||
return $string;
|
||||
return $string;
|
||||
}
|
||||
|
||||
function getpeerhost($id)
|
||||
{
|
||||
$sql = mysql_query("SELECT `device_id` from `bgpPeers` WHERE `bgpPeer_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
$sql = mysql_query("SELECT `device_id` from `bgpPeers` WHERE `bgpPeer_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getifindexbyid($id)
|
||||
{
|
||||
$sql = mysql_query("SELECT `ifIndex` FROM `ports` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
$sql = mysql_query("SELECT `ifIndex` FROM `ports` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getifbyid($id)
|
||||
{
|
||||
$sql = mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_fetch_array($sql);
|
||||
$sql = mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_fetch_array($sql);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getifdescrbyid($id)
|
||||
{
|
||||
$sql = mysql_query("SELECT `ifDescr` FROM `ports` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
$sql = mysql_query("SELECT `ifDescr` FROM `ports` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getidbyname($domain)
|
||||
{
|
||||
$sql = mysql_query("SELECT `device_id` FROM `devices` WHERE `hostname` = '$domain'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
$sql = mysql_query("SELECT `device_id` FROM `devices` WHERE `hostname` = '$domain'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function gethostosbyid($id)
|
||||
{
|
||||
$sql = mysql_query("SELECT `os` FROM `devices` WHERE `device_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
$sql = mysql_query("SELECT `os` FROM `devices` WHERE `device_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function safename($name)
|
||||
{
|
||||
return preg_replace('/[^a-zA-Z0-9,._\-]/', '_', $name);
|
||||
return preg_replace('/[^a-zA-Z0-9,._\-]/', '_', $name);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
+11
-11
@@ -31,7 +31,7 @@ $config['ipmitool'] = "/usr/bin/ipmitool";
|
||||
|
||||
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["SERVER_PORT"]))
|
||||
{
|
||||
$config['base_url'] = "http://" . $_SERVER["SERVER_NAME"] .":".$_SERVER["SERVER_PORT"];
|
||||
$config['base_url'] = "http://" . $_SERVER["SERVER_NAME"] .":".$_SERVER["SERVER_PORT"];
|
||||
}
|
||||
$config['title_image'] = "images/observium-logo.png";
|
||||
$config['stylesheet'] = "css/styles.css";
|
||||
@@ -155,10 +155,10 @@ $config['rancid_ignorecomments'] = 0; # Ignore lines starting with #
|
||||
### Ignores & Allows
|
||||
|
||||
$config['bad_if'] = array("voip-null", "virtual-", "unrouted", "eobc", "mpls", "sl0", "lp0", "faith0",
|
||||
"-atm layer", "-atm subif", "-shdsl", "-aal5", "-atm", "container",
|
||||
"async", "plip", "-physical", "-signalling", "container", "unrouted",
|
||||
"bri", "-bearer", "bluetooth", "isatap", "ras", "qos", "miniport", "sonet/sdh",
|
||||
"span rp", "span sp", "sslvpn");
|
||||
"-atm layer", "-atm subif", "-shdsl", "-aal5", "-atm", "container",
|
||||
"async", "plip", "-physical", "-signalling", "container", "unrouted",
|
||||
"bri", "-bearer", "bluetooth", "isatap", "ras", "qos", "miniport", "sonet/sdh",
|
||||
"span rp", "span sp", "sslvpn");
|
||||
|
||||
$config['bad_if_regexp'] = array("/serial[0-9]:/");
|
||||
|
||||
@@ -195,9 +195,9 @@ $config['ignore_mount'] = array("/kern", "/mnt/cdrom", "/proc", "/dev");
|
||||
$config['ignore_mount_string'] = array("packages", "devfs", "procfs", "UMA", "MALLOC");
|
||||
|
||||
$config['ignore_mount_regexp'] = array("/on: \/packages/", "/on: \/dev/", "/on: \/proc/", "/on: \/junos^/", ## JunOS Drives
|
||||
"/on: \/junos\/dev/", "/on: \/jail\/dev/", "/^(dev|proc)fs/", "/^\/dev\/md0/", ## JunOS Drives
|
||||
"/^\/var\/dhcpd\/dev,/", "/UMA/" ## BSD Drives
|
||||
);
|
||||
"/on: \/junos\/dev/", "/on: \/jail\/dev/", "/^(dev|proc)fs/", "/^\/dev\/md0/", ## JunOS Drives
|
||||
"/^\/var\/dhcpd\/dev,/", "/UMA/" ## BSD Drives
|
||||
);
|
||||
|
||||
$config['ignore_mount_removable'] = 1; # Ignore removable disk storage
|
||||
$config['ignore_mount_network'] = 1; # Ignore network mounted storage
|
||||
@@ -206,8 +206,8 @@ $config['ignore_mount_network'] = 1; # Ignore network mounted storage
|
||||
|
||||
$config['syslog_age'] = "1 month"; ## Entries older than this will be removed
|
||||
$config['syslog_filter'] = array("last message repeated", "Connection from UDP: [",
|
||||
"ipSystemStatsTable node ipSystemStatsOutFragOKs not implemented",
|
||||
"diskio.c: don't know how to handle"); ## Ignore some crappy stuff from SNMP daemon
|
||||
"ipSystemStatsTable node ipSystemStatsOutFragOKs not implemented",
|
||||
"diskio.c: don't know how to handle"); ## Ignore some crappy stuff from SNMP daemon
|
||||
|
||||
### LDAP Authentication
|
||||
|
||||
@@ -224,4 +224,4 @@ $config['astext'][65333] = "Cymru Bogon Feed";
|
||||
### What should we warn about?
|
||||
$config['warn']['ifdown'] = false;
|
||||
|
||||
?>
|
||||
?>
|
||||
+483
-483
File diff suppressed because it is too large
Load Diff
@@ -6,20 +6,20 @@ $app_data = mysql_query($sql);
|
||||
|
||||
if (mysql_affected_rows())
|
||||
{
|
||||
echo('Applications: ');
|
||||
while ($app = mysql_fetch_array($app_data))
|
||||
echo('Applications: ');
|
||||
while ($app = mysql_fetch_array($app_data))
|
||||
{
|
||||
$app_include = $config['install_dir'].'/includes/polling/applications/'.$app['app_type'].'.inc.php';
|
||||
if (is_file($app_include))
|
||||
{
|
||||
$app_include = $config['install_dir'].'/includes/polling/applications/'.$app['app_type'].'.inc.php';
|
||||
if (is_file($app_include))
|
||||
{
|
||||
include($app_include);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo($app['app_type'].' include missing! ');
|
||||
}
|
||||
include($app_include);
|
||||
}
|
||||
echo("\n");
|
||||
else
|
||||
{
|
||||
echo($app['app_type'].' include missing! ');
|
||||
}
|
||||
}
|
||||
echo("\n");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
+219
-219
@@ -4,240 +4,240 @@ echo("Polling BGP peers\n");
|
||||
|
||||
if (!$config['enable_bgp'])
|
||||
{
|
||||
echo("BGP Support Disabled\n");
|
||||
echo("BGP Support Disabled\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
$peers = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '" . $device['device_id'] . "'");
|
||||
while ($peer = mysql_fetch_array($peers))
|
||||
$peers = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '" . $device['device_id'] . "'");
|
||||
while ($peer = mysql_fetch_array($peers))
|
||||
{
|
||||
### Poll BGP Peer
|
||||
|
||||
echo("Checking ".$peer['bgpPeerIdentifier']." ");
|
||||
|
||||
if (!strstr($peer['bgpPeerIdentifier'],':'))
|
||||
{
|
||||
### Poll BGP Peer
|
||||
# v4 BGP4 MIB
|
||||
## FIXME - needs moved to function
|
||||
$peer_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m BGP4-MIB -OUvq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
$peer_cmd .= "bgpPeerState." . $peer['bgpPeerIdentifier'] . " bgpPeerAdminStatus." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerOutUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerInTotalMessages." . $peer['bgpPeerIdentifier'] . " ";
|
||||
$peer_cmd .= "bgpPeerOutTotalMessages." . $peer['bgpPeerIdentifier'] . " bgpPeerFsmEstablishedTime." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdateElapsedTime." . $peer['bgpPeerIdentifier'] . " ";
|
||||
$peer_cmd .= "bgpPeerLocalAddr." . $peer['bgpPeerIdentifier'] . "";
|
||||
$peer_data = trim(`$peer_cmd`);
|
||||
list($bgpPeerState, $bgpPeerAdminStatus, $bgpPeerInUpdates, $bgpPeerOutUpdates, $bgpPeerInTotalMessages, $bgpPeerOutTotalMessages, $bgpPeerFsmEstablishedTime, $bgpPeerInUpdateElapsedTime, $bgpLocalAddr) = explode("\n", $peer_data);
|
||||
}
|
||||
else
|
||||
if ($device['os'] == "junos")
|
||||
{
|
||||
# v6 for JunOS via Juniper MIB
|
||||
$peer_ip = ipv62snmp($peer['bgpPeerIdentifier']);
|
||||
|
||||
echo("Checking ".$peer['bgpPeerIdentifier']." ");
|
||||
|
||||
if (!strstr($peer['bgpPeerIdentifier'],':'))
|
||||
if (!isset($junos_v6))
|
||||
{
|
||||
echo("\nCaching Oids...");
|
||||
## FIXME - needs moved to function
|
||||
$peer_cmd = $config['snmpwalk'] . " -M ".$config['mibdir'] . "/junos -m BGP4-V2-MIB-JUNIPER -OUnq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$peer_cmd .= " jnxBgpM2PeerStatus.0.ipv6";
|
||||
foreach (explode("\n",trim(`$peer_cmd`)) as $oid)
|
||||
{
|
||||
# v4 BGP4 MIB
|
||||
## FIXME - needs moved to function
|
||||
$peer_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m BGP4-MIB -OUvq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
$peer_cmd .= "bgpPeerState." . $peer['bgpPeerIdentifier'] . " bgpPeerAdminStatus." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerOutUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerInTotalMessages." . $peer['bgpPeerIdentifier'] . " ";
|
||||
$peer_cmd .= "bgpPeerOutTotalMessages." . $peer['bgpPeerIdentifier'] . " bgpPeerFsmEstablishedTime." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdateElapsedTime." . $peer['bgpPeerIdentifier'] . " ";
|
||||
$peer_cmd .= "bgpPeerLocalAddr." . $peer['bgpPeerIdentifier'] . "";
|
||||
$peer_data = trim(`$peer_cmd`);
|
||||
list($bgpPeerState, $bgpPeerAdminStatus, $bgpPeerInUpdates, $bgpPeerOutUpdates, $bgpPeerInTotalMessages, $bgpPeerOutTotalMessages, $bgpPeerFsmEstablishedTime, $bgpPeerInUpdateElapsedTime, $bgpLocalAddr) = explode("\n", $peer_data);
|
||||
list($peer_oid) = split(' ',$oid);
|
||||
$peer_id = explode('.',$peer_oid);
|
||||
$junos_v6[implode('.',array_slice($peer_id,35))] = implode('.',array_slice($peer_id,18));
|
||||
}
|
||||
else
|
||||
if ($device['os'] == "junos")
|
||||
}
|
||||
|
||||
## FIXME - move to function (and clean up, wtf?)
|
||||
$peer_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . "/junos -m BGP4-V2-MIB-JUNIPER -OUvq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$peer_cmd .= " jnxBgpM2PeerState.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerStatus.0.ipv6." . $junos_v6[$peer_ip]; # Should be jnxBgpM2CfgPeerAdminStatus but doesn't seem to be implemented?
|
||||
$peer_cmd .= " jnxBgpM2PeerInUpdates.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerOutUpdates.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerInTotalMessages.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerOutTotalMessages.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerFsmEstablishedTime.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerInUpdatesElapsedTime.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerLocalAddr.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= ' -M"' . $config['install_dir'] . '/mibs/junos"|grep -v "No Such Instance"';
|
||||
if ($debug) echo("\n$peer_cmd\n");
|
||||
$peer_data = trim(`$peer_cmd`);
|
||||
list($bgpPeerState, $bgpPeerAdminStatus, $bgpPeerInUpdates, $bgpPeerOutUpdates, $bgpPeerInTotalMessages, $bgpPeerOutTotalMessages, $bgpPeerFsmEstablishedTime, $bgpPeerInUpdateElapsedTime, $bgpLocalAddr) = explode("\n", $peer_data);
|
||||
|
||||
if ($debug) { echo("State = $bgpPeerState - AdminStatus: $bgpPeerAdminStatus\n"); }
|
||||
|
||||
$bgpLocalAddr = str_replace('"','',str_replace(' ','',$bgpLocalAddr));
|
||||
if ($bgpLocalAddr == "00000000000000000000000000000000")
|
||||
{
|
||||
$bgpLocalAddr = ''; # Unknown?
|
||||
}
|
||||
else
|
||||
{
|
||||
$bgpLocalAddr = strtolower($bgpLocalAddr);
|
||||
for ($i = 0;$i < 32;$i+=4)
|
||||
{
|
||||
$bgpLocalAddr6[] = substr($bgpLocalAddr,$i,4);
|
||||
}
|
||||
$bgpLocalAddr = Net_IPv6::compress(implode(':',$bgpLocalAddr6)); unset($bgpLocalAddr6);
|
||||
}
|
||||
}
|
||||
|
||||
if ($bgpPeerFsmEstablishedTime)
|
||||
{
|
||||
if ($bgpPeerFsmEstablishedTime < $peer['bgpPeerFsmEstablishedTime'] || $bgpPeerState != $peer['bgpPeerState'])
|
||||
{
|
||||
if ($peer['bgpPeerState'] == $bgpPeerState)
|
||||
{
|
||||
notify($device, "BGP Session flapped: " . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ' - ' . $peer['astext'] . ')', "BGP Session flapped " . formatUptime($bgpPeerFsmEstablishedTime) . " ago.\n\nHostname : " . $device['hostname'] . "\nPeer IP : " . $peer['bgpPeerIdentifier'] . "\nRemote AS: " . $peer['bgpPeerRemoteAs'] . ' ('.$peer['astext'].')');
|
||||
log_event('BGP Session Flap: ' . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ')', $device['device_id'], 'bgpPeer', $bgpPeer_id);
|
||||
}
|
||||
else if ($bgpPeerState == "established")
|
||||
{
|
||||
notify($device, "BGP Session up: " . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ' - ' . $peer['astext'] . ')', "BGP Session up since " . formatUptime($bgpPeerFsmEstablishedTime) . ".\n\nHostname : " . $device['hostname'] . "\nPeer IP : " . $peer['bgpPeerIdentifier'] . "\nRemote AS: " . $peer['bgpPeerRemoteAs'] . ' ('.$peer['astext'].')');
|
||||
log_event('BGP Session Up: ' . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ')', $device['device_id'], 'bgpPeer', $bgpPeer_id);
|
||||
}
|
||||
else if ($peer['bgpPeerState'] == "established")
|
||||
{
|
||||
notify($device, "BGP Session down: " . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ' - ' . $peer['astext'] . ')', "BGP Session down since " . formatUptime($bgpPeerFsmEstablishedTime) . ".\n\nHostname : " . $device['hostname'] . "\nPeer IP : " . $peer['bgpPeerIdentifier'] . "\nRemote AS: " . $peer['bgpPeerRemoteAs'] . ' ('.$peer['astext'].')');
|
||||
log_event('BGP Session Down: ' . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ')', $device['device_id'], 'bgpPeer', $bgpPeer_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$peerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("bgp-" . $peer['bgpPeerIdentifier'] . ".rrd");
|
||||
if (!is_file($peerrrd))
|
||||
{
|
||||
$create_rrd = "DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 \
|
||||
DS:bgpPeerInUpdates:COUNTER:600:U:100000000000 \
|
||||
DS:bgpPeerOutTotal:COUNTER:600:U:100000000000 \
|
||||
DS:bgpPeerInTotal:COUNTER:600:U:100000000000 \
|
||||
DS:bgpPeerEstablished:GAUGE:600:0:U \
|
||||
RRA:AVERAGE:0.5:1:600 \
|
||||
RRA:AVERAGE:0.5:6:700 \
|
||||
RRA:AVERAGE:0.5:24:775 \
|
||||
RRA:AVERAGE:0.5:288:797 \
|
||||
RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 \
|
||||
RRA:MAX:0.5:24:775 \
|
||||
RRA:MAX:0.5:288:797";
|
||||
|
||||
rrdtool_create($peerrrd, $create_rrd);
|
||||
}
|
||||
|
||||
rrdtool_update("$peerrrd", "N:$bgpPeerOutUpdates:$bgpPeerInUpdates:$bgpPeerOutTotalMessages:$bgpPeerInTotalMesages:$bgpPeerFsmEstablishedTime");
|
||||
|
||||
$update = "UPDATE bgpPeers SET bgpPeerState = '$bgpPeerState', bgpPeerAdminStatus = '$bgpPeerAdminStatus', ";
|
||||
$update .= "bgpPeerFsmEstablishedTime = '$bgpPeerFsmEstablishedTime', bgpPeerInUpdates = '$bgpPeerInUpdates' , bgpLocalAddr = '$bgpLocalAddr' , bgpPeerOutUpdates = '$bgpPeerOutUpdates'";
|
||||
$update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'";
|
||||
mysql_query($update);
|
||||
|
||||
if ($device['os_group'] == "ios" || $device['os'] == "junos")
|
||||
{
|
||||
## Poll each AFI/SAFI for this peer (using CISCO-BGP4-MIB or BGP4-V2-JUNIPER MIB)
|
||||
$afi_query = mysql_query("SELECT * FROM bgpPeers_cbgp WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'");
|
||||
while ($peer_afi = mysql_fetch_assoc($afi_query))
|
||||
{
|
||||
$afi = $peer_afi['afi'];
|
||||
$safi = $peer_afi['safi'];
|
||||
if ($debug) { echo("$afi $safi". $config['afi'][$afi][$safi]. "\n"); }
|
||||
|
||||
if ($device['os_group'] == "ios")
|
||||
{
|
||||
## FIXME - move to function
|
||||
$cbgp_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m CISCO-BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$cbgp_cmd .= " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerDeniedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixAdminLimit." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixClearThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerAdvertisedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerSuppressedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerWithdrawnPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
|
||||
if ($debug) { echo("$cbgp_cmd\n"); }
|
||||
$cbgp_data = preg_replace("/^OID.*$/", "", trim(`$cbgp_cmd`));
|
||||
if ($debug) { echo("$cbgp_data\n"); }
|
||||
list($cbgpPeerAcceptedPrefixes,$cbgpPeerDeniedPrefixes,$cbgpPeerPrefixAdminLimit,$cbgpPeerPrefixThreshold,$cbgpPeerPrefixClearThreshold,$cbgpPeerAdvertisedPrefixes,$cbgpPeerSuppressedPrefixes,$cbgpPeerWithdrawnPrefixes) = explode("\n", $cbgp_data);
|
||||
}
|
||||
|
||||
if ($device['os'] == "junos")
|
||||
{
|
||||
# Missing: cbgpPeerAdminLimit cbgpPeerPrefixThreshold cbgpPeerPrefixClearThreshold cbgpPeerSuppressedPrefixes cbgpPeerWithdrawnPrefixes
|
||||
|
||||
$safis['unicast'] = 1;
|
||||
$safis['multicast'] = 2;
|
||||
|
||||
if (!isset($peerIndexes))
|
||||
{
|
||||
$j_bgp = snmpwalk_cache_multi_oid($device, "jnxBgpM2PeerTable", $jbgp, "BGP4-V2-MIB-JUNIPER", $config['install_dir']."/mibs/junos");
|
||||
foreach ($j_bgp as $index => $entry)
|
||||
{
|
||||
# v6 for JunOS via Juniper MIB
|
||||
$peer_ip = ipv62snmp($peer['bgpPeerIdentifier']);
|
||||
|
||||
if (!isset($junos_v6))
|
||||
{
|
||||
echo("\nCaching Oids...");
|
||||
## FIXME - needs moved to function
|
||||
$peer_cmd = $config['snmpwalk'] . " -M ".$config['mibdir'] . "/junos -m BGP4-V2-MIB-JUNIPER -OUnq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$peer_cmd .= " jnxBgpM2PeerStatus.0.ipv6";
|
||||
foreach (explode("\n",trim(`$peer_cmd`)) as $oid)
|
||||
{
|
||||
list($peer_oid) = split(' ',$oid);
|
||||
$peer_id = explode('.',$peer_oid);
|
||||
$junos_v6[implode('.',array_slice($peer_id,35))] = implode('.',array_slice($peer_id,18));
|
||||
}
|
||||
}
|
||||
|
||||
## FIXME - move to function (and clean up, wtf?)
|
||||
$peer_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . "/junos -m BGP4-V2-MIB-JUNIPER -OUvq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$peer_cmd .= " jnxBgpM2PeerState.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerStatus.0.ipv6." . $junos_v6[$peer_ip]; # Should be jnxBgpM2CfgPeerAdminStatus but doesn't seem to be implemented?
|
||||
$peer_cmd .= " jnxBgpM2PeerInUpdates.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerOutUpdates.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerInTotalMessages.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerOutTotalMessages.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerFsmEstablishedTime.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerInUpdatesElapsedTime.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= " jnxBgpM2PeerLocalAddr.0.ipv6." . $junos_v6[$peer_ip];
|
||||
$peer_cmd .= ' -M"' . $config['install_dir'] . '/mibs/junos"|grep -v "No Such Instance"';
|
||||
if ($debug) echo("\n$peer_cmd\n");
|
||||
$peer_data = trim(`$peer_cmd`);
|
||||
list($bgpPeerState, $bgpPeerAdminStatus, $bgpPeerInUpdates, $bgpPeerOutUpdates, $bgpPeerInTotalMessages, $bgpPeerOutTotalMessages, $bgpPeerFsmEstablishedTime, $bgpPeerInUpdateElapsedTime, $bgpLocalAddr) = explode("\n", $peer_data);
|
||||
|
||||
if ($debug) { echo("State = $bgpPeerState - AdminStatus: $bgpPeerAdminStatus\n"); }
|
||||
|
||||
$bgpLocalAddr = str_replace('"','',str_replace(' ','',$bgpLocalAddr));
|
||||
if ($bgpLocalAddr == "00000000000000000000000000000000")
|
||||
{
|
||||
$bgpLocalAddr = ''; # Unknown?
|
||||
}
|
||||
else
|
||||
{
|
||||
$bgpLocalAddr = strtolower($bgpLocalAddr);
|
||||
for ($i = 0;$i < 32;$i+=4)
|
||||
{
|
||||
$bgpLocalAddr6[] = substr($bgpLocalAddr,$i,4);
|
||||
}
|
||||
$bgpLocalAddr = Net_IPv6::compress(implode(':',$bgpLocalAddr6)); unset($bgpLocalAddr6);
|
||||
}
|
||||
switch ($entry['jnxBgpM2PeerRemoteAddrType'])
|
||||
{
|
||||
case 'ipv4':
|
||||
$ip = long2ip(hexdec($entry['jnxBgpM2PeerRemoteAddr']));
|
||||
$j_peerIndexes[$ip] = $entry['jnxBgpM2PeerIndex'];
|
||||
break;
|
||||
case 'ipv6':
|
||||
$ip6 = trim(str_replace(' ','',$entry['jnxBgpM2PeerRemoteAddr']),'"');
|
||||
$ip6 = substr($ip6,0,4) . ':' . substr($ip6,4,4) . ':' . substr($ip6,8,4) . ':' . substr($ip6,12,4) . ':' . substr($ip6,16,4) . ':' . substr($ip6,20,4) . ':' . substr($ip6,24,4) . ':' . substr($ip6,28,4);
|
||||
$ip6 = Net_IPv6::compress($ip6);
|
||||
$j_peerIndexes[$ip6] = $entry['jnxBgpM2PeerIndex'];
|
||||
break;
|
||||
default:
|
||||
echo("PANIC: Don't know RemoteAddrType " . $entry['jnxBgpM2PeerRemoteAddrType'] . "!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($bgpPeerFsmEstablishedTime)
|
||||
{
|
||||
if ($bgpPeerFsmEstablishedTime < $peer['bgpPeerFsmEstablishedTime'] || $bgpPeerState != $peer['bgpPeerState'])
|
||||
{
|
||||
if ($peer['bgpPeerState'] == $bgpPeerState)
|
||||
{
|
||||
notify($device, "BGP Session flapped: " . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ' - ' . $peer['astext'] . ')', "BGP Session flapped " . formatUptime($bgpPeerFsmEstablishedTime) . " ago.\n\nHostname : " . $device['hostname'] . "\nPeer IP : " . $peer['bgpPeerIdentifier'] . "\nRemote AS: " . $peer['bgpPeerRemoteAs'] . ' ('.$peer['astext'].')');
|
||||
log_event('BGP Session Flap: ' . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ')', $device['device_id'], 'bgpPeer', $bgpPeer_id);
|
||||
}
|
||||
else if ($bgpPeerState == "established")
|
||||
{
|
||||
notify($device, "BGP Session up: " . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ' - ' . $peer['astext'] . ')', "BGP Session up since " . formatUptime($bgpPeerFsmEstablishedTime) . ".\n\nHostname : " . $device['hostname'] . "\nPeer IP : " . $peer['bgpPeerIdentifier'] . "\nRemote AS: " . $peer['bgpPeerRemoteAs'] . ' ('.$peer['astext'].')');
|
||||
log_event('BGP Session Up: ' . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ')', $device['device_id'], 'bgpPeer', $bgpPeer_id);
|
||||
}
|
||||
else if ($peer['bgpPeerState'] == "established")
|
||||
{
|
||||
notify($device, "BGP Session down: " . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ' - ' . $peer['astext'] . ')', "BGP Session down since " . formatUptime($bgpPeerFsmEstablishedTime) . ".\n\nHostname : " . $device['hostname'] . "\nPeer IP : " . $peer['bgpPeerIdentifier'] . "\nRemote AS: " . $peer['bgpPeerRemoteAs'] . ' ('.$peer['astext'].')');
|
||||
log_event('BGP Session Down: ' . $peer['bgpPeerIdentifier'] . ' (AS' . $peer['bgpPeerRemoteAs'] . ')', $device['device_id'], 'bgpPeer', $bgpPeer_id);
|
||||
}
|
||||
}
|
||||
$j_prefixes = snmpwalk_cache_multi_oid($device, "jnxBgpM2PrefixCountersTable", $jbgp, "BGP4-V2-MIB-JUNIPER", $config['install_dir']."/mibs/junos");
|
||||
|
||||
$cbgpPeerAcceptedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi." . $safis[$safi]]['jnxBgpM2PrefixInPrefixesAccepted'];
|
||||
$cbgpPeerDeniedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi." . $safis[$safi]]['jnxBgpM2PrefixInPrefixesRejected'];
|
||||
$cbgpPeerAdvertisedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi." . $safis[$safi]]['jnxBgpM2PrefixOutPrefixes'];
|
||||
|
||||
unset($j_prefixes);
|
||||
unset($j_bgp);
|
||||
unset($j_peerIndexes);
|
||||
}
|
||||
|
||||
$peerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("bgp-" . $peer['bgpPeerIdentifier'] . ".rrd");
|
||||
if (!is_file($peerrrd))
|
||||
{
|
||||
$create_rrd = "DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 \
|
||||
DS:bgpPeerInUpdates:COUNTER:600:U:100000000000 \
|
||||
DS:bgpPeerOutTotal:COUNTER:600:U:100000000000 \
|
||||
DS:bgpPeerInTotal:COUNTER:600:U:100000000000 \
|
||||
DS:bgpPeerEstablished:GAUGE:600:0:U \
|
||||
RRA:AVERAGE:0.5:1:600 \
|
||||
RRA:AVERAGE:0.5:6:700 \
|
||||
RRA:AVERAGE:0.5:24:775 \
|
||||
RRA:AVERAGE:0.5:288:797 \
|
||||
RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 \
|
||||
RRA:MAX:0.5:24:775 \
|
||||
RRA:MAX:0.5:288:797";
|
||||
|
||||
rrdtool_create($peerrrd, $create_rrd);
|
||||
}
|
||||
|
||||
rrdtool_update("$peerrrd", "N:$bgpPeerOutUpdates:$bgpPeerInUpdates:$bgpPeerOutTotalMessages:$bgpPeerInTotalMesages:$bgpPeerFsmEstablishedTime");
|
||||
|
||||
$update = "UPDATE bgpPeers SET bgpPeerState = '$bgpPeerState', bgpPeerAdminStatus = '$bgpPeerAdminStatus', ";
|
||||
$update .= "bgpPeerFsmEstablishedTime = '$bgpPeerFsmEstablishedTime', bgpPeerInUpdates = '$bgpPeerInUpdates' , bgpLocalAddr = '$bgpLocalAddr' , bgpPeerOutUpdates = '$bgpPeerOutUpdates'";
|
||||
$update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'";
|
||||
# FIXME THESE FIELDS DO NOT EXIST IN THE DATABASE!
|
||||
$update = "UPDATE bgpPeers_cbgp SET";
|
||||
$update .= " `cbgpPeerAcceptedPrefixes` = '$cbgpPeerAcceptedPrefixes'";
|
||||
$update .= ", `cbgpPeerDeniedPrefixes` = '$cbgpPeerDeniedPrefixes'";
|
||||
$update .= ", `cbgpPeerPrefixAdminLimit` = '$cbgpPeerAdminLimit'";
|
||||
$update .= ", `cbgpPeerPrefixThreshold` = '$cbgpPeerPrefixThreshold'";
|
||||
$update .= ", `cbgpPeerPrefixClearThreshold` = '$cbgpPeerPrefixClearThreshold'";
|
||||
$update .= ", `cbgpPeerAdvertisedPrefixes` = '$cbgpPeerAdvertisedPrefixes'";
|
||||
$update .= ", `cbgpPeerSuppressedPrefixes` = '$cbgpPeerSuppressedPrefixes'";
|
||||
$update .= ", `cbgpPeerWithdrawnPrefixes` = '$cbgpPeerWithdrawnPrefixes'";
|
||||
$update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "' AND afi = '$afi' AND safi = '$safi'";
|
||||
if ($debug) { echo("MYSQL: $update\n"); }
|
||||
mysql_query($update);
|
||||
|
||||
if ($device['os_group'] == "ios" || $device['os'] == "junos")
|
||||
$cbgp_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cbgp-" . $peer['bgpPeerIdentifier'] . ".$afi.$safi.rrd");
|
||||
if (!is_file($cbgp_rrd))
|
||||
{
|
||||
## Poll each AFI/SAFI for this peer (using CISCO-BGP4-MIB or BGP4-V2-JUNIPER MIB)
|
||||
$afi_query = mysql_query("SELECT * FROM bgpPeers_cbgp WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'");
|
||||
while ($peer_afi = mysql_fetch_assoc($afi_query))
|
||||
{
|
||||
$afi = $peer_afi['afi'];
|
||||
$safi = $peer_afi['safi'];
|
||||
if ($debug) { echo("$afi $safi". $config['afi'][$afi][$safi]. "\n"); }
|
||||
$rrd_create = "DS:AcceptedPrefixes:GAUGE:600:U:100000000000 \
|
||||
DS:DeniedPrefixes:GAUGE:600:U:100000000000 \
|
||||
DS:AdvertisedPrefixes:GAUGE:600:U:100000000000 \
|
||||
DS:SuppressedPrefixes:GAUGE:600:U:100000000000 \
|
||||
DS:WithdrawnPrefixes:GAUGE:600:U:100000000000 \
|
||||
RRA:AVERAGE:0.5:1:600 \
|
||||
RRA:AVERAGE:0.5:6:700 \
|
||||
RRA:AVERAGE:0.5:24:775 \
|
||||
RRA:AVERAGE:0.5:288:797 \
|
||||
RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 \
|
||||
RRA:MAX:0.5:24:775 \
|
||||
RRA:MAX:0.5:288:797";
|
||||
rrdtool_create($cbgp_rrd, $rrd_create);
|
||||
}
|
||||
rrdtool_update("$cbgp_rrd", "N:$cbgpPeerAcceptedPrefixes:$cbgpPeerDeniedPrefixes:$cbgpPeerAdvertisedPrefixes:$cbgpPeerSuppressedPrefixes:$cbgpPeerWithdrawnPrefixes");
|
||||
} # while
|
||||
} # os=ios | junos
|
||||
echo("\n");
|
||||
|
||||
if ($device['os_group'] == "ios")
|
||||
{
|
||||
## FIXME - move to function
|
||||
$cbgp_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m CISCO-BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$cbgp_cmd .= " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerDeniedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixAdminLimit." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixClearThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerAdvertisedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerSuppressedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerWithdrawnPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
|
||||
if ($debug) { echo("$cbgp_cmd\n"); }
|
||||
$cbgp_data = preg_replace("/^OID.*$/", "", trim(`$cbgp_cmd`));
|
||||
if ($debug) { echo("$cbgp_data\n"); }
|
||||
list($cbgpPeerAcceptedPrefixes,$cbgpPeerDeniedPrefixes,$cbgpPeerPrefixAdminLimit,$cbgpPeerPrefixThreshold,$cbgpPeerPrefixClearThreshold,$cbgpPeerAdvertisedPrefixes,$cbgpPeerSuppressedPrefixes,$cbgpPeerWithdrawnPrefixes) = explode("\n", $cbgp_data);
|
||||
}
|
||||
|
||||
if ($device['os'] == "junos")
|
||||
{
|
||||
# Missing: cbgpPeerAdminLimit cbgpPeerPrefixThreshold cbgpPeerPrefixClearThreshold cbgpPeerSuppressedPrefixes cbgpPeerWithdrawnPrefixes
|
||||
|
||||
$safis['unicast'] = 1;
|
||||
$safis['multicast'] = 2;
|
||||
|
||||
if (!isset($peerIndexes))
|
||||
{
|
||||
$j_bgp = snmpwalk_cache_multi_oid($device, "jnxBgpM2PeerTable", $jbgp, "BGP4-V2-MIB-JUNIPER", $config['install_dir']."/mibs/junos");
|
||||
foreach ($j_bgp as $index => $entry)
|
||||
{
|
||||
switch ($entry['jnxBgpM2PeerRemoteAddrType'])
|
||||
{
|
||||
case 'ipv4':
|
||||
$ip = long2ip(hexdec($entry['jnxBgpM2PeerRemoteAddr']));
|
||||
$j_peerIndexes[$ip] = $entry['jnxBgpM2PeerIndex'];
|
||||
break;
|
||||
case 'ipv6':
|
||||
$ip6 = trim(str_replace(' ','',$entry['jnxBgpM2PeerRemoteAddr']),'"');
|
||||
$ip6 = substr($ip6,0,4) . ':' . substr($ip6,4,4) . ':' . substr($ip6,8,4) . ':' . substr($ip6,12,4) . ':' . substr($ip6,16,4) . ':' . substr($ip6,20,4) . ':' . substr($ip6,24,4) . ':' . substr($ip6,28,4);
|
||||
$ip6 = Net_IPv6::compress($ip6);
|
||||
$j_peerIndexes[$ip6] = $entry['jnxBgpM2PeerIndex'];
|
||||
break;
|
||||
default:
|
||||
echo("PANIC: Don't know RemoteAddrType " . $entry['jnxBgpM2PeerRemoteAddrType'] . "!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$j_prefixes = snmpwalk_cache_multi_oid($device, "jnxBgpM2PrefixCountersTable", $jbgp, "BGP4-V2-MIB-JUNIPER", $config['install_dir']."/mibs/junos");
|
||||
|
||||
$cbgpPeerAcceptedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi." . $safis[$safi]]['jnxBgpM2PrefixInPrefixesAccepted'];
|
||||
$cbgpPeerDeniedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi." . $safis[$safi]]['jnxBgpM2PrefixInPrefixesRejected'];
|
||||
$cbgpPeerAdvertisedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi." . $safis[$safi]]['jnxBgpM2PrefixOutPrefixes'];
|
||||
|
||||
unset($j_prefixes);
|
||||
unset($j_bgp);
|
||||
unset($j_peerIndexes);
|
||||
}
|
||||
|
||||
# FIXME THESE FIELDS DO NOT EXIST IN THE DATABASE!
|
||||
$update = "UPDATE bgpPeers_cbgp SET";
|
||||
$update .= " `cbgpPeerAcceptedPrefixes` = '$cbgpPeerAcceptedPrefixes'";
|
||||
$update .= ", `cbgpPeerDeniedPrefixes` = '$cbgpPeerDeniedPrefixes'";
|
||||
$update .= ", `cbgpPeerPrefixAdminLimit` = '$cbgpPeerAdminLimit'";
|
||||
$update .= ", `cbgpPeerPrefixThreshold` = '$cbgpPeerPrefixThreshold'";
|
||||
$update .= ", `cbgpPeerPrefixClearThreshold` = '$cbgpPeerPrefixClearThreshold'";
|
||||
$update .= ", `cbgpPeerAdvertisedPrefixes` = '$cbgpPeerAdvertisedPrefixes'";
|
||||
$update .= ", `cbgpPeerSuppressedPrefixes` = '$cbgpPeerSuppressedPrefixes'";
|
||||
$update .= ", `cbgpPeerWithdrawnPrefixes` = '$cbgpPeerWithdrawnPrefixes'";
|
||||
$update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "' AND afi = '$afi' AND safi = '$safi'";
|
||||
if ($debug) { echo("MYSQL: $update\n"); }
|
||||
mysql_query($update);
|
||||
|
||||
$cbgp_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cbgp-" . $peer['bgpPeerIdentifier'] . ".$afi.$safi.rrd");
|
||||
if (!is_file($cbgp_rrd))
|
||||
{
|
||||
$rrd_create = "DS:AcceptedPrefixes:GAUGE:600:U:100000000000 \
|
||||
DS:DeniedPrefixes:GAUGE:600:U:100000000000 \
|
||||
DS:AdvertisedPrefixes:GAUGE:600:U:100000000000 \
|
||||
DS:SuppressedPrefixes:GAUGE:600:U:100000000000 \
|
||||
DS:WithdrawnPrefixes:GAUGE:600:U:100000000000 \
|
||||
RRA:AVERAGE:0.5:1:600 \
|
||||
RRA:AVERAGE:0.5:6:700 \
|
||||
RRA:AVERAGE:0.5:24:775 \
|
||||
RRA:AVERAGE:0.5:288:797 \
|
||||
RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 \
|
||||
RRA:MAX:0.5:24:775 \
|
||||
RRA:MAX:0.5:288:797";
|
||||
rrdtool_create($cbgp_rrd, $rrd_create);
|
||||
}
|
||||
rrdtool_update("$cbgp_rrd", "N:$cbgpPeerAcceptedPrefixes:$cbgpPeerDeniedPrefixes:$cbgpPeerAdvertisedPrefixes:$cbgpPeerSuppressedPrefixes:$cbgpPeerWithdrawnPrefixes");
|
||||
} # while
|
||||
} # os=ios | junos
|
||||
echo("\n");
|
||||
|
||||
} ## End While loop on peers
|
||||
} ## End While loop on peers
|
||||
} ## End check for BGP support
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -2,55 +2,55 @@
|
||||
|
||||
if ($device['os'] != "Snom")
|
||||
{
|
||||
echo(" ICMP");
|
||||
echo(" ICMP");
|
||||
|
||||
#### Below have more oids, and are in trees by themselves, so we can snmpwalk_cache_oid them
|
||||
#### Below have more oids, and are in trees by themselves, so we can snmpwalk_cache_oid them
|
||||
|
||||
$oids = array('icmpInMsgs','icmpOutMsgs','icmpInErrors','icmpOutErrors','icmpInEchos','icmpOutEchos','icmpInEchoReps',
|
||||
'icmpOutEchoReps','icmpInDestUnreachs','icmpOutDestUnreachs','icmpInParmProbs','icmpInTimeExcds',
|
||||
'icmpInSrcQuenchs','icmpInRedirects','icmpInTimestamps','icmpInTimestampReps','icmpInAddrMasks',
|
||||
'icmpInAddrMaskReps','icmpOutTimeExcds','icmpOutParmProbs','icmpOutSrcQuenchs','icmpOutRedirects',
|
||||
'icmpOutTimestamps','icmpOutTimestampReps','icmpOutAddrMasks','icmpOutAddrMaskReps');
|
||||
$oids = array('icmpInMsgs','icmpOutMsgs','icmpInErrors','icmpOutErrors','icmpInEchos','icmpOutEchos','icmpInEchoReps',
|
||||
'icmpOutEchoReps','icmpInDestUnreachs','icmpOutDestUnreachs','icmpInParmProbs','icmpInTimeExcds',
|
||||
'icmpInSrcQuenchs','icmpInRedirects','icmpInTimestamps','icmpInTimestampReps','icmpInAddrMasks',
|
||||
'icmpInAddrMaskReps','icmpOutTimeExcds','icmpOutParmProbs','icmpOutSrcQuenchs','icmpOutRedirects',
|
||||
'icmpOutTimestamps','icmpOutTimestampReps','icmpOutAddrMasks','icmpOutAddrMaskReps');
|
||||
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-icmp.rrd";
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-icmp.rrd";
|
||||
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
|
||||
$snmpstring .= " $oid.0";
|
||||
}
|
||||
|
||||
$data_array = snmpwalk_cache_oid($device, "icmp", array());
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data_array[0][$oid]))
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
|
||||
$snmpstring .= " $oid.0";
|
||||
$value = $data_array[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
$data_array = snmpwalk_cache_oid($device, "icmp", array());
|
||||
unset($snmpstring);
|
||||
|
||||
$rrdupdate = "N";
|
||||
if (isset($data_array[0]['icmpInMsgs']) && isset($data_array[0]['icmpOutMsgs']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_icmp'] = TRUE;
|
||||
$graphs['netstat_icmp_info'] = TRUE;
|
||||
}
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data_array[0][$oid]))
|
||||
{
|
||||
$value = $data_array[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
unset($snmpstring);
|
||||
|
||||
if (isset($data_array[0]['icmpInMsgs']) && isset($data_array[0]['icmpOutMsgs']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_icmp'] = TRUE;
|
||||
$graphs['netstat_icmp_info'] = TRUE;
|
||||
}
|
||||
|
||||
unset($oids, $data, $data_array, $oid, $protos);
|
||||
unset($oids, $data, $data_array, $oid, $protos);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -2,52 +2,52 @@
|
||||
|
||||
if ($device['os'] != "Snom")
|
||||
{
|
||||
echo(" IP");
|
||||
echo(" IP");
|
||||
|
||||
#### These are at the start of large trees that we don't want to walk the entirety of, so we snmp_get_multi them
|
||||
#### These are at the start of large trees that we don't want to walk the entirety of, so we snmp_get_multi them
|
||||
|
||||
$oids = array ('ipForwDatagrams','ipInDelivers','ipInReceives','ipOutRequests','ipInDiscards','ipOutDiscards','ipOutNoRoutes',
|
||||
'ipReasmReqds','ipReasmOKs','ipReasmFails','ipFragOKs','ipFragFails','ipFragCreates', 'ipInUnknownProtos',
|
||||
'ipInHdrErrors', 'ipInAddrErrors');
|
||||
$oids = array ('ipForwDatagrams','ipInDelivers','ipInReceives','ipOutRequests','ipInDiscards','ipOutDiscards','ipOutNoRoutes',
|
||||
'ipReasmReqds','ipReasmOKs','ipReasmFails','ipFragOKs','ipFragFails','ipFragCreates', 'ipInUnknownProtos',
|
||||
'ipInHdrErrors', 'ipInAddrErrors');
|
||||
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-ip.rrd";
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-ip.rrd";
|
||||
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
|
||||
$snmpstring .= " $oid.0";
|
||||
}
|
||||
|
||||
$data = snmp_get_multi($device, $snmpstring);
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data[0][$oid]))
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
|
||||
$snmpstring .= " $oid.0";
|
||||
$value = $data[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
$data = snmp_get_multi($device, $snmpstring);
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data[0][$oid]))
|
||||
{
|
||||
$value = $data[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
if (isset($data[0]['ipOutRequests']) && isset($data[0]['ipInReceives']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_ip'] = TRUE;
|
||||
$graphs['netstat_ip_frag'] = TRUE;
|
||||
}
|
||||
if (isset($data[0]['ipOutRequests']) && isset($data[0]['ipInReceives']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_ip'] = TRUE;
|
||||
$graphs['netstat_ip_frag'] = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
unset($oids, $data, $data_array, $oid);
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -2,51 +2,51 @@
|
||||
|
||||
if ($device['os'] != "Snom")
|
||||
{
|
||||
echo(" SNMP");
|
||||
echo(" SNMP");
|
||||
|
||||
#### Below have more oids, and are in trees by themselves, so we can snmpwalk_cache_oid them
|
||||
#### Below have more oids, and are in trees by themselves, so we can snmpwalk_cache_oid them
|
||||
|
||||
$oids = array ('snmpInPkts','snmpOutPkts','snmpInBadVersions','snmpInBadCommunityNames','snmpInBadCommunityUses','snmpInASNParseErrs',
|
||||
'snmpInTooBigs','snmpInNoSuchNames','snmpInBadValues','snmpInReadOnlys','snmpInGenErrs','snmpInTotalReqVars','snmpInTotalSetVars',
|
||||
'snmpInGetRequests','snmpInGetNexts','snmpInSetRequests','snmpInGetResponses','snmpInTraps','snmpOutTooBigs','snmpOutNoSuchNames',
|
||||
'snmpOutBadValues','snmpOutGenErrs','snmpOutGetRequests','snmpOutGetNexts','snmpOutSetRequests','snmpOutGetResponses','snmpOutTraps','snmpSilentDrops','snmpProxyDrops');
|
||||
$oids = array ('snmpInPkts','snmpOutPkts','snmpInBadVersions','snmpInBadCommunityNames','snmpInBadCommunityUses','snmpInASNParseErrs',
|
||||
'snmpInTooBigs','snmpInNoSuchNames','snmpInBadValues','snmpInReadOnlys','snmpInGenErrs','snmpInTotalReqVars','snmpInTotalSetVars',
|
||||
'snmpInGetRequests','snmpInGetNexts','snmpInSetRequests','snmpInGetResponses','snmpInTraps','snmpOutTooBigs','snmpOutNoSuchNames',
|
||||
'snmpOutBadValues','snmpOutGenErrs','snmpOutGetRequests','snmpOutGetNexts','snmpOutSetRequests','snmpOutGetResponses','snmpOutTraps','snmpSilentDrops','snmpProxyDrops');
|
||||
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("netstats-snmp.rrd");
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("netstats-snmp.rrd");
|
||||
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
|
||||
}
|
||||
|
||||
$data_array = snmpwalk_cache_oid($device, "snmp", array());
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data_array[0][$oid]))
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
|
||||
$value = $data_array[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
$data_array = snmpwalk_cache_oid($device, "snmp", array());
|
||||
if (isset($data_array[0]['snmpInPkts']) && isset($data_array[0]['snmpOutPkts']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_snmp'] = TRUE;
|
||||
$graphs['netstat_snmp_pkt'] = TRUE;
|
||||
}
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data_array[0][$oid]))
|
||||
{
|
||||
$value = $data_array[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
if (isset($data_array[0]['snmpInPkts']) && isset($data_array[0]['snmpOutPkts']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_snmp'] = TRUE;
|
||||
$graphs['netstat_snmp_pkt'] = TRUE;
|
||||
}
|
||||
|
||||
unset($oids, $data, $data_array, $oid, $protos);
|
||||
unset($oids, $data, $data_array, $oid, $protos);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -2,56 +2,56 @@
|
||||
|
||||
if ($device['os'] != "Snom")
|
||||
{
|
||||
echo(" TCP");
|
||||
echo(" TCP");
|
||||
|
||||
$oids = array ('tcpActiveOpens', 'tcpPassiveOpens', 'tcpAttemptFails', 'tcpEstabResets', 'tcpCurrEstab',
|
||||
'tcpInSegs', 'tcpOutSegs', 'tcpRetransSegs', 'tcpInErrs', 'tcpOutRsts');
|
||||
$oids = array ('tcpActiveOpens', 'tcpPassiveOpens', 'tcpAttemptFails', 'tcpEstabResets', 'tcpCurrEstab',
|
||||
'tcpInSegs', 'tcpOutSegs', 'tcpRetransSegs', 'tcpInErrs', 'tcpOutRsts');
|
||||
|
||||
# $oids['tcp_collect'] = $oids['tcp'];
|
||||
# $oids['tcp_collect'][] = 'tcpHCInSegs';
|
||||
# $oids['tcp_collect'][] = 'tcpHCOutSegs';
|
||||
# $oids['tcp_collect'] = $oids['tcp'];
|
||||
# $oids['tcp_collect'][] = 'tcpHCInSegs';
|
||||
# $oids['tcp_collect'][] = 'tcpHCOutSegs';
|
||||
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-tcp.rrd";
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-tcp.rrd";
|
||||
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:10000000"; ## Limit to 10MPPS
|
||||
$snmpstring .= " $oid.0";
|
||||
}
|
||||
|
||||
$snmpstring .= " tcpHCInSegs.0";
|
||||
$snmpstring .= " tcpHCOutSegs.0";
|
||||
|
||||
$data = snmp_get_multi($device, $snmpstring);
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data[0][$oid]))
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:10000000"; ## Limit to 10MPPS
|
||||
$snmpstring .= " $oid.0";
|
||||
$value = $data[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
$snmpstring .= " tcpHCInSegs.0";
|
||||
$snmpstring .= " tcpHCOutSegs.0";
|
||||
unset($snmpstring);
|
||||
|
||||
$data = snmp_get_multi($device, $snmpstring);
|
||||
if (isset($data[0]['tcpInSegs']) && isset($data[0]['tcpOutSegs']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_tcp'] = TRUE;
|
||||
}
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data[0][$oid]))
|
||||
{
|
||||
$value = $data[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
unset($snmpstring);
|
||||
|
||||
if (isset($data[0]['tcpInSegs']) && isset($data[0]['tcpOutSegs']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_tcp'] = TRUE;
|
||||
}
|
||||
|
||||
unset($oids, $data, $data_array, $oid, $protos);
|
||||
unset($oids, $data, $data_array, $oid, $protos);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -3,48 +3,48 @@
|
||||
if ($device['os'] != "Snom")
|
||||
{
|
||||
|
||||
echo(" UDP");
|
||||
echo(" UDP");
|
||||
|
||||
#### These are at the start of large trees that we don't want to walk the entirety of, so we snmpget_multi them
|
||||
#### These are at the start of large trees that we don't want to walk the entirety of, so we snmpget_multi them
|
||||
|
||||
$oids = array ('udpInDatagrams','udpOutDatagrams','udpInErrors','udpNoPorts');
|
||||
$oids = array ('udpInDatagrams','udpOutDatagrams','udpInErrors','udpNoPorts');
|
||||
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-udp.rrd";
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-udp.rrd";
|
||||
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:1000000"; ## Limit to 1MPPS?
|
||||
$snmpstring .= " $oid.0";
|
||||
}
|
||||
|
||||
$data = snmp_get_multi($device, $snmpstring);
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data[0][$oid]))
|
||||
{
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:1000000"; ## Limit to 1MPPS?
|
||||
$snmpstring .= " $oid.0";
|
||||
$value = $data[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
$data = snmp_get_multi($device, $snmpstring);
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($data[0][$oid]))
|
||||
{
|
||||
$value = $data[0][$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
if (isset($data[0]['udpInDatagrams']) && isset($data[0]['udpOutDatagrams']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_udp'] = TRUE;
|
||||
}
|
||||
if (isset($data[0]['udpInDatagrams']) && isset($data[0]['udpOutDatagrams']))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
$graphs['netstat_udp'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
unset($oids, $data, $data_array, $oid, $protos, $snmpstring);
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
echo("Polling Netstats:");
|
||||
echo("Polling Netstats:");
|
||||
|
||||
include("netstats-ip.inc.php");
|
||||
include("netstats-tcp.inc.php");
|
||||
include("netstats-udp.inc.php");
|
||||
include("netstats-icmp.inc.php");
|
||||
include("netstats-snmp.inc.php");
|
||||
include("netstats-ip.inc.php");
|
||||
include("netstats-tcp.inc.php");
|
||||
include("netstats-udp.inc.php");
|
||||
include("netstats-icmp.inc.php");
|
||||
include("netstats-snmp.inc.php");
|
||||
|
||||
echo("\n");
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
|
||||
+243
-243
@@ -7,25 +7,25 @@ $ports = snmp_cache_ifIndex($device); // Cache Port List
|
||||
|
||||
// Build SNMP Cache Array
|
||||
$data_oids = array('ifName','ifDescr','ifAlias', 'ifAdminStatus', 'ifOperStatus', 'ifMtu', 'ifSpeed', 'ifHighSpeed', 'ifType', 'ifPhysAddress',
|
||||
'ifPromiscuousMode','ifConnectorPresent','ifDuplex');
|
||||
'ifPromiscuousMode','ifConnectorPresent','ifDuplex');
|
||||
|
||||
$stat_oids = array('ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInNUcastPkts', 'ifOutNUcastPkts',
|
||||
'ifHCInMulticastPkts', 'ifHCInBroadcastPkts', 'ifHCOutMulticastPkts', 'ifHCOutBroadcastPkts',
|
||||
'ifInOctets', 'ifOutOctets', 'ifHCInOctets', 'ifHCOutOctets', 'ifInDiscards', 'ifOutDiscards', 'ifInUnknownProtos',
|
||||
'ifInBroadcastPkts', 'ifOutBroadcastPkts', 'ifInMulticastPkts', 'ifOutMulticastPkts');
|
||||
'ifHCInMulticastPkts', 'ifHCInBroadcastPkts', 'ifHCOutMulticastPkts', 'ifHCOutBroadcastPkts',
|
||||
'ifInOctets', 'ifOutOctets', 'ifHCInOctets', 'ifHCOutOctets', 'ifInDiscards', 'ifOutDiscards', 'ifInUnknownProtos',
|
||||
'ifInBroadcastPkts', 'ifOutBroadcastPkts', 'ifInMulticastPkts', 'ifOutMulticastPkts');
|
||||
|
||||
$stat_oids_db = array('ifInOctets', 'ifOutOctets', 'ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts'); // From above for DB
|
||||
|
||||
$etherlike_oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames',
|
||||
'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions',
|
||||
'dot3StatsInternalMacTransmitErrors', 'dot3StatsCarrierSenseErrors', 'dot3StatsFrameTooLongs', 'dot3StatsInternalMacReceiveErrors',
|
||||
'dot3StatsSymbolErrors');
|
||||
'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions',
|
||||
'dot3StatsInternalMacTransmitErrors', 'dot3StatsCarrierSenseErrors', 'dot3StatsFrameTooLongs', 'dot3StatsInternalMacReceiveErrors',
|
||||
'dot3StatsSymbolErrors');
|
||||
|
||||
$cisco_oids = array('locIfHardType', 'locIfInRunts', 'locIfInGiants', 'locIfInCRC', 'locIfInFrame', 'locIfInOverrun', 'locIfInIgnored', 'locIfInAbort',
|
||||
'locIfCollisions', 'locIfInputQueueDrops', 'locIfOutputQueueDrops');
|
||||
'locIfCollisions', 'locIfInputQueueDrops', 'locIfOutputQueueDrops');
|
||||
|
||||
$pagp_oids = array('pagpOperationMode', 'pagpPortState', 'pagpPartnerDeviceId', 'pagpPartnerLearnMethod', 'pagpPartnerIfIndex', 'pagpPartnerGroupIfIndex',
|
||||
'pagpPartnerDeviceName', 'pagpEthcOperationMode', 'pagpDeviceId', 'pagpGroupIfIndex');
|
||||
'pagpPartnerDeviceName', 'pagpEthcOperationMode', 'pagpDeviceId', 'pagpGroupIfIndex');
|
||||
|
||||
$ifmib_oids = array_merge($data_oids, $stat_oids);
|
||||
|
||||
@@ -36,39 +36,39 @@ foreach ($ifmib_oids as $oid) { echo("$oid "); $port_stats = snmpwalk_cache_oid(
|
||||
|
||||
if ($config['enable_ports_etherlike'])
|
||||
{
|
||||
echo("dot3Stats "); $port_stats = snmpwalk_cache_oid($device, "dot3StatsEntry", $port_stats, "EtherLike-MIB");
|
||||
echo("dot3Stats "); $port_stats = snmpwalk_cache_oid($device, "dot3StatsEntry", $port_stats, "EtherLike-MIB");
|
||||
} else {
|
||||
echo("dot3StatsDuplexStatus"); $port_stats = snmpwalk_cache_oid($device, "dot3StatsDuplexStatus", $port_stats, "EtherLike-MIB");
|
||||
echo("dot3StatsDuplexStatus"); $port_stats = snmpwalk_cache_oid($device, "dot3StatsDuplexStatus", $port_stats, "EtherLike-MIB");
|
||||
}
|
||||
|
||||
if ($config['enable_ports_adsl'])
|
||||
{
|
||||
$device['adsl_count'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifType` = 'adsl'"),0);
|
||||
$device['adsl_count'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifType` = 'adsl'"),0);
|
||||
}
|
||||
|
||||
if ($device['adsl_count'] > "0")
|
||||
{
|
||||
echo("ADSL ");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.1.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.2.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.3.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.4.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.5.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.2", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.3", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.4", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.5", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.6", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.7", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.8", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.2", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.3", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.4", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.5", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.6", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.7", $port_stats, "ADSL-LINE-MIB");
|
||||
echo("ADSL ");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.1.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.2.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.3.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.4.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.5.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.2", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.3", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.4", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.5", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.6", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.7", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.8", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.1", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.2", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.3", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.4", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.5", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.6", $port_stats, "ADSL-LINE-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.7", $port_stats, "ADSL-LINE-MIB");
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
@@ -79,12 +79,12 @@ echo("\n");
|
||||
|
||||
if ($device['os_group'] == "ios")
|
||||
{
|
||||
$port_stats = snmp_cache_portIfIndex ($device, $port_stats);
|
||||
$port_stats = snmp_cache_portName ($device, $port_stats);
|
||||
$data_oids[] = "portName";
|
||||
#$port_stats = snmpwalk_cache_oid($device, "vmVlan", $port_stats, "CISCO-VLAN-MEMBERSHIP-MIB");
|
||||
#$port_stats = snmpwalk_cache_oid($device, "vlanTrunkPortEncapsulationOperType", $port_stats, "CISCO-VTP-MIB");
|
||||
#$port_stats = snmpwalk_cache_oid($device, "vlanTrunkPortNativeVlan", $port_stats, "CISCO-VTP-MIB");
|
||||
$port_stats = snmp_cache_portIfIndex ($device, $port_stats);
|
||||
$port_stats = snmp_cache_portName ($device, $port_stats);
|
||||
$data_oids[] = "portName";
|
||||
#$port_stats = snmpwalk_cache_oid($device, "vmVlan", $port_stats, "CISCO-VLAN-MEMBERSHIP-MIB");
|
||||
#$port_stats = snmpwalk_cache_oid($device, "vlanTrunkPortEncapsulationOperType", $port_stats, "CISCO-VTP-MIB");
|
||||
#$port_stats = snmpwalk_cache_oid($device, "vlanTrunkPortNativeVlan", $port_stats, "CISCO-VTP-MIB");
|
||||
}
|
||||
|
||||
$polled = time();
|
||||
@@ -101,218 +101,218 @@ if ($debug) { print_r($port_stats); }
|
||||
$port_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `deleted` = 0");
|
||||
while ($port = mysql_fetch_array($port_query))
|
||||
{
|
||||
echo("Port " . $port['ifDescr'] . " ");
|
||||
if ($port_stats[$port['ifIndex']] && $port['disabled'] != "1")
|
||||
{ // Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
echo("Port " . $port['ifDescr'] . " ");
|
||||
if ($port_stats[$port['ifIndex']] && $port['disabled'] != "1")
|
||||
{ // Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
|
||||
$polled_period = $polled - $port['poll_time'];
|
||||
$polled_period = $polled - $port['poll_time'];
|
||||
|
||||
$update .= "`poll_time` = '".$polled."'";
|
||||
$update .= ", `poll_prev` = '".$port['poll_time']."'";
|
||||
$update .= ", `poll_period` = '".$polled_period."'";
|
||||
$update .= "`poll_time` = '".$polled."'";
|
||||
$update .= ", `poll_prev` = '".$port['poll_time']."'";
|
||||
$update .= ", `poll_period` = '".$polled_period."'";
|
||||
|
||||
#echo("\n32bit - In: ".$this_port['ifInOctets']." Out: ".$this_port['ifOutOctets']);
|
||||
#echo("\n64bit - In: ".$this_port['ifHCInOctets']." Out: ".$this_port['ifHCOutOctets']."\n");
|
||||
#echo("\n32bit - In: ".$this_port['ifInOctets']." Out: ".$this_port['ifOutOctets']);
|
||||
#echo("\n64bit - In: ".$this_port['ifHCInOctets']." Out: ".$this_port['ifHCOutOctets']."\n");
|
||||
|
||||
### Copy ifHC[In|Out]Octets values to non-HC if they exist
|
||||
if ($this_port['ifHCInOctets'] > 0 && is_numeric($this_port['ifHCInOctets']) && $this_port['ifHCOutOctets'] > 0 && is_numeric($this_port['ifHCOutOctets']))
|
||||
{
|
||||
echo("HC ");
|
||||
$this_port['ifInOctets'] = $this_port['ifHCInOctets'];
|
||||
$this_port['ifOutOctets'] = $this_port['ifHCOutOctets'];
|
||||
}
|
||||
|
||||
if (is_numeric($this_port['ifHCInBroadcastPkts']) && is_numeric($this_port['ifHCOutBroadcastPkts']) && is_numeric($this_port['ifHCInMulticastPkts']) && is_numeric($this_port['ifHCOutMulticastPkts']))
|
||||
{
|
||||
echo("HC ");
|
||||
$this_port['ifInBroadcastPkts'] = $this_port['ifHCInBroadcastPkts'];
|
||||
$this_port['ifOutBroadcastPkts'] = $this_port['ifHCOutBroadcastPkts'];
|
||||
$this_port['ifInMulticastPkts'] = $this_port['ifHCInMulticastPkts'];
|
||||
$this_port['ifOutMulticastPkts'] = $this_port['ifHCOutMulticastPkts'];
|
||||
}
|
||||
|
||||
### Overwrite ifSpeed with ifHighSpeed if it's over 10G
|
||||
if (is_numeric($this_port['ifHighSpeed']) && $this_port['ifSpeed'] > "1000000000")
|
||||
{
|
||||
echo("HighSpeed ");
|
||||
$this_port['ifSpeed'] = $this_port['ifHighSpeed'] * 1000000;
|
||||
}
|
||||
|
||||
### Overwrite ifDuplex with dot3StatsDuplexStatus if it exists
|
||||
if (isset($this_port['dot3StatsDuplexStatus']))
|
||||
{
|
||||
echo("dot3Duplex ");
|
||||
$this_port['ifDuplex'] = $this_port['dot3StatsDuplexStatus'];
|
||||
}
|
||||
|
||||
### Update IF-MIB data
|
||||
foreach ($data_oids as $oid)
|
||||
{
|
||||
if ($port[$oid] != $this_port[$oid] && !isset($this_port[$oid]))
|
||||
{
|
||||
$update .= ", `$oid` = NULL";
|
||||
log_event($oid . ": ".$port[$oid]." -> NULL", $device['device_id'], 'interface', $port['interface_id']);
|
||||
if ($debug) { echo($oid . ": ".$port[$oid]." -> NULL "); } else { echo($oid . " "); }
|
||||
} elseif ($port[$oid] != $this_port[$oid] ) {
|
||||
$update .= ", `$oid` = '".mres($this_port[$oid])."'";
|
||||
log_event($oid . ": ".$port[$oid]." -> " . $this_port[$oid], $device['device_id'], 'interface', $port['interface_id']);
|
||||
if ($debug) { echo($oid . ": ".$port[$oid]." -> " . $this_port[$oid]." "); } else { echo($oid . " "); }
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse description (usually ifAlias) if config option set
|
||||
|
||||
if (isset($config['port_descr_parser']) && is_file($config['install_dir'] . "/" . $config['port_descr_parser']))
|
||||
{
|
||||
$port_attribs = array('type','descr','circuit','speed','notes');
|
||||
include($config['install_dir'] . "/" . $config['port_descr_parser']);
|
||||
|
||||
foreach ($port_attribs as $attrib)
|
||||
{
|
||||
$attrib_key = "port_descr_".$attrib;
|
||||
if ($port_ifAlias[$attrib] != $port[$attrib_key])
|
||||
{
|
||||
$update .= ", `".$attrib_key."` = '".$port_ifAlias[$attrib]."'";
|
||||
log_event($attrib . ": ".$port[$attrib_key]." -> " . $port_ifAlias[$attrib], $device['device_id'], 'interface', $port['interface_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Ende parse ifAlias
|
||||
|
||||
/// Update IF-MIB metrics
|
||||
foreach ($stat_oids_db as $oid)
|
||||
{
|
||||
$update .= ", `$oid` = '".$this_port[$oid]."'";
|
||||
$update .= ", `".$oid."_prev` = '".$port[$oid]."'";
|
||||
$oid_prev = $oid . "_prev";
|
||||
if ($port[$oid])
|
||||
{
|
||||
$oid_diff = $this_port[$oid] - $port[$oid];
|
||||
$oid_rate = $oid_diff / $polled_period;
|
||||
if ($oid_rate < 0) { $oid_rate = "0"; }
|
||||
$update .= ", `".$oid."_rate` = '".$oid_rate."'";
|
||||
$update .= ", `".$oid."_delta` = '".$oid_diff."'";
|
||||
if ($debug) {echo("\n $oid ($oid_diff B) $oid_rate Bps $polled_period secs\n"); }
|
||||
}
|
||||
}
|
||||
|
||||
/// Update RRDs
|
||||
$rrdfile = $host_rrd . "/port-" . safename($port['ifIndex'] . ".rrd");
|
||||
if (!is_file($rrdfile))
|
||||
{
|
||||
rrdtool_create($rrdfile," --step 300 \
|
||||
DS:INOCTETS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTOCTETS:DERIVE:600:0:12500000000 \
|
||||
DS:INERRORS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTERRORS:DERIVE:600:0:12500000000 \
|
||||
DS:INUCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTUCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:INNUCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTNUCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:INDISCARDS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTDISCARDS:DERIVE:600:0:12500000000 \
|
||||
DS:INUNKNOWNPROTOS:DERIVE:600:0:12500000000 \
|
||||
DS:INBROADCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTBROADCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:INMULTICASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTMULTICASTPKTS:DERIVE:600:0:12500000000 \
|
||||
RRA:AVERAGE:0.5:1:600 \
|
||||
RRA:AVERAGE:0.5:6:700 \
|
||||
RRA:AVERAGE:0.5:24:775 \
|
||||
RRA:AVERAGE:0.5:288:797 \
|
||||
RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 \
|
||||
RRA:MAX:0.5:24:775 \
|
||||
RRA:MAX:0.5:288:797");
|
||||
}
|
||||
|
||||
foreach ($stat_oids as $oid)
|
||||
{ /// Copy values from array to global variables and force numeric.
|
||||
$$oid = $this_port[$oid];
|
||||
if (!is_numeric($$oid)) { $$oid = "0"; }
|
||||
}
|
||||
|
||||
$if_rrd_update = "$polled:$ifInOctets:$ifOutOctets:$ifInErrors:$ifOutErrors:$ifInUcastPkts:$ifOutUcastPkts:$ifInNUcastPkts:$ifOutNUcastPkts:$ifInDiscards:$ifOutDiscards:$ifInUnknownProtos";
|
||||
$if_rrd_update .= ":$ifInBroadcastPkts:$ifOutBroadcastPkts:$ifInMulticastPkts:$ifOutMulticastPkts";
|
||||
$ret = rrdtool_update("$rrdfile", $if_rrd_update);
|
||||
|
||||
# if ($config['enable_ports_Xbcmc'] && $config['os'][$device['os']]['ifXmcbc']) {
|
||||
# if (!is_file($ifx_rrd)) { shell_exec($ifx_rrd_cmd); }
|
||||
# $ifx_rrd_update = "$polled:$ifHCInBroadcastPkts:$ifHCOutBroadcastPkts:$ifHCInMulticastPkts:$ifHCOutMulticastPkts";
|
||||
# $ret = rrdtool_update($ifx_rrd, $ifx_rrd_update);
|
||||
# }
|
||||
|
||||
/// End Update IF-MIB
|
||||
|
||||
/// Update PAgP
|
||||
if ($this_port['pagpOperationMode'])
|
||||
{
|
||||
foreach ($pagp_oids as $oid)
|
||||
{ // Loop the OIDs
|
||||
if ($this_port[$oid] != $port[$oid] )
|
||||
{ // If data has changed, build a query
|
||||
$update .= ", `$oid` = '".mres($this_port[$oid])."'";
|
||||
echo("PAgP ");
|
||||
log_event("$oid -> ".$this_port[$oid], $device['device_id'], 'interface', $port['interface_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// End Update PAgP
|
||||
|
||||
/// Do EtherLike-MIB
|
||||
if ($config['enable_ports_etherlike']) { include("port-etherlike.inc.php"); }
|
||||
|
||||
/// Do ADSL MIB
|
||||
if ($config['enable_ports_adsl']) { include("port-adsl.inc.php"); }
|
||||
|
||||
/// Do PoE MIBs
|
||||
if ($config['enable_ports_poe']) { include("port-poe.inc.php"); }
|
||||
|
||||
// Update MySQL
|
||||
if ($update)
|
||||
{
|
||||
$update_query = "UPDATE `ports` SET ".$update." WHERE `interface_id` = '" . $port['interface_id'] . "'";
|
||||
@mysql_query($update_query);
|
||||
if ($debug) {echo("\nMYSQL : [ $update_query ]"); }
|
||||
}
|
||||
// End Update MySQL
|
||||
|
||||
unset($update_query); unset($update);
|
||||
|
||||
// Send alerts for interface flaps.
|
||||
if ($config['warn']['ifdown'] && ($port['ifOperStatus'] != $this_port['ifOperStatus']) && $port['ignore'] == 0)
|
||||
{
|
||||
if ($this_port['ifAlias'])
|
||||
{
|
||||
$falias = preg_replace('/^"/', '', $this_port['ifAlias']); $falias = preg_replace('/"$/', '', $falias); $full = $this_port['ifDescr'] . " (" . $falias . ")";
|
||||
} else {
|
||||
$full = $this_port['ifDescr'];
|
||||
}
|
||||
switch ($this_port['ifOperStatus'])
|
||||
{
|
||||
case "up":
|
||||
notify($device, "Interface UP - " . $device['hostname'] . " - " . $full, "Device: " . $device['hostname'] . "\nInterface: " . $full . "\nTimestamp: " . date($config['timestamp_format']));
|
||||
break;
|
||||
case "down":
|
||||
notify($device, "Interface DOWN - " . $device['hostname'] . " - " . $full, "Device: " . $device['hostname'] . "\nInterface: " . $full . "\nTimestamp: " . date($config['timestamp_format']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($port['disabled'] != "1")
|
||||
### Copy ifHC[In|Out]Octets values to non-HC if they exist
|
||||
if ($this_port['ifHCInOctets'] > 0 && is_numeric($this_port['ifHCInOctets']) && $this_port['ifHCOutOctets'] > 0 && is_numeric($this_port['ifHCOutOctets']))
|
||||
{
|
||||
echo("Port Deleted"); // Port missing from SNMP cache.
|
||||
mysql_query("UPDATE `ports` SET `deleted` = '1' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$this_port['ifIndex']."'");
|
||||
} else {
|
||||
echo("Port Disabled.");
|
||||
echo("HC ");
|
||||
$this_port['ifInOctets'] = $this_port['ifHCInOctets'];
|
||||
$this_port['ifOutOctets'] = $this_port['ifHCOutOctets'];
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
if (is_numeric($this_port['ifHCInBroadcastPkts']) && is_numeric($this_port['ifHCOutBroadcastPkts']) && is_numeric($this_port['ifHCInMulticastPkts']) && is_numeric($this_port['ifHCOutMulticastPkts']))
|
||||
{
|
||||
echo("HC ");
|
||||
$this_port['ifInBroadcastPkts'] = $this_port['ifHCInBroadcastPkts'];
|
||||
$this_port['ifOutBroadcastPkts'] = $this_port['ifHCOutBroadcastPkts'];
|
||||
$this_port['ifInMulticastPkts'] = $this_port['ifHCInMulticastPkts'];
|
||||
$this_port['ifOutMulticastPkts'] = $this_port['ifHCOutMulticastPkts'];
|
||||
}
|
||||
|
||||
#### Clear Per-Port Variables Here
|
||||
unset($this_port);
|
||||
### Overwrite ifSpeed with ifHighSpeed if it's over 10G
|
||||
if (is_numeric($this_port['ifHighSpeed']) && $this_port['ifSpeed'] > "1000000000")
|
||||
{
|
||||
echo("HighSpeed ");
|
||||
$this_port['ifSpeed'] = $this_port['ifHighSpeed'] * 1000000;
|
||||
}
|
||||
|
||||
### Overwrite ifDuplex with dot3StatsDuplexStatus if it exists
|
||||
if (isset($this_port['dot3StatsDuplexStatus']))
|
||||
{
|
||||
echo("dot3Duplex ");
|
||||
$this_port['ifDuplex'] = $this_port['dot3StatsDuplexStatus'];
|
||||
}
|
||||
|
||||
### Update IF-MIB data
|
||||
foreach ($data_oids as $oid)
|
||||
{
|
||||
if ($port[$oid] != $this_port[$oid] && !isset($this_port[$oid]))
|
||||
{
|
||||
$update .= ", `$oid` = NULL";
|
||||
log_event($oid . ": ".$port[$oid]." -> NULL", $device['device_id'], 'interface', $port['interface_id']);
|
||||
if ($debug) { echo($oid . ": ".$port[$oid]." -> NULL "); } else { echo($oid . " "); }
|
||||
} elseif ($port[$oid] != $this_port[$oid] ) {
|
||||
$update .= ", `$oid` = '".mres($this_port[$oid])."'";
|
||||
log_event($oid . ": ".$port[$oid]." -> " . $this_port[$oid], $device['device_id'], 'interface', $port['interface_id']);
|
||||
if ($debug) { echo($oid . ": ".$port[$oid]." -> " . $this_port[$oid]." "); } else { echo($oid . " "); }
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse description (usually ifAlias) if config option set
|
||||
|
||||
if (isset($config['port_descr_parser']) && is_file($config['install_dir'] . "/" . $config['port_descr_parser']))
|
||||
{
|
||||
$port_attribs = array('type','descr','circuit','speed','notes');
|
||||
include($config['install_dir'] . "/" . $config['port_descr_parser']);
|
||||
|
||||
foreach ($port_attribs as $attrib)
|
||||
{
|
||||
$attrib_key = "port_descr_".$attrib;
|
||||
if ($port_ifAlias[$attrib] != $port[$attrib_key])
|
||||
{
|
||||
$update .= ", `".$attrib_key."` = '".$port_ifAlias[$attrib]."'";
|
||||
log_event($attrib . ": ".$port[$attrib_key]." -> " . $port_ifAlias[$attrib], $device['device_id'], 'interface', $port['interface_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Ende parse ifAlias
|
||||
|
||||
/// Update IF-MIB metrics
|
||||
foreach ($stat_oids_db as $oid)
|
||||
{
|
||||
$update .= ", `$oid` = '".$this_port[$oid]."'";
|
||||
$update .= ", `".$oid."_prev` = '".$port[$oid]."'";
|
||||
$oid_prev = $oid . "_prev";
|
||||
if ($port[$oid])
|
||||
{
|
||||
$oid_diff = $this_port[$oid] - $port[$oid];
|
||||
$oid_rate = $oid_diff / $polled_period;
|
||||
if ($oid_rate < 0) { $oid_rate = "0"; }
|
||||
$update .= ", `".$oid."_rate` = '".$oid_rate."'";
|
||||
$update .= ", `".$oid."_delta` = '".$oid_diff."'";
|
||||
if ($debug) {echo("\n $oid ($oid_diff B) $oid_rate Bps $polled_period secs\n"); }
|
||||
}
|
||||
}
|
||||
|
||||
/// Update RRDs
|
||||
$rrdfile = $host_rrd . "/port-" . safename($port['ifIndex'] . ".rrd");
|
||||
if (!is_file($rrdfile))
|
||||
{
|
||||
rrdtool_create($rrdfile," --step 300 \
|
||||
DS:INOCTETS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTOCTETS:DERIVE:600:0:12500000000 \
|
||||
DS:INERRORS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTERRORS:DERIVE:600:0:12500000000 \
|
||||
DS:INUCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTUCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:INNUCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTNUCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:INDISCARDS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTDISCARDS:DERIVE:600:0:12500000000 \
|
||||
DS:INUNKNOWNPROTOS:DERIVE:600:0:12500000000 \
|
||||
DS:INBROADCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTBROADCASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:INMULTICASTPKTS:DERIVE:600:0:12500000000 \
|
||||
DS:OUTMULTICASTPKTS:DERIVE:600:0:12500000000 \
|
||||
RRA:AVERAGE:0.5:1:600 \
|
||||
RRA:AVERAGE:0.5:6:700 \
|
||||
RRA:AVERAGE:0.5:24:775 \
|
||||
RRA:AVERAGE:0.5:288:797 \
|
||||
RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 \
|
||||
RRA:MAX:0.5:24:775 \
|
||||
RRA:MAX:0.5:288:797");
|
||||
}
|
||||
|
||||
foreach ($stat_oids as $oid)
|
||||
{ /// Copy values from array to global variables and force numeric.
|
||||
$$oid = $this_port[$oid];
|
||||
if (!is_numeric($$oid)) { $$oid = "0"; }
|
||||
}
|
||||
|
||||
$if_rrd_update = "$polled:$ifInOctets:$ifOutOctets:$ifInErrors:$ifOutErrors:$ifInUcastPkts:$ifOutUcastPkts:$ifInNUcastPkts:$ifOutNUcastPkts:$ifInDiscards:$ifOutDiscards:$ifInUnknownProtos";
|
||||
$if_rrd_update .= ":$ifInBroadcastPkts:$ifOutBroadcastPkts:$ifInMulticastPkts:$ifOutMulticastPkts";
|
||||
$ret = rrdtool_update("$rrdfile", $if_rrd_update);
|
||||
|
||||
# if ($config['enable_ports_Xbcmc'] && $config['os'][$device['os']]['ifXmcbc']) {
|
||||
# if (!is_file($ifx_rrd)) { shell_exec($ifx_rrd_cmd); }
|
||||
# $ifx_rrd_update = "$polled:$ifHCInBroadcastPkts:$ifHCOutBroadcastPkts:$ifHCInMulticastPkts:$ifHCOutMulticastPkts";
|
||||
# $ret = rrdtool_update($ifx_rrd, $ifx_rrd_update);
|
||||
# }
|
||||
|
||||
/// End Update IF-MIB
|
||||
|
||||
/// Update PAgP
|
||||
if ($this_port['pagpOperationMode'])
|
||||
{
|
||||
foreach ($pagp_oids as $oid)
|
||||
{ // Loop the OIDs
|
||||
if ($this_port[$oid] != $port[$oid] )
|
||||
{ // If data has changed, build a query
|
||||
$update .= ", `$oid` = '".mres($this_port[$oid])."'";
|
||||
echo("PAgP ");
|
||||
log_event("$oid -> ".$this_port[$oid], $device['device_id'], 'interface', $port['interface_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// End Update PAgP
|
||||
|
||||
/// Do EtherLike-MIB
|
||||
if ($config['enable_ports_etherlike']) { include("port-etherlike.inc.php"); }
|
||||
|
||||
/// Do ADSL MIB
|
||||
if ($config['enable_ports_adsl']) { include("port-adsl.inc.php"); }
|
||||
|
||||
/// Do PoE MIBs
|
||||
if ($config['enable_ports_poe']) { include("port-poe.inc.php"); }
|
||||
|
||||
// Update MySQL
|
||||
if ($update)
|
||||
{
|
||||
$update_query = "UPDATE `ports` SET ".$update." WHERE `interface_id` = '" . $port['interface_id'] . "'";
|
||||
@mysql_query($update_query);
|
||||
if ($debug) {echo("\nMYSQL : [ $update_query ]"); }
|
||||
}
|
||||
// End Update MySQL
|
||||
|
||||
unset($update_query); unset($update);
|
||||
|
||||
// Send alerts for interface flaps.
|
||||
if ($config['warn']['ifdown'] && ($port['ifOperStatus'] != $this_port['ifOperStatus']) && $port['ignore'] == 0)
|
||||
{
|
||||
if ($this_port['ifAlias'])
|
||||
{
|
||||
$falias = preg_replace('/^"/', '', $this_port['ifAlias']); $falias = preg_replace('/"$/', '', $falias); $full = $this_port['ifDescr'] . " (" . $falias . ")";
|
||||
} else {
|
||||
$full = $this_port['ifDescr'];
|
||||
}
|
||||
switch ($this_port['ifOperStatus'])
|
||||
{
|
||||
case "up":
|
||||
notify($device, "Interface UP - " . $device['hostname'] . " - " . $full, "Device: " . $device['hostname'] . "\nInterface: " . $full . "\nTimestamp: " . date($config['timestamp_format']));
|
||||
break;
|
||||
case "down":
|
||||
notify($device, "Interface DOWN - " . $device['hostname'] . " - " . $full, "Device: " . $device['hostname'] . "\nInterface: " . $full . "\nTimestamp: " . date($config['timestamp_format']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($port['disabled'] != "1")
|
||||
{
|
||||
echo("Port Deleted"); // Port missing from SNMP cache.
|
||||
mysql_query("UPDATE `ports` SET `deleted` = '1' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$this_port['ifIndex']."'");
|
||||
} else {
|
||||
echo("Port Disabled.");
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
|
||||
#### Clear Per-Port Variables Here
|
||||
unset($this_port);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -15,19 +15,19 @@ $descr = trim($descr);
|
||||
|
||||
if ($type && $descr)
|
||||
{
|
||||
$type = strtolower($type);
|
||||
$port_ifAlias['type'] = $type;
|
||||
$port_ifAlias['descr'] = $descr;
|
||||
$port_ifAlias['circuit'] = $circuit;
|
||||
$port_ifAlias['speed'] = $speed;
|
||||
$port_ifAlias['notes'] = $notes;
|
||||
$type = strtolower($type);
|
||||
$port_ifAlias['type'] = $type;
|
||||
$port_ifAlias['descr'] = $descr;
|
||||
$port_ifAlias['circuit'] = $circuit;
|
||||
$port_ifAlias['speed'] = $speed;
|
||||
$port_ifAlias['notes'] = $notes;
|
||||
|
||||
if ($debug)
|
||||
{
|
||||
print_r($port_ifAlias);
|
||||
}
|
||||
if ($debug)
|
||||
{
|
||||
print_r($port_ifAlias);
|
||||
}
|
||||
}
|
||||
|
||||
unset ($port_type, $port_descr, $port_circuit, $port_notes, $port_speed);
|
||||
|
||||
?>
|
||||
?>
|
||||
+332
-332
@@ -2,297 +2,297 @@
|
||||
|
||||
function formatMac($mac)
|
||||
{
|
||||
$mac = preg_replace("/(..)(..)(..)(..)(..)(..)/", "\\1:\\2:\\3:\\4:\\5:\\6", $mac);
|
||||
return $mac;
|
||||
$mac = preg_replace("/(..)(..)(..)(..)(..)(..)/", "\\1:\\2:\\3:\\4:\\5:\\6", $mac);
|
||||
return $mac;
|
||||
}
|
||||
|
||||
function rewrite_entity_descr ($descr)
|
||||
{
|
||||
$descr = str_replace("Distributed Forwarding Card", "DFC", $descr);
|
||||
$descr = preg_replace("/7600 Series SPA Interface Processor-/", "7600 SIP-", $descr);
|
||||
$descr = preg_replace("/Rev\.\ [0-9\.]+\ /", "", $descr);
|
||||
$descr = preg_replace("/12000 Series Performance Route Processor/", "12000 PRP", $descr);
|
||||
$descr = preg_replace("/^12000/", "", $descr);
|
||||
$descr = preg_replace("/Gigabit Ethernet/", "GigE", $descr);
|
||||
$descr = preg_replace("/^ASR1000\ /", "", $descr);
|
||||
$descr = str_replace("Routing Processor", "RP", $descr);
|
||||
$descr = str_replace("Route Processor", "RP", $descr);
|
||||
$descr = str_replace("Switching Processor", "SP", $descr);
|
||||
$descr = str_replace("Sub-Module", "Module ", $descr);
|
||||
$descr = str_replace("DFC Card", "DFC", $descr);
|
||||
$descr = str_replace("Centralized Forwarding Card", "CFC", $descr);
|
||||
$descr = str_replace("Power Supply Module", "PSU ", $descr);
|
||||
$descr = str_replace("/Voltage Sensor/", "Voltage", $descr);
|
||||
$descr = preg_replace("/^temperatures /", "", $descr);
|
||||
$descr = preg_replace("/^voltages /", "", $descr);
|
||||
$descr = str_replace("Distributed Forwarding Card", "DFC", $descr);
|
||||
$descr = preg_replace("/7600 Series SPA Interface Processor-/", "7600 SIP-", $descr);
|
||||
$descr = preg_replace("/Rev\.\ [0-9\.]+\ /", "", $descr);
|
||||
$descr = preg_replace("/12000 Series Performance Route Processor/", "12000 PRP", $descr);
|
||||
$descr = preg_replace("/^12000/", "", $descr);
|
||||
$descr = preg_replace("/Gigabit Ethernet/", "GigE", $descr);
|
||||
$descr = preg_replace("/^ASR1000\ /", "", $descr);
|
||||
$descr = str_replace("Routing Processor", "RP", $descr);
|
||||
$descr = str_replace("Route Processor", "RP", $descr);
|
||||
$descr = str_replace("Switching Processor", "SP", $descr);
|
||||
$descr = str_replace("Sub-Module", "Module ", $descr);
|
||||
$descr = str_replace("DFC Card", "DFC", $descr);
|
||||
$descr = str_replace("Centralized Forwarding Card", "CFC", $descr);
|
||||
$descr = str_replace("Power Supply Module", "PSU ", $descr);
|
||||
$descr = str_replace("/Voltage Sensor/", "Voltage", $descr);
|
||||
$descr = preg_replace("/^temperatures /", "", $descr);
|
||||
$descr = preg_replace("/^voltages /", "", $descr);
|
||||
|
||||
return $descr;
|
||||
return $descr;
|
||||
}
|
||||
|
||||
function ifNameDescr($interface, $device = NULL)
|
||||
{
|
||||
return ifLabel($interface, $device);
|
||||
return ifLabel($interface, $device);
|
||||
}
|
||||
|
||||
function ifLabel ($interface, $device = NULL)
|
||||
{
|
||||
global $config;
|
||||
global $config;
|
||||
|
||||
if (!$device) { $device = device_by_id_cache($interface['device_id']); }
|
||||
$os = strtolower($device['os']);
|
||||
if (!$device) { $device = device_by_id_cache($interface['device_id']); }
|
||||
$os = strtolower($device['os']);
|
||||
|
||||
if (isset($config['os'][$os]['ifname']))
|
||||
if (isset($config['os'][$os]['ifname']))
|
||||
{
|
||||
$interface['label'] = $interface['ifName'];
|
||||
} elseif (isset($config['os'][$os]['ifalias']))
|
||||
{
|
||||
$interface['label'] = $interface['ifAlias'];
|
||||
} else {
|
||||
$interface['label'] = $interface['ifDescr'];
|
||||
if (isset($config['os'][$os]['ifindex']))
|
||||
{
|
||||
$interface['label'] = $interface['ifName'];
|
||||
} elseif (isset($config['os'][$os]['ifalias']))
|
||||
{
|
||||
$interface['label'] = $interface['ifAlias'];
|
||||
} else {
|
||||
$interface['label'] = $interface['ifDescr'];
|
||||
if (isset($config['os'][$os]['ifindex']))
|
||||
{
|
||||
$interface['label'] = $interface['label'] . " " . $interface['ifIndex'];
|
||||
}
|
||||
$interface['label'] = $interface['label'] . " " . $interface['ifIndex'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($device['os'] == "speedtouch")
|
||||
{
|
||||
list($interface['label']) = explode("thomson", $interface['label']);
|
||||
}
|
||||
if ($device['os'] == "speedtouch")
|
||||
{
|
||||
list($interface['label']) = explode("thomson", $interface['label']);
|
||||
}
|
||||
|
||||
return $interface;
|
||||
return $interface;
|
||||
}
|
||||
|
||||
$rewrite_entSensorType = array (
|
||||
'celsius' => 'C',
|
||||
'unknown' => '',
|
||||
'specialEnum' => 'C',
|
||||
'watts' => 'W',
|
||||
'truthvalue' => '',
|
||||
'celsius' => 'C',
|
||||
'unknown' => '',
|
||||
'specialEnum' => 'C',
|
||||
'watts' => 'W',
|
||||
'truthvalue' => '',
|
||||
);
|
||||
|
||||
$translate_ifOperStatus = array(
|
||||
"1" => "up",
|
||||
"2" => "down",
|
||||
"3" => "testing",
|
||||
"4" => "unknown",
|
||||
"5" => "dormant",
|
||||
"6" => "notPresent",
|
||||
"7" => "lowerLayerDown",
|
||||
"1" => "up",
|
||||
"2" => "down",
|
||||
"3" => "testing",
|
||||
"4" => "unknown",
|
||||
"5" => "dormant",
|
||||
"6" => "notPresent",
|
||||
"7" => "lowerLayerDown",
|
||||
);
|
||||
|
||||
function translate_ifOperStatus ($ifOperStatus)
|
||||
{
|
||||
global $translate_ifOperStatus;
|
||||
global $translate_ifOperStatus;
|
||||
|
||||
if ($translate_ifOperStatus['$ifOperStatus'])
|
||||
{
|
||||
$ifOperStatus = $translate_ifOperStatus['$ifOperStatus'];
|
||||
}
|
||||
if ($translate_ifOperStatus['$ifOperStatus'])
|
||||
{
|
||||
$ifOperStatus = $translate_ifOperStatus['$ifOperStatus'];
|
||||
}
|
||||
|
||||
return $ifOperStatus;
|
||||
return $ifOperStatus;
|
||||
}
|
||||
|
||||
$translate_ifAdminStatus = array(
|
||||
"1" => "up",
|
||||
"2" => "down",
|
||||
"3" => "testing",
|
||||
"1" => "up",
|
||||
"2" => "down",
|
||||
"3" => "testing",
|
||||
);
|
||||
|
||||
function translate_ifAdminStatus ($ifAdminStatus)
|
||||
{
|
||||
global $translate_ifAdminStatus;
|
||||
global $translate_ifAdminStatus;
|
||||
|
||||
if ($translate_ifAdminStatus[$ifAdminStatus])
|
||||
{
|
||||
$ifAdminStatus = $translate_ifAdminStatus[$ifAdminStatus];
|
||||
}
|
||||
if ($translate_ifAdminStatus[$ifAdminStatus])
|
||||
{
|
||||
$ifAdminStatus = $translate_ifAdminStatus[$ifAdminStatus];
|
||||
}
|
||||
|
||||
return $ifAdminStatus;
|
||||
return $ifAdminStatus;
|
||||
}
|
||||
|
||||
$rewrite_junose_hardware = array(
|
||||
'juniErx1400' => 'ERX-1400',
|
||||
'juniErx700' => 'ERX-700',
|
||||
'juniErx1440' => 'ERX-1440',
|
||||
'juniErx705' => 'ERX-705',
|
||||
'juniErx310' => 'ERX-310',
|
||||
'juniE320' => 'E320',
|
||||
'juniE120' => 'E120',
|
||||
'juniSsx1400' => 'SSX-1400',
|
||||
'juniSsx700' => 'SSX-700',
|
||||
'juniSsx1440' => 'SSX-1440',
|
||||
'juniErx1400' => 'ERX-1400',
|
||||
'juniErx700' => 'ERX-700',
|
||||
'juniErx1440' => 'ERX-1440',
|
||||
'juniErx705' => 'ERX-705',
|
||||
'juniErx310' => 'ERX-310',
|
||||
'juniE320' => 'E320',
|
||||
'juniE120' => 'E120',
|
||||
'juniSsx1400' => 'SSX-1400',
|
||||
'juniSsx700' => 'SSX-700',
|
||||
'juniSsx1440' => 'SSX-1440',
|
||||
);
|
||||
|
||||
$rewrite_ftos_hardware = array (
|
||||
'.1.3.6.1.4.1.6027.1.1.1'=> 'E1200',
|
||||
'.1.3.6.1.4.1.6027.1.1.2'=> 'E600',
|
||||
'.1.3.6.1.4.1.6027.1.1.3'=> 'E300',
|
||||
'.1.3.6.1.4.1.6027.1.1.4'=> 'E610',
|
||||
'.1.3.6.1.4.1.6027.1.1.5'=> 'E1200i',
|
||||
'.1.3.6.1.4.1.6027.1.2.1'=> 'C300',
|
||||
'.1.3.6.1.4.1.6027.1.2.2'=> 'C150',
|
||||
'.1.3.6.1.4.1.6027.1.3.1'=> 'S50',
|
||||
'.1.3.6.1.4.1.6027.1.3.2'=> 'S50E',
|
||||
'.1.3.6.1.4.1.6027.1.3.3'=> 'S50V',
|
||||
'.1.3.6.1.4.1.6027.1.3.4'=> 'S25P-AC',
|
||||
'.1.3.6.1.4.1.6027.1.3.5'=> 'S2410CP',
|
||||
'.1.3.6.1.4.1.6027.1.3.6'=> 'S2410P',
|
||||
'.1.3.6.1.4.1.6027.1.3.7'=> 'S50N-AC',
|
||||
'.1.3.6.1.4.1.6027.1.3.8'=> 'S50N-DC',
|
||||
'.1.3.6.1.4.1.6027.1.3.9'=> 'S25P-DC',
|
||||
'.1.3.6.1.4.1.6027.1.3.10'=> 'S25V',
|
||||
'.1.3.6.1.4.1.6027.1.3.11'=> 'S25N'
|
||||
'.1.3.6.1.4.1.6027.1.1.1'=> 'E1200',
|
||||
'.1.3.6.1.4.1.6027.1.1.2'=> 'E600',
|
||||
'.1.3.6.1.4.1.6027.1.1.3'=> 'E300',
|
||||
'.1.3.6.1.4.1.6027.1.1.4'=> 'E610',
|
||||
'.1.3.6.1.4.1.6027.1.1.5'=> 'E1200i',
|
||||
'.1.3.6.1.4.1.6027.1.2.1'=> 'C300',
|
||||
'.1.3.6.1.4.1.6027.1.2.2'=> 'C150',
|
||||
'.1.3.6.1.4.1.6027.1.3.1'=> 'S50',
|
||||
'.1.3.6.1.4.1.6027.1.3.2'=> 'S50E',
|
||||
'.1.3.6.1.4.1.6027.1.3.3'=> 'S50V',
|
||||
'.1.3.6.1.4.1.6027.1.3.4'=> 'S25P-AC',
|
||||
'.1.3.6.1.4.1.6027.1.3.5'=> 'S2410CP',
|
||||
'.1.3.6.1.4.1.6027.1.3.6'=> 'S2410P',
|
||||
'.1.3.6.1.4.1.6027.1.3.7'=> 'S50N-AC',
|
||||
'.1.3.6.1.4.1.6027.1.3.8'=> 'S50N-DC',
|
||||
'.1.3.6.1.4.1.6027.1.3.9'=> 'S25P-DC',
|
||||
'.1.3.6.1.4.1.6027.1.3.10'=> 'S25V',
|
||||
'.1.3.6.1.4.1.6027.1.3.11'=> 'S25N'
|
||||
);
|
||||
|
||||
$rewrite_fortinet_hardware = array(
|
||||
'.1.3.6.1.4.1.12356.102.1.1000' => 'FortiAnalyzer 100',
|
||||
'.1.3.6.1.4.1.12356.102.1.10002' => 'FortiAnalyzer 1000B',
|
||||
'.1.3.6.1.4.1.12356.102.1.1001' => 'FortiAnalyzer 100A',
|
||||
'.1.3.6.1.4.1.12356.102.1.1002' => 'FortiAnalyzer 100B',
|
||||
'.1.3.6.1.4.1.12356.102.1.20000' => 'FortiAnalyzer 2000',
|
||||
'.1.3.6.1.4.1.12356.102.1.20001' => 'FortiAnalyzer 2000A',
|
||||
'.1.3.6.1.4.1.12356.102.1.4000' => 'FortiAnalyzer 400',
|
||||
'.1.3.6.1.4.1.12356.102.1.40000' => 'FortiAnalyzer 4000',
|
||||
'.1.3.6.1.4.1.12356.102.1.40001' => 'FortiAnalyzer 4000A',
|
||||
'.1.3.6.1.4.1.12356.102.1.4002' => 'FortiAnalyzer 400B',
|
||||
'.1.3.6.1.4.1.12356.102.1.8000' => 'FortiAnalyzer 800',
|
||||
'.1.3.6.1.4.1.12356.102.1.8002' => 'FortiAnalyzer 800B',
|
||||
'.1.3.6.1.4.1.12356.101.1.1000' => 'FortiGate 100',
|
||||
'.1.3.6.1.4.1.12356.101.1.10000' => 'FortiGate 1000',
|
||||
'.1.3.6.1.4.1.12356.101.1.10001' => 'FortiGate 1000A',
|
||||
'.1.3.6.1.4.1.12356.101.1.10002' => 'FortiGate 1000AFA2',
|
||||
'.1.3.6.1.4.1.12356.101.1.10003' => 'FortiGate 1000ALENC',
|
||||
'.1.3.6.1.4.1.12356.101.1.1001' => 'FortiGate 100A',
|
||||
'.1.3.6.1.4.1.12356.101.1.1002' => 'FortiGate 110C',
|
||||
'.1.3.6.1.4.1.12356.101.1.1003' => 'FortiGate 111C',
|
||||
'.1.3.6.1.4.1.12356.101.1.2000' => 'FortiGate 200',
|
||||
'.1.3.6.1.4.1.12356.101.1.20000' => 'FortiGate 2000',
|
||||
'.1.3.6.1.4.1.12356.101.1.2001' => 'FortiGate 200A',
|
||||
'.1.3.6.1.4.1.12356.101.1.2002' => 'FortiGate 224B',
|
||||
'.1.3.6.1.4.1.12356.101.1.2003' => 'FortiGate 200A',
|
||||
'.1.3.6.1.4.1.12356.101.1.3000' => 'FortiGate 300',
|
||||
'.1.3.6.1.4.1.12356.101.1.30000' => 'FortiGate 3000',
|
||||
'.1.3.6.1.4.1.12356.101.1.3001' => 'FortiGate 300A',
|
||||
'.1.3.6.1.4.1.12356.101.1.30160' => 'FortiGate 3016B',
|
||||
'.1.3.6.1.4.1.12356.101.1.302' => 'FortiGate 30B',
|
||||
'.1.3.6.1.4.1.12356.101.1.3002' => 'FortiGate 310B',
|
||||
'.1.3.6.1.4.1.12356.101.1.36000' => 'FortiGate 3600',
|
||||
'.1.3.6.1.4.1.12356.101.1.36003' => 'FortiGate 3600A',
|
||||
'.1.3.6.1.4.1.12356.101.1.38100' => 'FortiGate 3810A',
|
||||
'.1.3.6.1.4.1.12356.101.1.4000' => 'FortiGate 400',
|
||||
'.1.3.6.1.4.1.12356.101.1.40000' => 'FortiGate 4000',
|
||||
'.1.3.6.1.4.1.12356.101.1.4001' => 'FortiGate 400A',
|
||||
'.1.3.6.1.4.1.12356.101.1.5000' => 'FortiGate 500',
|
||||
'.1.3.6.1.4.1.12356.101.1.50000' => 'FortiGate 5000',
|
||||
'.1.3.6.1.4.1.12356.101.1.50010' => 'FortiGate 5001',
|
||||
'.1.3.6.1.4.1.12356.101.1.50011' => 'FortiGate 5001A',
|
||||
'.1.3.6.1.4.1.12356.101.1.50012' => 'FortiGate 5001FA2',
|
||||
'.1.3.6.1.4.1.12356.101.1.50021' => 'FortiGate 5002A',
|
||||
'.1.3.6.1.4.1.12356.101.1.50001' => 'FortiGate 5002FB2',
|
||||
'.1.3.6.1.4.1.12356.101.1.50040' => 'FortiGate 5004',
|
||||
'.1.3.6.1.4.1.12356.101.1.50050' => 'FortiGate 5005',
|
||||
'.1.3.6.1.4.1.12356.101.1.50051' => 'FortiGate 5005FA2',
|
||||
'.1.3.6.1.4.1.12356.101.1.5001' => 'FortiGate 500A',
|
||||
'.1.3.6.1.4.1.12356.101.1.500' => 'FortiGate 50A',
|
||||
'.1.3.6.1.4.1.12356.101.1.501' => 'FortiGate 50AM',
|
||||
'.1.3.6.1.4.1.12356.101.1.502' => 'FortiGate 50B',
|
||||
'.1.3.6.1.4.1.12356.101.1.504' => 'FortiGate 51B',
|
||||
'.1.3.6.1.4.1.12356.101.1.600' => 'FortiGate 60',
|
||||
'.1.3.6.1.4.1.12356.101.1.6201' => 'FortiGate 600D',
|
||||
'.1.3.6.1.4.1.12356.101.1.602' => 'FortiGate 60ADSL',
|
||||
'.1.3.6.1.4.1.12356.101.1.603' => 'FortiGate 60B',
|
||||
'.1.3.6.1.4.1.12356.101.1.601' => 'FortiGate 60M',
|
||||
'.1.3.6.1.4.1.12356.101.1.6200' => 'FortiGate 620B',
|
||||
'.1.3.6.1.4.1.12356.101.1.8000' => 'FortiGate 800',
|
||||
'.1.3.6.1.4.1.12356.101.1.8001' => 'FortiGate 800F',
|
||||
'.1.3.6.1.4.1.12356.101.1.800' => 'FortiGate 80C',
|
||||
'.1.3.6.1.4.1.12356.1688' => 'FortiMail 2000A',
|
||||
'.1.3.6.1.4.1.12356.103.1.1000' => 'FortiManager 100',
|
||||
'.1.3.6.1.4.1.12356.103.1.20000' => 'FortiManager 2000XL',
|
||||
'.1.3.6.1.4.1.12356.103.1.30000' => 'FortiManager 3000',
|
||||
'.1.3.6.1.4.1.12356.103.1.30002' => 'FortiManager 3000B',
|
||||
'.1.3.6.1.4.1.12356.103.1.4000' => 'FortiManager 400',
|
||||
'.1.3.6.1.4.1.12356.103.1.4001' => 'FortiManager 400A',
|
||||
'.1.3.6.1.4.1.12356.106.1.50030' => 'FortiSwitch 5003A',
|
||||
'.1.3.6.1.4.1.12356.101.1.510' => 'FortiWiFi 50B',
|
||||
'.1.3.6.1.4.1.12356.101.1.610' => 'FortiWiFi 60',
|
||||
'.1.3.6.1.4.1.12356.101.1.611' => 'FortiWiFi 60A',
|
||||
'.1.3.6.1.4.1.12356.101.1.612' => 'FortiWiFi 60AM',
|
||||
'.1.3.6.1.4.1.12356.101.1.613' => 'FortiWiFi 60B');
|
||||
'.1.3.6.1.4.1.12356.102.1.1000' => 'FortiAnalyzer 100',
|
||||
'.1.3.6.1.4.1.12356.102.1.10002' => 'FortiAnalyzer 1000B',
|
||||
'.1.3.6.1.4.1.12356.102.1.1001' => 'FortiAnalyzer 100A',
|
||||
'.1.3.6.1.4.1.12356.102.1.1002' => 'FortiAnalyzer 100B',
|
||||
'.1.3.6.1.4.1.12356.102.1.20000' => 'FortiAnalyzer 2000',
|
||||
'.1.3.6.1.4.1.12356.102.1.20001' => 'FortiAnalyzer 2000A',
|
||||
'.1.3.6.1.4.1.12356.102.1.4000' => 'FortiAnalyzer 400',
|
||||
'.1.3.6.1.4.1.12356.102.1.40000' => 'FortiAnalyzer 4000',
|
||||
'.1.3.6.1.4.1.12356.102.1.40001' => 'FortiAnalyzer 4000A',
|
||||
'.1.3.6.1.4.1.12356.102.1.4002' => 'FortiAnalyzer 400B',
|
||||
'.1.3.6.1.4.1.12356.102.1.8000' => 'FortiAnalyzer 800',
|
||||
'.1.3.6.1.4.1.12356.102.1.8002' => 'FortiAnalyzer 800B',
|
||||
'.1.3.6.1.4.1.12356.101.1.1000' => 'FortiGate 100',
|
||||
'.1.3.6.1.4.1.12356.101.1.10000' => 'FortiGate 1000',
|
||||
'.1.3.6.1.4.1.12356.101.1.10001' => 'FortiGate 1000A',
|
||||
'.1.3.6.1.4.1.12356.101.1.10002' => 'FortiGate 1000AFA2',
|
||||
'.1.3.6.1.4.1.12356.101.1.10003' => 'FortiGate 1000ALENC',
|
||||
'.1.3.6.1.4.1.12356.101.1.1001' => 'FortiGate 100A',
|
||||
'.1.3.6.1.4.1.12356.101.1.1002' => 'FortiGate 110C',
|
||||
'.1.3.6.1.4.1.12356.101.1.1003' => 'FortiGate 111C',
|
||||
'.1.3.6.1.4.1.12356.101.1.2000' => 'FortiGate 200',
|
||||
'.1.3.6.1.4.1.12356.101.1.20000' => 'FortiGate 2000',
|
||||
'.1.3.6.1.4.1.12356.101.1.2001' => 'FortiGate 200A',
|
||||
'.1.3.6.1.4.1.12356.101.1.2002' => 'FortiGate 224B',
|
||||
'.1.3.6.1.4.1.12356.101.1.2003' => 'FortiGate 200A',
|
||||
'.1.3.6.1.4.1.12356.101.1.3000' => 'FortiGate 300',
|
||||
'.1.3.6.1.4.1.12356.101.1.30000' => 'FortiGate 3000',
|
||||
'.1.3.6.1.4.1.12356.101.1.3001' => 'FortiGate 300A',
|
||||
'.1.3.6.1.4.1.12356.101.1.30160' => 'FortiGate 3016B',
|
||||
'.1.3.6.1.4.1.12356.101.1.302' => 'FortiGate 30B',
|
||||
'.1.3.6.1.4.1.12356.101.1.3002' => 'FortiGate 310B',
|
||||
'.1.3.6.1.4.1.12356.101.1.36000' => 'FortiGate 3600',
|
||||
'.1.3.6.1.4.1.12356.101.1.36003' => 'FortiGate 3600A',
|
||||
'.1.3.6.1.4.1.12356.101.1.38100' => 'FortiGate 3810A',
|
||||
'.1.3.6.1.4.1.12356.101.1.4000' => 'FortiGate 400',
|
||||
'.1.3.6.1.4.1.12356.101.1.40000' => 'FortiGate 4000',
|
||||
'.1.3.6.1.4.1.12356.101.1.4001' => 'FortiGate 400A',
|
||||
'.1.3.6.1.4.1.12356.101.1.5000' => 'FortiGate 500',
|
||||
'.1.3.6.1.4.1.12356.101.1.50000' => 'FortiGate 5000',
|
||||
'.1.3.6.1.4.1.12356.101.1.50010' => 'FortiGate 5001',
|
||||
'.1.3.6.1.4.1.12356.101.1.50011' => 'FortiGate 5001A',
|
||||
'.1.3.6.1.4.1.12356.101.1.50012' => 'FortiGate 5001FA2',
|
||||
'.1.3.6.1.4.1.12356.101.1.50021' => 'FortiGate 5002A',
|
||||
'.1.3.6.1.4.1.12356.101.1.50001' => 'FortiGate 5002FB2',
|
||||
'.1.3.6.1.4.1.12356.101.1.50040' => 'FortiGate 5004',
|
||||
'.1.3.6.1.4.1.12356.101.1.50050' => 'FortiGate 5005',
|
||||
'.1.3.6.1.4.1.12356.101.1.50051' => 'FortiGate 5005FA2',
|
||||
'.1.3.6.1.4.1.12356.101.1.5001' => 'FortiGate 500A',
|
||||
'.1.3.6.1.4.1.12356.101.1.500' => 'FortiGate 50A',
|
||||
'.1.3.6.1.4.1.12356.101.1.501' => 'FortiGate 50AM',
|
||||
'.1.3.6.1.4.1.12356.101.1.502' => 'FortiGate 50B',
|
||||
'.1.3.6.1.4.1.12356.101.1.504' => 'FortiGate 51B',
|
||||
'.1.3.6.1.4.1.12356.101.1.600' => 'FortiGate 60',
|
||||
'.1.3.6.1.4.1.12356.101.1.6201' => 'FortiGate 600D',
|
||||
'.1.3.6.1.4.1.12356.101.1.602' => 'FortiGate 60ADSL',
|
||||
'.1.3.6.1.4.1.12356.101.1.603' => 'FortiGate 60B',
|
||||
'.1.3.6.1.4.1.12356.101.1.601' => 'FortiGate 60M',
|
||||
'.1.3.6.1.4.1.12356.101.1.6200' => 'FortiGate 620B',
|
||||
'.1.3.6.1.4.1.12356.101.1.8000' => 'FortiGate 800',
|
||||
'.1.3.6.1.4.1.12356.101.1.8001' => 'FortiGate 800F',
|
||||
'.1.3.6.1.4.1.12356.101.1.800' => 'FortiGate 80C',
|
||||
'.1.3.6.1.4.1.12356.1688' => 'FortiMail 2000A',
|
||||
'.1.3.6.1.4.1.12356.103.1.1000' => 'FortiManager 100',
|
||||
'.1.3.6.1.4.1.12356.103.1.20000' => 'FortiManager 2000XL',
|
||||
'.1.3.6.1.4.1.12356.103.1.30000' => 'FortiManager 3000',
|
||||
'.1.3.6.1.4.1.12356.103.1.30002' => 'FortiManager 3000B',
|
||||
'.1.3.6.1.4.1.12356.103.1.4000' => 'FortiManager 400',
|
||||
'.1.3.6.1.4.1.12356.103.1.4001' => 'FortiManager 400A',
|
||||
'.1.3.6.1.4.1.12356.106.1.50030' => 'FortiSwitch 5003A',
|
||||
'.1.3.6.1.4.1.12356.101.1.510' => 'FortiWiFi 50B',
|
||||
'.1.3.6.1.4.1.12356.101.1.610' => 'FortiWiFi 60',
|
||||
'.1.3.6.1.4.1.12356.101.1.611' => 'FortiWiFi 60A',
|
||||
'.1.3.6.1.4.1.12356.101.1.612' => 'FortiWiFi 60AM',
|
||||
'.1.3.6.1.4.1.12356.101.1.613' => 'FortiWiFi 60B');
|
||||
|
||||
$rewrite_extreme_hardware = array (
|
||||
'.1.3.6.1.4.1.1916.2.26' => 'Alpine 3802',
|
||||
'.1.3.6.1.4.1.1916.2.20' => 'Alpine 3804',
|
||||
'.1.3.6.1.4.1.1916.2.17' => 'Alpine 3808',
|
||||
'.1.3.6.1.4.1.1916.2.86' => 'Altitude 300',
|
||||
'.1.3.6.1.4.1.1916.2.75' => 'Altitude 350',
|
||||
'.1.3.6.1.4.1.1916.2.56' => 'BlackDiamond 10808',
|
||||
'.1.3.6.1.4.1.1916.2.85' => 'BlackDiamond 12802',
|
||||
'.1.3.6.1.4.1.1916.2.77' => 'BlackDiamond 12804',
|
||||
'.1.3.6.1.4.1.1916.2.8' => 'BlackDiamond 6800',
|
||||
'.1.3.6.1.4.1.1916.2.27' => 'BlackDiamond 6804',
|
||||
'.1.3.6.1.4.1.1916.2.11' => 'BlackDiamond 6808',
|
||||
'.1.3.6.1.4.1.1916.2.24' => 'BlackDiamond 6816',
|
||||
'.1.3.6.1.4.1.1916.2.74' => 'BlackDiamond 8806',
|
||||
'.1.3.6.1.4.1.1916.2.62' => 'BlackDiamond 8810',
|
||||
'.1.3.6.1.4.1.1916.2.23' => 'EnetSwitch 24Port',
|
||||
'.1.3.6.1.4.1.1916.2.83' => 'Sentriant CE150',
|
||||
'.1.3.6.1.4.1.1916.2.58' => 'Summit 400-48t',
|
||||
'.1.3.6.1.4.1.1916.2.59' => 'Summit 400-48t',
|
||||
'.1.3.6.1.4.1.1916.2.71' => 'Summit X450a-24t',
|
||||
'.1.3.6.1.4.1.1916.2.81' => 'Summit X450a-24t',
|
||||
'.1.3.6.1.4.1.1916.2.1' => 'Summit 1',
|
||||
'.1.3.6.1.4.1.1916.2.19' => 'Summit 1iSX',
|
||||
'.1.3.6.1.4.1.1916.2.14' => 'Summit 1iTX',
|
||||
'.1.3.6.1.4.1.1916.2.2' => 'Summit 2',
|
||||
'.1.3.6.1.4.1.1916.2.53' => 'Summit 200-24',
|
||||
'.1.3.6.1.4.1.1916.2.70' => 'Summit 200-24fx',
|
||||
'.1.3.6.1.4.1.1916.2.54' => 'Summit 200-48',
|
||||
'.1.3.6.1.4.1.1916.2.7' => 'Summit 24',
|
||||
'.1.3.6.1.4.1.1916.2.41' => 'Summit 24e2SX',
|
||||
'.1.3.6.1.4.1.1916.2.40' => 'Summit 24e2TX',
|
||||
'.1.3.6.1.4.1.1916.2.25' => 'Summit 24e3',
|
||||
'.1.3.6.1.4.1.1916.2.3' => 'Summit 3',
|
||||
'.1.3.6.1.4.1.1916.2.61' => 'Summit 300-24',
|
||||
'.1.3.6.1.4.1.1916.2.55' => 'Summit 300-48',
|
||||
'.1.3.6.1.4.1.1916.2.4' => 'Summit 4',
|
||||
'.1.3.6.1.4.1.1916.2.58' => 'Summit 400-24',
|
||||
'.1.3.6.1.4.1.1916.2.64' => 'Summit 400-24p',
|
||||
'.1.3.6.1.4.1.1916.2.63' => 'Summit 400-24t',
|
||||
'.1.3.6.1.4.1.1916.2.59' => 'Summit 400-24x',
|
||||
'.1.3.6.1.4.1.1916.2.6' => 'Summit 48',
|
||||
'.1.3.6.1.4.1.1916.2.16' => 'Summit 48i',
|
||||
'.1.3.6.1.4.1.1916.2.28' => 'Summit 48i1u',
|
||||
'.1.3.6.1.4.1.1916.2.5' => 'Summit 4FX',
|
||||
'.1.3.6.1.4.1.1916.2.15' => 'Summit 5i',
|
||||
'.1.3.6.1.4.1.1916.2.21' => 'Summit 5iLX',
|
||||
'.1.3.6.1.4.1.1916.2.22' => 'Summit 5iTX',
|
||||
'.1.3.6.1.4.1.1916.2.12' => 'Summit 7iSX',
|
||||
'.1.3.6.1.4.1.1916.2.13' => 'Summit 7iTX',
|
||||
'.1.3.6.1.4.1.1916.2.30' => 'Summit Px1',
|
||||
'.1.3.6.1.4.1.1916.2.67' => 'SummitStack',
|
||||
'.1.3.6.1.4.1.1916.2.93' => 'Summit Ver2Stack',
|
||||
'.1.3.6.1.4.1.1916.2.68' => 'SummitWM 100',
|
||||
'.1.3.6.1.4.1.1916.2.69' => 'SummitWM 1000',
|
||||
'.1.3.6.1.4.1.1916.2.94' => 'SummitWM 200',
|
||||
'.1.3.6.1.4.1.1916.2.95' => 'SummitWM 2000',
|
||||
'.1.3.6.1.4.1.1916.2.89' => 'Summit X250-24p',
|
||||
'.1.3.6.1.4.1.1916.2.88' => 'Summit X250-24t',
|
||||
'.1.3.6.1.4.1.1916.2.90' => 'Summit X250-24x',
|
||||
'.1.3.6.1.4.1.1916.2.92' => 'Summit X250-48p',
|
||||
'.1.3.6.1.4.1.1916.2.91' => 'Summit X250-48t',
|
||||
'.1.3.6.1.4.1.1916.2.93' => 'Summit X250e-24t (3-Stack)',
|
||||
'.1.3.6.1.4.1.1916.2.88' => 'Summit X250e-24t (Single)',
|
||||
'.1.3.6.1.4.1.1916.2.66' => 'Summit X450-24t',
|
||||
'.1.3.6.1.4.1.1916.2.65' => 'Summit X450-24x',
|
||||
'.1.3.6.1.4.1.1916.2.80' => 'Summit X450a-24tDC',
|
||||
'.1.3.6.1.4.1.1916.2.84' => 'Summit X450a-24x',
|
||||
'.1.3.6.1.4.1.1916.2.82' => 'Summit X450a-24xDC',
|
||||
'.1.3.6.1.4.1.1916.2.76' => 'Summit X450a-48t',
|
||||
'.1.3.6.1.4.1.1916.2.87' => 'Summit X450a-48tDC',
|
||||
'.1.3.6.1.4.1.1916.2.72' => 'Summit X450e-24p',
|
||||
'.1.3.6.1.4.1.1916.2.79' => 'Summit X450e-48p'
|
||||
'.1.3.6.1.4.1.1916.2.26' => 'Alpine 3802',
|
||||
'.1.3.6.1.4.1.1916.2.20' => 'Alpine 3804',
|
||||
'.1.3.6.1.4.1.1916.2.17' => 'Alpine 3808',
|
||||
'.1.3.6.1.4.1.1916.2.86' => 'Altitude 300',
|
||||
'.1.3.6.1.4.1.1916.2.75' => 'Altitude 350',
|
||||
'.1.3.6.1.4.1.1916.2.56' => 'BlackDiamond 10808',
|
||||
'.1.3.6.1.4.1.1916.2.85' => 'BlackDiamond 12802',
|
||||
'.1.3.6.1.4.1.1916.2.77' => 'BlackDiamond 12804',
|
||||
'.1.3.6.1.4.1.1916.2.8' => 'BlackDiamond 6800',
|
||||
'.1.3.6.1.4.1.1916.2.27' => 'BlackDiamond 6804',
|
||||
'.1.3.6.1.4.1.1916.2.11' => 'BlackDiamond 6808',
|
||||
'.1.3.6.1.4.1.1916.2.24' => 'BlackDiamond 6816',
|
||||
'.1.3.6.1.4.1.1916.2.74' => 'BlackDiamond 8806',
|
||||
'.1.3.6.1.4.1.1916.2.62' => 'BlackDiamond 8810',
|
||||
'.1.3.6.1.4.1.1916.2.23' => 'EnetSwitch 24Port',
|
||||
'.1.3.6.1.4.1.1916.2.83' => 'Sentriant CE150',
|
||||
'.1.3.6.1.4.1.1916.2.58' => 'Summit 400-48t',
|
||||
'.1.3.6.1.4.1.1916.2.59' => 'Summit 400-48t',
|
||||
'.1.3.6.1.4.1.1916.2.71' => 'Summit X450a-24t',
|
||||
'.1.3.6.1.4.1.1916.2.81' => 'Summit X450a-24t',
|
||||
'.1.3.6.1.4.1.1916.2.1' => 'Summit 1',
|
||||
'.1.3.6.1.4.1.1916.2.19' => 'Summit 1iSX',
|
||||
'.1.3.6.1.4.1.1916.2.14' => 'Summit 1iTX',
|
||||
'.1.3.6.1.4.1.1916.2.2' => 'Summit 2',
|
||||
'.1.3.6.1.4.1.1916.2.53' => 'Summit 200-24',
|
||||
'.1.3.6.1.4.1.1916.2.70' => 'Summit 200-24fx',
|
||||
'.1.3.6.1.4.1.1916.2.54' => 'Summit 200-48',
|
||||
'.1.3.6.1.4.1.1916.2.7' => 'Summit 24',
|
||||
'.1.3.6.1.4.1.1916.2.41' => 'Summit 24e2SX',
|
||||
'.1.3.6.1.4.1.1916.2.40' => 'Summit 24e2TX',
|
||||
'.1.3.6.1.4.1.1916.2.25' => 'Summit 24e3',
|
||||
'.1.3.6.1.4.1.1916.2.3' => 'Summit 3',
|
||||
'.1.3.6.1.4.1.1916.2.61' => 'Summit 300-24',
|
||||
'.1.3.6.1.4.1.1916.2.55' => 'Summit 300-48',
|
||||
'.1.3.6.1.4.1.1916.2.4' => 'Summit 4',
|
||||
'.1.3.6.1.4.1.1916.2.58' => 'Summit 400-24',
|
||||
'.1.3.6.1.4.1.1916.2.64' => 'Summit 400-24p',
|
||||
'.1.3.6.1.4.1.1916.2.63' => 'Summit 400-24t',
|
||||
'.1.3.6.1.4.1.1916.2.59' => 'Summit 400-24x',
|
||||
'.1.3.6.1.4.1.1916.2.6' => 'Summit 48',
|
||||
'.1.3.6.1.4.1.1916.2.16' => 'Summit 48i',
|
||||
'.1.3.6.1.4.1.1916.2.28' => 'Summit 48i1u',
|
||||
'.1.3.6.1.4.1.1916.2.5' => 'Summit 4FX',
|
||||
'.1.3.6.1.4.1.1916.2.15' => 'Summit 5i',
|
||||
'.1.3.6.1.4.1.1916.2.21' => 'Summit 5iLX',
|
||||
'.1.3.6.1.4.1.1916.2.22' => 'Summit 5iTX',
|
||||
'.1.3.6.1.4.1.1916.2.12' => 'Summit 7iSX',
|
||||
'.1.3.6.1.4.1.1916.2.13' => 'Summit 7iTX',
|
||||
'.1.3.6.1.4.1.1916.2.30' => 'Summit Px1',
|
||||
'.1.3.6.1.4.1.1916.2.67' => 'SummitStack',
|
||||
'.1.3.6.1.4.1.1916.2.93' => 'Summit Ver2Stack',
|
||||
'.1.3.6.1.4.1.1916.2.68' => 'SummitWM 100',
|
||||
'.1.3.6.1.4.1.1916.2.69' => 'SummitWM 1000',
|
||||
'.1.3.6.1.4.1.1916.2.94' => 'SummitWM 200',
|
||||
'.1.3.6.1.4.1.1916.2.95' => 'SummitWM 2000',
|
||||
'.1.3.6.1.4.1.1916.2.89' => 'Summit X250-24p',
|
||||
'.1.3.6.1.4.1.1916.2.88' => 'Summit X250-24t',
|
||||
'.1.3.6.1.4.1.1916.2.90' => 'Summit X250-24x',
|
||||
'.1.3.6.1.4.1.1916.2.92' => 'Summit X250-48p',
|
||||
'.1.3.6.1.4.1.1916.2.91' => 'Summit X250-48t',
|
||||
'.1.3.6.1.4.1.1916.2.93' => 'Summit X250e-24t (3-Stack)',
|
||||
'.1.3.6.1.4.1.1916.2.88' => 'Summit X250e-24t (Single)',
|
||||
'.1.3.6.1.4.1.1916.2.66' => 'Summit X450-24t',
|
||||
'.1.3.6.1.4.1.1916.2.65' => 'Summit X450-24x',
|
||||
'.1.3.6.1.4.1.1916.2.80' => 'Summit X450a-24tDC',
|
||||
'.1.3.6.1.4.1.1916.2.84' => 'Summit X450a-24x',
|
||||
'.1.3.6.1.4.1.1916.2.82' => 'Summit X450a-24xDC',
|
||||
'.1.3.6.1.4.1.1916.2.76' => 'Summit X450a-48t',
|
||||
'.1.3.6.1.4.1.1916.2.87' => 'Summit X450a-48tDC',
|
||||
'.1.3.6.1.4.1.1916.2.72' => 'Summit X450e-24p',
|
||||
'.1.3.6.1.4.1.1916.2.79' => 'Summit X450e-48p'
|
||||
);
|
||||
|
||||
$rewrite_ironware_hardware = array(
|
||||
@@ -718,38 +718,38 @@ $rewrite_ironware_hardware = array(
|
||||
);
|
||||
|
||||
$rewrite_ios_features = array(
|
||||
'PK9S' => 'IP w/SSH LAN Only',
|
||||
'LANBASEK9' => 'Lan Base Crypto',
|
||||
'LANBASE' => 'Lan Base',
|
||||
'ADVENTERPRISEK9_IVS' => 'Advanced Enterprise Crypto Voice',
|
||||
'ADVENTERPRISEK9' => 'Advanced Enterprise Crypto',
|
||||
'ADVSECURITYK9' => 'Advanced Security Crypto',
|
||||
'K91P' => 'Provider Crypto',
|
||||
'K4P' => 'Provider Crypto',
|
||||
'ADVIPSERVICESK9' => 'Adv IP Services Crypto',
|
||||
'ADVIPSERVICES' => 'Adv IP Services',
|
||||
'IK9P' => 'IP Plus Crypto',
|
||||
'K9O3SY7' => 'IP ADSL FW IDS Plus IPSEC 3DES',
|
||||
'SPSERVICESK9' => 'SP Services Crypto',
|
||||
'PK9SV' => 'IP MPLS/IPV6 W/SSH + BGP',
|
||||
'IS' => 'IP Plus',
|
||||
'IPSERVICESK9' => 'IP Services Crypto',
|
||||
'BROADBAND' => 'Broadband',
|
||||
'IPBASE' => 'IP Base',
|
||||
'IPSERVICE' => 'IP Services',
|
||||
'P' => 'Service Provider',
|
||||
'P11' => 'Broadband Router',
|
||||
'G4P5' => 'NRP',
|
||||
'JK9S' => 'Enterprise Plus Crypto',
|
||||
'IK9S' => 'IP Plus Crypto',
|
||||
'JK' => 'Enterprise Plus',
|
||||
'I6Q4L2' => 'Layer 2',
|
||||
'I6K2L2Q4' => 'Layer 2 Crypto',
|
||||
'C3H2S' => 'Layer 2 SI/EI',
|
||||
'_WAN' => ' + WAN',
|
||||
);
|
||||
'PK9S' => 'IP w/SSH LAN Only',
|
||||
'LANBASEK9' => 'Lan Base Crypto',
|
||||
'LANBASE' => 'Lan Base',
|
||||
'ADVENTERPRISEK9_IVS' => 'Advanced Enterprise Crypto Voice',
|
||||
'ADVENTERPRISEK9' => 'Advanced Enterprise Crypto',
|
||||
'ADVSECURITYK9' => 'Advanced Security Crypto',
|
||||
'K91P' => 'Provider Crypto',
|
||||
'K4P' => 'Provider Crypto',
|
||||
'ADVIPSERVICESK9' => 'Adv IP Services Crypto',
|
||||
'ADVIPSERVICES' => 'Adv IP Services',
|
||||
'IK9P' => 'IP Plus Crypto',
|
||||
'K9O3SY7' => 'IP ADSL FW IDS Plus IPSEC 3DES',
|
||||
'SPSERVICESK9' => 'SP Services Crypto',
|
||||
'PK9SV' => 'IP MPLS/IPV6 W/SSH + BGP',
|
||||
'IS' => 'IP Plus',
|
||||
'IPSERVICESK9' => 'IP Services Crypto',
|
||||
'BROADBAND' => 'Broadband',
|
||||
'IPBASE' => 'IP Base',
|
||||
'IPSERVICE' => 'IP Services',
|
||||
'P' => 'Service Provider',
|
||||
'P11' => 'Broadband Router',
|
||||
'G4P5' => 'NRP',
|
||||
'JK9S' => 'Enterprise Plus Crypto',
|
||||
'IK9S' => 'IP Plus Crypto',
|
||||
'JK' => 'Enterprise Plus',
|
||||
'I6Q4L2' => 'Layer 2',
|
||||
'I6K2L2Q4' => 'Layer 2 Crypto',
|
||||
'C3H2S' => 'Layer 2 SI/EI',
|
||||
'_WAN' => ' + WAN',
|
||||
);
|
||||
|
||||
$rewrite_shortif = array (
|
||||
$rewrite_shortif = array (
|
||||
'tengigabitethernet' => 'Te',
|
||||
'gigabitethernet' => 'Gi',
|
||||
'fastethernet' => 'Fa',
|
||||
@@ -764,9 +764,9 @@ $rewrite_shortif = array (
|
||||
'vlan' => 'Vlan',
|
||||
'tunnel' => 'Tunnel',
|
||||
'serviceinstance' => 'SI',
|
||||
);
|
||||
);
|
||||
|
||||
$rewrite_iftype = array (
|
||||
$rewrite_iftype = array (
|
||||
'/^frameRelay$/' => 'Frame Relay',
|
||||
'/^ethernetCsmacd$/' => 'Ethernet',
|
||||
'/^softwareLoopback$/' => 'Loopback',
|
||||
@@ -783,9 +783,9 @@ $rewrite_iftype = array (
|
||||
'/^aal5$/' => 'ATM AAL5',
|
||||
'/^atmSubInterface$/' => 'ATM Subif',
|
||||
'/^propPointToPointSerial$/' => 'PtP Serial',
|
||||
);
|
||||
);
|
||||
|
||||
$rewrite_ifname = array (
|
||||
$rewrite_ifname = array (
|
||||
'ether' => 'Ether',
|
||||
'gig' => 'Gig',
|
||||
'fast' => 'Fast',
|
||||
@@ -805,149 +805,149 @@ $rewrite_ifname = array (
|
||||
'hp procurve switch software loopback interface' => 'Loopback Interface',
|
||||
'control plane interface' => 'Control Plane',
|
||||
'loop' => 'Loop',
|
||||
);
|
||||
);
|
||||
|
||||
$rewrite_hrDevice = array (
|
||||
$rewrite_hrDevice = array (
|
||||
'GenuineIntel:' => '',
|
||||
'AuthenticAMD:' => '',
|
||||
'Intel(R)' => '',
|
||||
'CPU' => '',
|
||||
'(R)' => '',
|
||||
' ' => ' ',
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
// Specific rewrite functions
|
||||
|
||||
function makeshortif($if)
|
||||
{
|
||||
global $rewrite_shortif;
|
||||
global $rewrite_shortif;
|
||||
|
||||
$if = fixifName ($if);
|
||||
$if = strtolower($if);
|
||||
$if = array_str_replace($rewrite_shortif, $if);
|
||||
$if = fixifName ($if);
|
||||
$if = strtolower($if);
|
||||
$if = array_str_replace($rewrite_shortif, $if);
|
||||
|
||||
return $if;
|
||||
return $if;
|
||||
}
|
||||
|
||||
function rewrite_ios_features ($features)
|
||||
{
|
||||
global $rewrite_ios_features;
|
||||
global $rewrite_ios_features;
|
||||
|
||||
$type = array_preg_replace($rewrite_ios_features, $features);
|
||||
$type = array_preg_replace($rewrite_ios_features, $features);
|
||||
|
||||
return ($features);
|
||||
return ($features);
|
||||
}
|
||||
|
||||
function rewrite_fortinet_hardware ($hardware)
|
||||
{
|
||||
global $rewrite_fortinet_hardware;
|
||||
global $rewrite_fortinet_hardware;
|
||||
|
||||
$hardware = $rewrite_fortinet_hardware[$hardware];
|
||||
$hardware = $rewrite_fortinet_hardware[$hardware];
|
||||
|
||||
return ($hardware);
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_extreme_hardware ($hardware)
|
||||
{
|
||||
global $rewrite_extreme_hardware;
|
||||
global $rewrite_extreme_hardware;
|
||||
|
||||
#$hardware = array_str_replace($rewrite_extreme_hardware, $hardware);
|
||||
$hardware = $rewrite_extreme_hardware[$hardware];
|
||||
#$hardware = array_str_replace($rewrite_extreme_hardware, $hardware);
|
||||
$hardware = $rewrite_extreme_hardware[$hardware];
|
||||
|
||||
return ($hardware);
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
function rewrite_ftos_hardware ($hardware)
|
||||
{
|
||||
global $rewrite_ftos_hardware;
|
||||
global $rewrite_ftos_hardware;
|
||||
|
||||
$hardware = $rewrite_ftos_hardware[$hardware];
|
||||
$hardware = $rewrite_ftos_hardware[$hardware];
|
||||
|
||||
return ($hardware);
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_ironware_hardware ($hardware)
|
||||
{
|
||||
global $rewrite_ironware_hardware;
|
||||
global $rewrite_ironware_hardware;
|
||||
|
||||
$hardware = array_str_replace($rewrite_ironware_hardware, $hardware);
|
||||
$hardware = array_str_replace($rewrite_ironware_hardware, $hardware);
|
||||
|
||||
return ($hardware);
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
function rewrite_junose_hardware ($hardware)
|
||||
{
|
||||
global $rewrite_junose_hardware;
|
||||
global $rewrite_junose_hardware;
|
||||
|
||||
$hardware = array_str_replace($rewrite_junose_hardware, $hardware);
|
||||
$hardware = array_str_replace($rewrite_junose_hardware, $hardware);
|
||||
|
||||
return ($hardware);
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
function fixiftype ($type)
|
||||
{
|
||||
global $rewrite_iftype;
|
||||
global $rewrite_iftype;
|
||||
|
||||
$type = array_preg_replace($rewrite_iftype, $type);
|
||||
$type = array_preg_replace($rewrite_iftype, $type);
|
||||
|
||||
return ($type);
|
||||
return ($type);
|
||||
}
|
||||
|
||||
function fixifName ($inf)
|
||||
{
|
||||
global $rewrite_ifname;
|
||||
global $rewrite_ifname;
|
||||
|
||||
$inf = strtolower($inf);
|
||||
$inf = array_str_replace($rewrite_ifname, $inf);
|
||||
$inf = strtolower($inf);
|
||||
$inf = array_str_replace($rewrite_ifname, $inf);
|
||||
|
||||
return $inf;
|
||||
return $inf;
|
||||
}
|
||||
|
||||
function short_hrDeviceDescr($dev)
|
||||
{
|
||||
global $rewrite_hrDevice;
|
||||
global $rewrite_hrDevice;
|
||||
|
||||
$dev = array_str_replace($rewrite_hrDevice, $dev);
|
||||
$dev = preg_replace("/\ +/"," ", $dev);
|
||||
$dev = trim($dev);
|
||||
$dev = array_str_replace($rewrite_hrDevice, $dev);
|
||||
$dev = preg_replace("/\ +/"," ", $dev);
|
||||
$dev = trim($dev);
|
||||
|
||||
return $dev;
|
||||
return $dev;
|
||||
}
|
||||
|
||||
function short_port_descr ($desc)
|
||||
{
|
||||
list($desc) = explode("(", $desc);
|
||||
list($desc) = explode("[", $desc);
|
||||
list($desc) = explode("{", $desc);
|
||||
list($desc) = explode("|", $desc);
|
||||
list($desc) = explode("<", $desc);
|
||||
$desc = trim($desc);
|
||||
list($desc) = explode("(", $desc);
|
||||
list($desc) = explode("[", $desc);
|
||||
list($desc) = explode("{", $desc);
|
||||
list($desc) = explode("|", $desc);
|
||||
list($desc) = explode("<", $desc);
|
||||
$desc = trim($desc);
|
||||
|
||||
return $desc;
|
||||
return $desc;
|
||||
}
|
||||
|
||||
// Underlying rewrite functions
|
||||
function array_str_replace($array, $string)
|
||||
{
|
||||
foreach ($array as $search => $replace)
|
||||
{
|
||||
$string = str_replace($search, $replace, $string);
|
||||
}
|
||||
foreach ($array as $search => $replace)
|
||||
{
|
||||
$string = str_replace($search, $replace, $string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
return $string;
|
||||
}
|
||||
|
||||
function array_preg_replace($array, $string)
|
||||
{
|
||||
foreach ($array as $search => $replace)
|
||||
{
|
||||
$string = preg_replace($search, $replace, $string);
|
||||
}
|
||||
foreach ($array as $search => $replace)
|
||||
{
|
||||
$string = preg_replace($search, $replace, $string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
return $string;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
+17
-17
@@ -2,53 +2,53 @@
|
||||
|
||||
function rrdtool_update($rrdfile, $rrdupdate)
|
||||
{
|
||||
return rrdtool("update", $rrdfile, $rrdupdate);
|
||||
return rrdtool("update", $rrdfile, $rrdupdate);
|
||||
}
|
||||
|
||||
function rrdtool_create($rrdfile, $rrdupdate)
|
||||
{
|
||||
global $config; global $debug;
|
||||
global $config; global $debug;
|
||||
|
||||
$command = $config['rrdtool'] . " create $rrdfile $rrdupdate";
|
||||
$command = $config['rrdtool'] . " create $rrdfile $rrdupdate";
|
||||
|
||||
if ($debug) { echo($command."\n"); }
|
||||
if ($debug) { echo($command."\n"); }
|
||||
|
||||
return shell_exec($command);
|
||||
return shell_exec($command);
|
||||
|
||||
}
|
||||
|
||||
function rrdtool_fetch($rrdfile, $rrdupdate)
|
||||
{
|
||||
return rrdtool("fetch", $rrdfile, $rrdupdate);
|
||||
return rrdtool("fetch", $rrdfile, $rrdupdate);
|
||||
}
|
||||
|
||||
function rrdtool_graph($rrdfile, $rrdupdate)
|
||||
{
|
||||
return rrdtool("graph", $rrdfile, $rrdupdate);
|
||||
return rrdtool("graph", $rrdfile, $rrdupdate);
|
||||
}
|
||||
|
||||
function rrdtool_last($rrdfile, $rrdupdate)
|
||||
{
|
||||
return rrdtool("last", $rrdfile, $rrdupdate);
|
||||
return rrdtool("last", $rrdfile, $rrdupdate);
|
||||
}
|
||||
|
||||
function rrdtool_lastupdate($rrdfile, $rrdupdate)
|
||||
{
|
||||
return rrdtool("lastupdate", $rrdfile, $rrdupdate);
|
||||
return rrdtool("lastupdate", $rrdfile, $rrdupdate);
|
||||
}
|
||||
|
||||
function rrdtool($command, $file, $options)
|
||||
{
|
||||
global $config; global $debug;
|
||||
global $config; global $debug;
|
||||
|
||||
$command = $config['rrdtool'] . " $command $file $options";
|
||||
if ($config['rrdcached'])
|
||||
{
|
||||
$command .= " --daemon " . $config['rrdcached'];
|
||||
}
|
||||
$command = $config['rrdtool'] . " $command $file $options";
|
||||
if ($config['rrdcached'])
|
||||
{
|
||||
$command .= " --daemon " . $config['rrdcached'];
|
||||
}
|
||||
|
||||
if ($debug) { echo($command."\n"); }
|
||||
return shell_exec($command);
|
||||
if ($debug) { echo($command."\n"); }
|
||||
return shell_exec($command);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
function add_service($service) {
|
||||
function add_service($service) {
|
||||
global $id;
|
||||
global $hostname;
|
||||
echo("$service ");
|
||||
$sql = "INSERT INTO `services` (`device_id`,`service_ip`,`service_type`,`service_desc`,`service_param`,`service_ignore`)
|
||||
VALUES ('" . mres($id). "','" . mres($hostname) . "','" . mres($service) . "',
|
||||
'" . mres("auto discovered: $service") . "','" . mres("") . "','0')";
|
||||
VALUES ('" . mres($id). "','" . mres($hostname) . "','" . mres($service) . "',
|
||||
'" . mres("auto discovered: $service") . "','" . mres("") . "','0')";
|
||||
|
||||
$query = mysql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+615
-615
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,8 @@ log_event("SNMP Trap: linkDown " . $interface['ifDescr'], $device, "interface",
|
||||
#}
|
||||
if ($ifOperStatus != $interface['ifOperStatus'])
|
||||
{
|
||||
log_event("Interface went Down : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['interface_id']);
|
||||
mysql_query("UPDATE `ports` SET ifOperStatus = 'down' WHERE `interface_id` = '".$interface['interface_id']."'");
|
||||
log_event("Interface went Down : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['interface_id']);
|
||||
mysql_query("UPDATE `ports` SET ifOperStatus = 'down' WHERE `interface_id` = '".$interface['interface_id']."'");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
+25
-25
@@ -3,34 +3,34 @@
|
||||
# FIXME not used, do we still need this?
|
||||
|
||||
function callsgraphSNOM ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$optsa = array( "--start", $from, "--end", $to, "--width", $width, "--height", $height, "--vertical-label", $vertical ,"--alt-autoscale-max",
|
||||
"-l 0",
|
||||
"-E",
|
||||
"--title", $title,
|
||||
"DEF:call=$database:CALLS:AVERAGE",
|
||||
"CDEF:calls=call,360,*",
|
||||
"LINE1.25:calls#FF9900:Calls",
|
||||
"GPRINT:calls:LAST:Cu\: %2.0lf/min",
|
||||
"GPRINT:calls:AVERAGE:Av\: %2.0lf/min",
|
||||
"GPRINT:calls:MAX:Mx\: %2.0lf/min\\n");
|
||||
if($width <= "300") {$optsb = array("--font", "LEGEND:7:".$config['mono_font']."",
|
||||
"--font", "AXIS:6:".$config['mono_font']."",
|
||||
"--font-render-mode", "normal");}
|
||||
global $config;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$optsa = array( "--start", $from, "--end", $to, "--width", $width, "--height", $height, "--vertical-label", $vertical ,"--alt-autoscale-max",
|
||||
"-l 0",
|
||||
"-E",
|
||||
"--title", $title,
|
||||
"DEF:call=$database:CALLS:AVERAGE",
|
||||
"CDEF:calls=call,360,*",
|
||||
"LINE1.25:calls#FF9900:Calls",
|
||||
"GPRINT:calls:LAST:Cu\: %2.0lf/min",
|
||||
"GPRINT:calls:AVERAGE:Av\: %2.0lf/min",
|
||||
"GPRINT:calls:MAX:Mx\: %2.0lf/min\\n");
|
||||
if($width <= "300") {$optsb = array("--font", "LEGEND:7:".$config['mono_font']."",
|
||||
"--font", "AXIS:6:".$config['mono_font']."",
|
||||
"--font-render-mode", "normal");}
|
||||
|
||||
$opts = array_merge($config['rrdgraph_defaults'], $optsa, $optsb);
|
||||
$opts = array_merge($config['rrdgraph_defaults'], $optsa, $optsb);
|
||||
|
||||
$ret = rrd_graph("$imgfile", $opts, count($opts));
|
||||
$ret = rrd_graph("$imgfile", $opts, count($opts));
|
||||
|
||||
if( !is_array($ret) ) {
|
||||
$err = rrd_error();
|
||||
echo("rrd_graph() ERROR: $err\n");
|
||||
return FALSE;
|
||||
} else {
|
||||
return $imgfile;
|
||||
}
|
||||
if( !is_array($ret) ) {
|
||||
$err = rrd_error();
|
||||
echo("rrd_graph() ERROR: $err\n");
|
||||
return FALSE;
|
||||
} else {
|
||||
return $imgfile;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user