Exemplo n.º 1
0
         list(, $ifIndex) = explode('.', $sensor_port['0']['entAliasMappingIdentifier']);
         $port = get_port_by_index_cache($device['device_id'], $ifIndex);
         if (is_array($port)) {
             // Hola, port really found
             $options['entPhysicalIndex_measured'] = $ifIndex;
             $options['measured_class'] = 'port';
             $options['measured_entity'] = $port['port_id'];
             print_debug("Port is found: ifIndex = {$ifIndex}, port_id = " . $port['port_id']);
         }
     }
     break;
     // Exit while
 } else {
     if ($device['os'] == 'arista_eos' && $sensor_port['entPhysicalClass'] == 'container' && strlen($sensor_port['entPhysicalAlias'])) {
         // Arista not have entAliasMappingIdentifier, but used entPhysicalAlias as ifDescr
         $port_id = get_port_id_by_ifDescr($device['device_id'], $sensor_port['entPhysicalAlias']);
         if (is_numeric($port_id)) {
             // Hola, port really found
             $port = get_port_by_id($port_id);
             $ifIndex = $port['ifIndex'];
             $options['entPhysicalIndex_measured'] = $ifIndex;
             $options['measured_class'] = 'port';
             $options['measured_entity'] = $port_id;
             print_debug("Port is found: ifIndex = {$ifIndex}, port_id = " . $port_id);
             break;
             // Exit while
         }
         $sensor_index = $sensor_port['entPhysicalContainedIn'];
         // Next ifIndex
     } else {
         if ($sensor_index == $sensor_port['entPhysicalContainedIn']) {
Exemplo n.º 2
0
 if (is_numeric($device['device_id'])) {
     if (is_numeric($vars['ifindex'])) {
         // Get port by ifIndex
         $port = get_port_by_index_cache($device['device_id'], $vars['ifindex']);
         if ($port) {
             $vars['id'] = $port['port_id'];
         }
     } elseif (!empty($vars['ifdescr'])) {
         // Get port by ifDescr
         $port_id = get_port_id_by_ifDescr($device['device_id'], $vars['ifdescr']);
         if ($port_id) {
             $vars['id'] = $port_id;
         }
     } elseif (!empty($vars['port'])) {
         // Get port by ifDescr (backward compatibility)
         $port_id = get_port_id_by_ifDescr($device['device_id'], $vars['port']);
         if ($port_id) {
             $vars['id'] = $port_id;
         }
     } elseif (!empty($vars['ifalias'])) {
         // Get port by ifAlias
         $port_id = get_port_id_by_ifAlias($device['device_id'], $vars['ifalias']);
         if ($port_id) {
             $vars['id'] = $port_id;
         }
     }
 } elseif (!empty($vars['circuit'])) {
     // Get port by circuit id
     $port_id = get_port_id_by_customer(array('circuit' => $vars['circuit']));
     if ($port_id) {
         $vars['id'] = $port_id;
Exemplo n.º 3
0
// If there is no device specified in the URL, generate an error.
if (empty($vars['device'])) {
    print_error('<h4>No device specified</h4>
                   A valid device was not specified in the URL. Please retype and try again.');
    return;
}
// Allow people to see this page if they have permission to see one of the ports, but don't show them tabs.
$permit_tabs = array();
if ($vars['tab'] == "port" && is_numeric($vars['device']) && (isset($vars['port']) || isset($vars['ifdescr']))) {
    // If we've been given a 'ifdescr' variable, try to work out the port_id from this
    if (!is_numeric($vars['port']) && !empty($vars['ifdescr'])) {
        $ifdescr = base64_decode($vars['ifdescr']);
        if (!$ifdescr) {
            $ifdescr = $vars['ifdescr'];
        }
        $vars['port'] = get_port_id_by_ifDescr($vars['device'], $ifdescr);
    }
    if (port_permitted($vars['port']) && $vars['device'] == get_device_id_by_port_id($vars['port'])) {
        $permit_tabs['ports'] = TRUE;
    }
}
if ($vars['tab'] == "health" && is_numeric($vars['id']) && isset($vars['id'])) {
    if (is_entity_permitted($vars['id'], 'sensor')) {
        $permit_tabs['health'] = TRUE;
    }
}
// print_vars($permit_tabs);
// If there is no valid device specified in the URL, generate an error.
if (!isset($cache['devices']['id'][$vars['device']]) && !count($permit_tabs)) {
    print_error('<h4>No valid device specified</h4>
                  A valid device was not specified in the URL. Please retype and try again.');
Exemplo n.º 4
0
     $peer_rdns = '';
     $peer_addr = '';
     // Unset peer address
     print_debug("Not found correct peer address. See snmpwalk for 'jnxVpnRemotePeIdAddress'.");
 }
 if (empty($remote_device)) {
     $remote_device = array('NULL');
 }
 if (!is_numeric($pw['jnxVpnPwAssociatedInterface']) || $pw['jnxVpnPwAssociatedInterface'] <= 0) {
     $pw['jnxVpnPwAssociatedInterface'] = $pw_ifIndex;
 }
 $port = get_port_by_index_cache($device, $pw['jnxVpnPwAssociatedInterface']);
 if (is_numeric($port['port_id'])) {
     $if_id = $port['port_id'];
 } else {
     $if_id = get_port_id_by_ifDescr($device['device_id'], $pw_name);
 }
 $pws_new = array('device_id' => $device['device_id'], 'mib' => 'JUNIPER-VPN-MIB', 'port_id' => $if_id, 'peer_device_id' => $remote_device, 'peer_addr' => $peer_addr, 'peer_rdns' => $peer_rdns, 'pwIndex' => $pw_index, 'pwType' => $pw_type, 'pwID' => $pw['jnxVpnPwLocalSiteId'], 'pwOutboundLabel' => $pw['jnxVpnPwLocalSiteId'], 'pwInboundLabel' => $pw['jnxVpnPwRemoteSiteId'], 'pwPsnType' => $pw['jnxVpnPwTunnelType'] ? $pw['jnxVpnPwTunnelType'] : 'unknown', 'pwDescr' => $pw['jnxVpnPwTunnelName'] ? $pw['jnxVpnPwTunnelName'] : $pw_name, 'pwRowStatus' => $pw['jnxVpnPwRowStatus']);
 if (OBS_DEBUG > 1) {
     print_vars($pws_new);
 }
 if (!empty($pws_cache['pws_db']['JUNIPER-VPN-MIB'][$pw_index])) {
     $pws_old = $pws_cache['pws_db']['JUNIPER-VPN-MIB'][$pw_index];
     $pseudowire_id = $pws_old['pseudowire_id'];
     if (empty($pws_old['peer_device_id'])) {
         $pws_old['peer_device_id'] = array('NULL');
     }
     $update_array = array();
     //var_dump(array_keys($pws_new));
     foreach (array_keys($pws_new) as $column) {
         if ($pws_new[$column] != $pws_old[$column]) {
Exemplo n.º 5
0
/**
 * Observium Network Management and Monitoring System
 * Copyright (C) 2006-2014, Adam Armstrong - http://www.observium.org
 *
 * @package    observium
 * @subpackage webui
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
if (!isset($vars['view'])) {
    $vars['view'] = "graphs";
}
// If we've been given a 'ifdescr' variable, try to work out the port_id from this
if (is_array($device) && empty($vars['port']) && !empty($vars['ifdescr'])) {
    $vars['port'] = get_port_id_by_ifDescr($device['device_id'], base64_decode($vars['ifdescr']));
}
$sql = "SELECT *, `ports`.`port_id` as `port_id`";
$sql .= " FROM  `ports`";
$sql .= " LEFT JOIN  `ports-state` ON  `ports`.port_id =  `ports-state`.port_id";
$sql .= " WHERE `ports`.`port_id` = ?";
$port = dbFetchRow($sql, array($vars['port']));
$port_details = 1;
$hostname = $device['hostname'];
$hostid = $device['port_id'];
$ifname = $port['ifDescr'];
$ifIndex = $port['ifIndex'];
$speed = humanspeed($port['ifSpeed']);
$ifalias = $port['name'];
if ($port['ifPhysAddress']) {
    $mac = (string) $port['ifPhysAddress'];