0) { $len = is_array($_POST['poe_on']) ? count($_POST['poe_on']) : 0; for ($i = 0; $i < $len; $i ++) { $port_index = intval($_POST['poe_on'][$i]); LOG_DEBUG($db_link, "Device id: $id enable poe at port snmp index $port_index"); set_port_poe_state($switch['vendor_id'], $port_index, $switch['ip'], $switch['rw_community'], $switch['snmp_version'], 1); } header("Location: " . $_SERVER["REQUEST_URI"]); } if (isset($_POST['poe_off']) and $switch['snmp_version']>0) { $len = is_array($_POST['poe_off']) ? count($_POST['poe_off']) : 0; for ($i = 0; $i < $len; $i ++) { $port_index = intval($_POST['poe_off'][$i]); LOG_DEBUG($db_link, "Device id: $id disable poe at port snmp index $port_index"); set_port_poe_state($switch['vendor_id'], $port_index, $switch['ip'], $switch['rw_community'], $switch['snmp_version'], 0); } header("Location: " . $_SERVER["REQUEST_URI"]); } if (isset($_POST['port_on']) and $switch['snmp_version']>0) { $len = is_array($_POST['port_on']) ? count($_POST['port_on']) : 0; for ($i = 0; $i < $len; $i ++) { $port_index = intval($_POST['port_on'][$i]); LOG_DEBUG($db_link, "Device id: $id enable port with snmp index $port_index"); set_port_state($switch['vendor_id'], $port_index, $switch['ip'], $switch['rw_community'], $switch['snmp_version'], 1); } header("Location: " . $_SERVER["REQUEST_URI"]); } if (isset($_POST['port_off']) and $switch['snmp_version']>0) { $len = is_array($_POST['port_off']) ? count($_POST['port_off']) : 0; for ($i = 0; $i < $len; $i ++) { $port_index = intval($_POST['port_off'][$i]); LOG_DEBUG($db_link, "Device id: $id disable port with snmp index $port_index"); set_port_state($switch['vendor_id'], $port_index, $switch['ip'], $switch['rw_community'], $switch['snmp_version'], 0); } header("Location: " . $_SERVER["REQUEST_URI"]); } unset($_POST); require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php"); print_editdevice_submenu($page_url,$id); ?>
\n"; print "Состояние портов ".$switch['device_name']." - ".$switch['ip']."
\n"; if ($switch['snmp_version']>0) { $snmp_ok = check_snmp_access($switch['ip'], $switch['community'], $switch['snmp_version']); if ($snmp_ok) { global $cisco_modules; if ($switch['snmp_version'] == 2) { $modules_oids = snmp2_real_walk($switch['ip'], $switch['community'], $cisco_modules); } if ($switch[snmp_version] == 1) { $modules_oids = snmpreal_walk($switch['ip'], $switch['community'], $cisco_modules); } } } else { $snmp_ok = 0; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($snmp_ok) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "\n"; $sSQL = "SELECT id,snmp_index,port,comment,target_port_id,last_mac_count,uplink,nagios,skip,vlan from device_ports WHERE device_ports.device_id=$id Order by port"; $flist = mysqli_query($db_link, $sSQL); while (list ($d_id, $d_snmp, $d_port, $d_comment, $d_target_id, $d_mac_count, $d_uplink, $d_nagios, $d_skip, $d_vlan) = mysqli_fetch_array($flist)) { print "\n"; $cl = "up"; if (isset($switch['ip']) and ($switch['ip'] != '') and $snmp_ok) { $port_state_detail = get_port_state_detail($d_snmp, $switch['ip'], $switch['community'], $switch['snmp_version'], $switch['fdb_snmp_index']); list ($poper, $padmin, $pspeed, $perrors) = explode(';', $port_state_detail); if (preg_match('/up/i', $poper)) { $cl = "up"; } if (preg_match('/down/i', $poper)) { if (preg_match('/down/i', $padmin)) { $cl = "shutdown"; } else { $cl = "down"; } } } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($snmp_ok) { if ($switch[fdb_snmp_index]) { $vlan = get_port_vlan($d_snmp, $switch['ip'], $switch['community'], $switch['snmp_version'], $switch['fdb_snmp_index']); } else { $vlan = get_port_vlan($d_port, $switch['ip'], $switch['community'], $switch['snmp_version'], $switch['fdb_snmp_index']); } $ifname = get_snmp_ifname($switch['ip'], $switch['community'], $switch['snmp_version'], $d_snmp); $sfp_status = get_sfp_status($switch['vendor_id'], $d_snmp, $switch['ip'], $switch['community'], $switch['snmp_version'], $modules_oids); $poe_status = get_port_poe_state($switch['vendor_id'], $d_snmp, $switch['ip'], $switch['community'], $switch['snmp_version']); if (!isset($vlan)) { $vlan = $d_vlan; } print "\n"; $speed = "0"; $cl_speed = $cl; if ($pspeed == 0) { $speed = ""; } if ($pspeed == 10000000) { $speed = "10M"; $cl_speed = "speed10M"; } if ($pspeed == 100000000) { $speed = "100M"; $cl_speed = "speed100M"; } if ($pspeed == 1000000000) { $speed = "1G"; $cl_speed = "speed1G"; } if ($pspeed == 10000000000) { $speed = "10G"; $cl_speed = "speed10G"; } if ($pspeed == 4294967295) { $speed = "10G"; $cl_speed = "speed10G"; } if ($pspeed == 10) { $speed = "10G"; $cl_speed = "speed10G"; } print "\n"; $cl_error = $cl; if ($perrors > 0) { $cl_error = "crc"; } print "\n"; global $torrus_url; $cacti_url = get_cacti_graph($switch['ip'], $d_snmp); if (! isset($torrus_url) and (! isset($cacti_url))) { print "\n"; } else { if (isset($cacti_url)) { $snmp_url = "" . $ifname . ""; } if (isset($torrus_url)) { $normed_ifname = trim(str_replace("/", "_", $ifname)); $normed_ifname = trim(str_replace(".", "_", $normed_ifname)); $normed_ifname = trim(str_replace(" ", "_", $normed_ifname)); $pattern = '/cisco/i'; preg_match($pattern, $switch['device_model'], $matches); if (isset($matches[0])) { $normed_ifname = trim(str_replace("Gi", "GigabitEthernet", $normed_ifname)); } $t_url = str_replace("HOST_IP", $switch['ip'], $torrus_url); $t_url = str_replace("IF_NAME", $normed_ifname, $t_url); $snmp_url = "" . $ifname . ""; } print "\n"; } print "\n"; if (isset($poe_status) and ! $d_skip and ! $switch['is_router']) { print "\n"; } else { print "\n"; } if (isset($padmin) and ! $d_uplink and ! $d_skip and ! $switch['is_router']) { print "\n"; } } else { print "\n"; } print ""; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
idПортSnmpMac countUplinkNagiosSkipЮзер|DeviceКомментарийVlanSpeedErrorsIfNameAdditionalPOE ControlPort Control
" . $d_port . "" . $d_snmp . "" . get_qa($d_uplink) . "" . get_qa($d_nagios) . "" . get_qa($d_skip) . ""; if (isset($d_target_id) and $d_target_id > 0) { print_device_port($db_link, $d_target_id); } else { print_auth_port($db_link, $d_id); } print "" . $d_comment . "" . $vlan . "" . $speed . "" . $perrors . "" . $ifname . "" . $snmp_url . "" . $sfp_status; if (isset($poe_status)) { if ($poe_status == 1) { $port_poe_detail = get_port_poe_detail($switch['vendor_id'], $d_snmp, $switch['ip'], $switch['community'], $switch['snmp_version']); print "POE:On " . $port_poe_detail; } if ($poe_status == 2) { print "POE:Off"; } } print ""; if ($switch['vendor_id'] != 9) { if ($poe_status == 2) { print ""; } if ($poe_status == 1) { print ""; } } else { print "Not supported"; } print "Not supported"; if ($switch['vendor_id'] != 9) { if (preg_match('/down/i', $padmin)) { print ""; } if (preg_match('/up/i', $padmin)) { print ""; } } else { print "Not supported"; } print "" . $d_vlan . "
snmp start
\n"; print "\n"; print "\n"; print "\n"; print "
Port status
Oper downOper upAdmin shutdown
\n"; print "\n"; print "\n"; print "\n"; print "
Port speed
10M100M1G10G
\n"; print "
"; require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.small.php"); ?>