function snmp_cache_portName($device, $array) { $cmd = gen_snmpwalk_cmd($device, 'portName', ' -CI -OQs', 'CISCO-STACK-MIB'); $output = trim(external_exec($cmd)); // echo("Caching: portName\n"); foreach (explode("\n", $output) as $entry) { $entry = str_replace('portName.', '', $entry); list($slotport, $portName) = explode('=', $entry, 2); $slotport = trim($slotport); $portName = trim($portName); if ($array[$slotport]['ifIndex']) { $ifIndex = $array[$slotport]['ifIndex']; $array[$slotport]['portName'] = $portName; $array[$ifIndex]['portName'] = $portName; } } return $array; }
* @author Tony Murray <*****@*****.**> */ if (!is_admin()) { echo "Insufficient Privileges"; exit; } $hostname = escapeshellcmd($_REQUEST['hostname']); $type = $_REQUEST['type']; switch ($type) { case 'poller': $cmd = "php {$config['install_dir']}/poller.php -h {$hostname} -r -f -d"; $filename = "poller-{$hostname}.txt"; break; case 'snmpwalk': $device = device_by_name(mres($hostname)); $cmd = gen_snmpwalk_cmd($device, '.', ' -Onet'); if ($debug) { $cmd .= ' 2>&1'; } $filename = $device['os'] . '-' . $device['hostname'] . '.snmpwalk'; break; case 'discovery': $cmd = "php {$config['install_dir']}/discovery.php -h {$hostname} -d"; $filename = "discovery-{$hostname}.txt"; break; default: echo 'You must specify a valid type'; exit; } // ---- Output ---- if ($_GET['format'] == 'text') {
* @author Tony Murray <*****@*****.**> */ if (!is_admin()) { echo "Insufficient Privileges"; exit; } $hostname = escapeshellcmd($_REQUEST['hostname']); $type = $_REQUEST['type']; switch ($type) { case 'poller': $cmd = "php {$config['install_dir']}/poller.php -h {$hostname} -r -f -d"; $filename = "poller-{$hostname}.txt"; break; case 'snmpwalk': $device = device_by_name(mres($hostname)); $cmd = gen_snmpwalk_cmd($device, '.', ' -OUneb'); if ($debug) { $cmd .= ' 2>&1'; } $filename = $device['os'] . '-' . $device['hostname'] . '.snmpwalk'; break; case 'discovery': $cmd = "php {$config['install_dir']}/discovery.php -h {$hostname} -d"; $filename = "discovery-{$hostname}.txt"; break; default: echo 'You must specify a valid type'; exit; } // ---- Output ---- if ($_GET['format'] == 'text') {