# $language = "VBScript"
# $interface = "1.0"
Sub Command(comm)
	crt.screen.send comm & chr(13)
	crt.screen.WaitForString "#"
End Sub
Sub Command1(comm)
	crt.screen.send comm & chr(13)
	crt.screen.WaitForString ">"
End Sub
Sub Command2(comm)
       Dim i
       Command "terminal length 50"
       crt.screen.send comm & chr(13)
       crt.sleep 1500
       For i = 1 to 40      
          crt.screen.send " "  & chr(13)
           crt.sleep 1500
       Next
       crt.screen.send "quit" & chr(13)
       crt.screen.send "    " & chr(13)
       crt.screen.send "    " & chr(13)
	crt.screen.WaitForString "#"
       Command "terminal length 0"      
End Sub
Sub Command3(comm)
       Dim i
       Command "terminal length 50"
       crt.screen.send comm & chr(13)
       For i = 1 to 10      
          crt.screen.send " "  & chr(13)
           crt.sleep 1500
       Next
       crt.screen.send "quit" & chr(13)
       crt.screen.send "    " & chr(13)
       crt.screen.send "    " & chr(13)
	crt.screen.WaitForString "#"
       Command "terminal length 0"     
End Sub
Sub Main
    Dim i
    Server = "10.0.0.0 255.0.0.0"                  '需要查看主机信息的网段
    crt.Screen.Synchronous = False
    Command "enable"	
    Command "end"
    Command "enable"
    Command "configure terminal" 
    Command "line console 0" 
    Command "speed 115200"
    Command "end"
    Command "terminal monitor"    
    Command "terminal length 0"                         '设置对输出的信息条数不做限制
    Command "第1部分：重要信息"
    For i = 1 to 2
        Command2 "show ip fpm flow"                     '显示2000条流记录
        Command "show ip fpm statistics"                '显示流表统计值
        Command "show ip fpm counters"                  '显示流平台计数器
        Command "clear ip fpm counters"                 '清除流平台计数器
        Command "show efmp counter"                     '显示快转计数器
        Command "clear efmp counter"                    '清除快转计数器
        Command "show firewall debug"                   '开启防攻击统计开关
        Command "show firewall counters all"            '显示当前虚墙的防攻击统计值
        Command "show firewall counters global"         '显示整机防攻击的统计值
        Command "clear firewall counters global"        '清楚整机防攻击的统计值
        Command "show firewall debug"                   '关闭防攻击统计开关
        Command "show firewall users total"             '防攻击主机表统计值
        Command3 "show firewall users " & Server        '查看服务器网段的主机表信息
        Command "show firewall fatal"                   '查看防攻击异常统计值
        Command "clear firewall fatal"                  '清除防攻击异常统计值
        Command "show ip fragment-buffer"               '查看分片重组信息
        Command "clear ip fragment-statistic"           '清除分片重组信息
        Command "debug support"                         '进入debug模式
        Command "exec octeon_fpa_regs"                  '查看缓冲区数量
        Command "exit"                                  '退出debug模式
        Command "等待1秒........."
        crt.sleep 1000
     Next
     Command "第2部分：次要信息"
     Command "show logging"                             '查看syslog信息
     Command3 "show firewall dynamic-filter"            '查看ESI规则库
     Command3 "show firewall global-blocking"           '查看防攻击黑名单
     Command3 "show security-access-blocking"           '查看安全域黑名单
     Command3 "show ip nat translations"
     For i = 1 to 2        
        Command "show session-limit status"             '查看网段限速信息
        crt.sleep 1000
     Next
     Command "第3部分：基本信息"
     Command "show ver"                                 '查看版本信息
     Command "show run"                                 '查看配置信息
     Command "show memory"                              '查看内存信息
     Command "show cpu"                                 '查看CPU信息
     Command "debug support"
     Command "show exception"                           '查看异常信息
     Command "exit"
     Command "show clock"                               '查看时间信息
     Command "! Current client's system time is "&Date&" "&Time
     Command "等待1秒"
     crt.sleep 1000
     Command "第4部分：其他信息"
     Command3 "show ip ref route"                       '查看路由表     
     Command3 "show mac-address-table dynamic"          '产看动态mac地址表
     Command3 "show mac-address-table static"           '查看静态mac地址表
     For i = 1 to 2
        Command "debug su"
        Command "exec efmp_dump_rxpnt"                  '查看rxpnt上报文的接受及处理信息,重点关注RX_PKTS,用于判断报文是否均衡         
	 Command "exec efmp_dump_txpnt"                  '查看txpnt上报文的接受及处理信息,重点关注TX_PKTS,用户判断发出阶段是否出错
	 Command "exec dump_skip_vthread"                '查看skip线程及skip队列的相关信息,用于判断skip线程是否异常
	 Command "exec efmp_dump_vthread"                '用于查看快转虚线程信息，用于判断转发核是否挂死：线程状态st为2且sch_cnt的值不变
	 Command "exec efmp_vcpu_running 4095"           '主要用于查看数据核的相关信息:如果某个核没有被输出，则表示该核已经被挂死
        Command "exec efmp_clear_rxpnt"                 
        Command "exec efmp_clear_txpnt"  
	 Command "exit"
        Command "show ef_bridge drop_cnt"               '查看桥组对包信息
        Command "show ef-rnfp all"                      '查看本地防攻击信息
        Command "等待1秒........."
        crt.sleep 1000
     Next
     Command "show failover"
     Command3 "show tcp connect"
     Command "show failover heartbeat"
     Command "show failover history "
     Command "show failover history detail"
     Command "show failover rdnd state"
     Command "show failover rdnd statistic"
     Command "show failover sa_rdnd statistic"
     Command "show aa-forword"
     Command "信息收集结束"
     Command "等待1秒........"
     crt.sleep 1000
     Command "terminal length 25"
End Sub  
