'; echo "
Свич ".$host_name." (".$sw_type."), порт ".$port_num."
"; echo "
Абонент: $abon_dogov
$no_money
$agg
"; } else { echo '
'; echo "
".$host_name."
".$sw_type."
".$port_num."
"; echo "
$abon_dogov
$no_money
$agg
"; } //echo "
Абонент: $abon_dogov
$no_money
"; $admin_status = "Down"; $oper_status = "Down"; $admin_state = ""; $oper_state = ""; //echo $snmp_allow." ".$sw_model_id; if ($host_reachable){//($snmp_allow == "1"){ error_log($host." ,community=". $community." ,oid=". $admin_oid.$port_oid, 3, self::USER_ERROR_DIR); $admin_state = snmp2_get($host, $community, $admin_oid.$port_oid); $oper_state = snmp2_get($host, $community, $oper_oid.$port_oid); //echo $host.','. $community.','. $oper_oid.$port_oid.'
'; $admin_state = str_replace("INTEGER:", " ", $admin_state); if(preg_match("/(\d+)/", $admin_state, $m)) $admin_state = $m[1]; $oper_state = str_replace("INTEGER:", " ", $oper_state); if(preg_match("/(\d+)/", $oper_state, $m)) $oper_state = $m[1]; //echo $oper_state if ($oper_state == "1"){ switch ($sw_model_id){ case 8: case 26: $mac = mac_huaweiS3026();break; case 11: $mac = mac_hp(); break; // HP Procurve case 6: $mac = mac_cisco(); break;//Cisco default: $mac = mac_dlink(); // D-Link, Alcatel, EdgeCore, Huawei }; }; //echo $oper_state.' - '.$sw_model_id.' - '.$mac; $isepmp = false; if ($sw_model_id == 12){//($isepmp == "1"){ // ePMP $isepmp = true; $mac = mac_epmp($host, $community, $vlan); $oper_state = $mac == '' ? '2' : '1'; if ($vlan != 0) $vlan=$vlan." (".strtoupper(dechex($vlan)).")"; }; $isgpon = false; if ($sw_model_id == 16 or $sw_model_id == 19 or $sw_model_id == 31) {//Gpon BDCOM P3310B or P3310C or P3310D $mac = mac_gpon($host, $community, $vlan); //$oper_state = $mac == '' ? '2' : '1'; $isgpon = true; }; if ($sw_model_id == 24 ){ //Gpon Stels $mac = mac_gpon_stels($host, $community, $vlan); //$oper_state = $mac == '' ? '2' : '1'; $isgpon = true; }; if ($sw_model_id == 32 or $sw_model_id == 33){ //Gpon BDCOM3608 $mac = mac_gpon_bdcom3608($host, $community, $vlan); //$oper_state = $mac == '' ? '2' : '1'; $isgpon = true; }; }; //$snmp_allow == "1" $isepmp != "1" //$visible = $_SESSION['login_role'] == "admin" & $protect == "0" & $host_reachable & !$isepmp & !$isgpon ? "visible" : "hidden"; $visible = "visible"; if ($admin_state == "1"){$admin_status = "Up";}; //if ($oper_state == "2") {$oper_status = "DOWN";}; if ($oper_state == "1") {$oper_status = "Up";}; if (!$host_reachable){$sw_nr ='свич не доступен';}; // Agg interface status //$sshconnection = ssh2_connect('172.25.5.4', 22); //ssh2_auth_password($sshconnection, 'aggint', 'v4n#yKMS1AcmuHbHzXrern3H'); $sshconnection = ssh2_connect('172.25.5.20', 22); ssh2_auth_password($sshconnection, 'aggint', '127001'); $stream = ssh2_exec($sshconnection, '/usr/local/sbin/check-user-int '.$abon_dogov); stream_set_blocking($stream,true); $stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO); $agg_status = stream_get_contents($stream_out); //$agg_status = agg_int_status(); if($type != "xml") { echo "
$sw_nr
$status0
Admin status:
".$admin_status."
$status1
Oper status:
".$oper_status."
$status2
Mac address:
$mac
$status3
Vlan:
$vlan
$status4
Agg int status:
$agg_status
$status5
"; //echo "snmp2_get(".$host.",". $community.",". $oper_oid.$port_oid.")
"; //echo "aaa = ". $admin_state ."
" if ($oper_state != "1") echo "Нет линка на свиче ".$host_name." порт ".$port_num; //echo ""; echo "
$res
"; echo '