diff --git a/discover-cdp.php b/discover-cdp.php deleted file mode 100755 index 81ca9381e1..0000000000 --- a/discover-cdp.php +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/php - $dst_host $dst_if)"); - } else { - echo(".."); - } - } else { - - } -# } - } - - echo("\n"); -} - -?> diff --git a/html/.htaccess b/html/.htaccess index 738e8cb8b7..b128dcd77b 100644 --- a/html/.htaccess +++ b/html/.htaccess @@ -8,6 +8,8 @@ RewriteCond %{REQUEST_URI} !^(.*)\.jpg$ RewriteCond %{REQUEST_URI} !^(.*)\.gif$ RewriteCond %{REQUEST_URI} !^(.*)\.png$ +RewriteRule ^cust/ ?page=cust + RewriteRule ^bare/(.+)/ index-bare.php?page=$1 RewriteRule ^bare/(.+)/(.+)/ index-bare.php?page=$1&opta=$2 RewriteRule ^bare/(.+)/(.+)/(.+)/ index-bare.php?page=$1&opta=$2&optb=$3 diff --git a/includes/functions-poller.inc.php b/includes/functions-poller.inc.php index 8a99ec2b0e..cf8d0986d5 100644 --- a/includes/functions-poller.inc.php +++ b/includes/functions-poller.inc.php @@ -96,7 +96,6 @@ function snmp_cache_slotport_oid($oid, $device, $array, $mib = 0) { $cmd .= $oid; $data = trim(shell_exec($cmd)); $device_id = $device['device_id']; - #echo("Caching: $oid\n"); foreach(explode("\n", $data) as $entry) { $entry = str_replace($oid.".", "", $entry); list($slotport, $value) = explode("=", $entry); @@ -159,12 +158,13 @@ function snmp_cache_portIfIndex ($device, $array) { $cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex"; $output = trim(shell_exec($cmd)); $device_id = $device['device_id']; - #echo("Caching: portIfIndex\n"); foreach(explode("\n", $output) as $entry){ $entry = str_replace("CISCO-STACK-MIB::portIfIndex.", "", $entry); list($slotport, $ifIndex) = explode(" ", $entry); - $array[$device_id][$ifIndex]['portIfIndex'] = $slotport; - $array[$device_id][$slotport]['ifIndex'] = $ifIndex; + if($slotport && $ifIndex){ + $array[$device_id][$ifIndex]['portIfIndex'] = $slotport; + $array[$device_id][$slotport]['ifIndex'] = $ifIndex; + } } return $array; } diff --git a/includes/polling/cisco-poe.inc.php b/includes/polling/cisco-poe.inc.php index 31c24503c9..3231577770 100644 --- a/includes/polling/cisco-poe.inc.php +++ b/includes/polling/cisco-poe.inc.php @@ -4,16 +4,59 @@ if($device['os'] == "IOS") { $array = snmp_cache_portIfIndex ($device, $array); - $cpe_oids = array("cpeExtPsePortEnable", "cpeExtPsePortDiscoverMode", "cpeExtPsePortDeviceDetected", "cpeExtPsePortIeeePd", "cpeExtPsePortAdditionalStatus", "cpeExtPsePortPwrMax", "cpeExtPsePortPwrAllocated", "cpeExtPsePortPwrAvailable", "cpeExtPsePortPwrConsumption", "cpeExtPsePortMaxPwrDrawn", "cpeExtPsePortEntPhyIndex", "cpeExtPsePortEntPhyIndex", "cpeExtPsePortPolicingCapable", "cpeExtPsePortPolicingEnable", "cpeExtPsePortPolicingAction", "cpeExtPsePortPwrManAlloc"); - $peth_oids = array("pethPsePortAdminEnable", "pethPsePortPowerPairsControlAbility", "pethPsePortPowerPairs", "pethPsePortDetectionStatus", "pethPsePortPowerPriority", "pethPsePortMPSAbsentCounter", "pethPsePortType", "pethPsePortPowerClassifications", "pethPsePortInvalidSignatureCounter", "pethPsePortPowerDeniedCounter", "pethPsePortOverLoadCounter", "pethPsePortShortCounter"); + $cpe_oids = array("cpeExtPsePortEnable", "cpeExtPsePortDiscoverMode", "cpeExtPsePortDeviceDetected", "cpeExtPsePortIeeePd", + "cpeExtPsePortAdditionalStatus", "cpeExtPsePortPwrMax", "cpeExtPsePortPwrAllocated", "cpeExtPsePortPwrAvailable", "cpeExtPsePortPwrConsumption", + "cpeExtPsePortMaxPwrDrawn", "cpeExtPsePortEntPhyIndex", "cpeExtPsePortEntPhyIndex", "cpeExtPsePortPolicingCapable", "cpeExtPsePortPolicingEnable", + "cpeExtPsePortPolicingAction", "cpeExtPsePortPwrManAlloc"); + + $peth_oids = array("pethPsePortAdminEnable", "pethPsePortPowerPairsControlAbility", "pethPsePortPowerPairs", "pethPsePortDetectionStatus", + "pethPsePortPowerPriority", "pethPsePortMPSAbsentCounter", "pethPsePortType", "pethPsePortPowerClassifications", "pethPsePortInvalidSignatureCounter", + "pethPsePortPowerDeniedCounter", "pethPsePortOverLoadCounter", "pethPsePortShortCounter"); $sub_start = utime(); echo("Caching Oids: "); foreach ($cpe_oids as $oid) { echo("$oid "); $array = snmp_cache_slotport_oid($oid, $device, $array, "CISCO-POWER-ETHERNET-EXT-MIB"); } - foreach ($peth_oids as $oid) { echo("$oid "); $array = snmp_cache_slotport_oid($oid, $device, $array, "POWER-ETHERNET-MIB"); } + foreach ($peth_oids as $oid) { echo("$oid "); $array = snmp_cache_slotport_oid($oid, $device, $array, "POWER-ETHERNET-MIB"); } $end = utime(); $run = $end - $sub_start; $proctime = substr($run, 0, 5); echo("\n$proctime secs\n"); + $polled = time(); + + $port_query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."'"); + while ($port = mysql_fetch_array($port_query)) { + + if($array[$device[device_id]][$port[ifIndex]]) { // Check to make sure Port data is cached. + + echo(" --> " . $port['ifDescr'] . " POE"); + + /// Update RRDs + $rrdfile = $host_rrd . "/" . $port['ifIndex'] . ".rrd"; + if(!is_file($rrdfile)) { + $woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \ + DS:PortPwrAllocated:GAUGE:600:0:12500000000 \ + DS:PortPwrAvailable:GAUGE:600:0:12500000000 \ + DS:PortConsumption:DERIVE:600:0:12500000000 \ + DS:PortMaxPwrDrawn:GAUGE: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"); + } + + $woo = "$polled:".$port['cpeExtPsePortPwrAllocated'].":".$port['cpeExtPsePortPwrAvailable'].":".$port['cpeExtPsePortPwrConsumption'].":".$port['cpeExtPsePortMaxPwrDrawn']; + $ret = rrdtool_update("$rrdfile", $woo); + + /// End Update POE-RRD + + } + + } + + }