PHP脚本实现检测骨干网络线路状态

  • 来源: 龙腾软件教程网 作者: 若水   2008-05-09/23:43
  • <?php
        //  以下针对本单位的网络,涉及到的IP地址都是骨干网交换机的管理IP;
    echo "<font color=\"red\"><blink><b>校园骨干网</b></blink></font><br>";
    $count = 1;
    $psize = 65;
    $deadline = 1;
    echo "   线路测试,请等待...\n<br><br>";
    flush();
    exec("ping -c $count -s $psize -w $deadline '192.168.255.252'", $list);
    if (substr($list[1],0,2)=="73")
    print "南校区线路正常"."\n";
    else print "<font color='FF0000'> 南校区线路异常----</font>"."\n";
    echo "<p>";
    unset($list);
    exec("ping -c $count -s $psize -w $deadline '192.168.255.241'", $list);
    if (substr($list[1],0,2)=="73")
    print "北校区线路正常"."\n";
    else print "<font color='FF0000'>北校区线路异常----</font>"."\n";
    echo "<p>";
    unset($list);
    exec("ping -c $count -s $psize -w $deadline '192.168.255.233'", $list);
    if (substr($list[1],0,2)=="73")
    print "市区--大学城线路正常"."\n";
    else print "<font color='FF0000'>市区--大学城线路异常----</font>"."\n";
    echo "<p>";
    unset($list);
    exec("ping -c $count -s $psize -w $deadline '192.168.255.226'", $list);
    //print $list[6];
    if (substr($list[1],0,2)=="73")
    print "1#教学楼线路正常"."\n";
    else print "<font color='FF0000'>1#教学楼线路异常----</font>"."\n";
    echo "<p>";
    unset($list);
    exec("ping -c $count -s $psize -w $deadline '192.168.255.218'", $list);
    if (substr($list[1],0,2)=="73")
    print "4#教学楼线路正常"."\n";
    else print "<font color='FF0000'>4#教学楼线路异常----</font>"."\n";
    echo "<p>";
    unset($list);
    exec("ping -c $count -s $psize -w $deadline '192.168.255.210'", $list);
    if (substr($list[1],0,2)=="73")
    print "5#教学楼线路正常"."\n";
    else print "<font color='FF0000'>5#教学楼线路异常----</font>"."\n";
    ?>
    </pre>
    <?
    flush();
    sleep(3);
    ?>


    评论 {{userinfo.comments}}

    {{money}}

    {{question.question}}

    A {{question.A}}
    B {{question.B}}
    C {{question.C}}
    D {{question.D}}
    提交

    驱动号 更多