mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
junos atm vp collection! konijntjetijd!
git-svn-id: http://www.observium.org/svn/observer/trunk@981 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -15,7 +15,9 @@ if($device['os'] == "junose" && $config['enable_ports_junoseatmvp'])
|
||||
if(is_array($vp_array[$device['device_id']])) {
|
||||
foreach($vp_array[$device['device_id']] as $index => $entry) {
|
||||
|
||||
list($interface_id,$vp_id)= explode('.', $index);
|
||||
list($ifIndex,$vp_id)= explode('.', $index);
|
||||
|
||||
$interface_id = mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$ifIndex."'"),0);
|
||||
|
||||
if(is_numeric($interface_id) && is_numeric($vp_id)) {
|
||||
discover_juniAtmvp($valid_vp, $interface_id, $vp_id, NULL);
|
||||
|
77
includes/polling/junose-atm-vp.inc.php
Executable file
77
includes/polling/junose-atm-vp.inc.php
Executable file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `ports` AS P, `juniAtmVp` AS J WHERE P.`device_id` = '".$device['device_id']."' AND J.interface_id = P.interface_id";
|
||||
echo("$sql");
|
||||
$vp_data = mysql_query($sql);
|
||||
|
||||
if(mysql_affected_rows()) {
|
||||
|
||||
|
||||
$vp_cache = array();
|
||||
$vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsInCells", $vp_cache, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsInPackets", $vp_cache, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsInPacketOctets", $vp_cache, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsInPacketErrors", $vp_cache, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsOutCells", $vp_cache, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsOutPackets", $vp_cache, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsOutPacketOctets", $vp_cache, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsOutPacketErrors", $vp_cache, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$vp_cache = $vp_cache[$device[device_id]];
|
||||
|
||||
echo("Checking JunOSe ATM vps: ");
|
||||
|
||||
while($vp=mysql_fetch_array($vp_data)) {
|
||||
|
||||
echo(".");
|
||||
|
||||
$oid = $vp['ifIndex'].".".$vp['vp_id'];
|
||||
|
||||
if($debug) { echo("$oid "); }
|
||||
|
||||
$t_vp = $vp_cache[$oid];
|
||||
|
||||
$vp_update = $t_vp['juniAtmVpStatsInCells'].":".$t_vp['juniAtmVpStatsOutCells'];
|
||||
$vp_update .= ":".$t_vp['juniAtmVpStatsInPackets'].":".$t_vp['juniAtmVpStatsOutPackets'];
|
||||
$vp_update .= ":".$t_vp['juniAtmVpStatsInPacketOctets'].":".$t_vp['juniAtmVpStatsOutPacketOctets'];
|
||||
$vp_update .= ":".$t_vp['juniAtmVpStatsInPacketErrors'].":".$t_vp['juniAtmVpStatsOutPacketErrors'];
|
||||
|
||||
$rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("vp-" . $vp['ifIndex'] . "-".$vp['vp_id'].".rrd");
|
||||
|
||||
if($debug) { echo("$rrd "); }
|
||||
|
||||
if (!is_file($rrd)) {
|
||||
|
||||
rrdtool_create ($rrd, "--step 300 \
|
||||
DS:incells:DERIVE:600:0:125000000000 \
|
||||
DS:outcells:DERIVE:600:0:125000000000 \
|
||||
DS:inpackets:DERIVE:600:0:125000000000 \
|
||||
DS:outpackets:DERIVE:600:0:125000000000 \
|
||||
DS:inpacketoctets:DERIVE:600:0:125000000000 \
|
||||
DS:outpacketoctets:DERIVE:600:0:125000000000 \
|
||||
DS:inpacketerrors:DERIVE:600:0:125000000000 \
|
||||
DS:outpacketerrors:DERIVE:600:0:125000000000 \
|
||||
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:MIN:0.5:1:600 \
|
||||
RRA:MIN:0.5:6:700 \
|
||||
RRA:MIN:0.5:24:775 \
|
||||
RRA:MIN: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_update($rrd,"N:$vp_update");
|
||||
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
|
||||
unset($vp_cache);
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user