免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1457 | 回复: 0
打印 上一主题 下一主题

发一个取M/T路由器信息的script,要求加精 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-08-26 20:47 |只看该作者 |倒序浏览
在各位购买的JUNIPER M/T系列骨干路由器出了故障以后,如果不是配置问题,则需要escalate到JTAC[JUNIPER TECHNICAL ASSISTANCE CENTER]来处理,JTAC工程师在接收到CASE以后,一般会要求提供各种软硬件信息,下面这个SCRIPT就是用来收集这样的信息的,这样可以省得大家敲命令了  
# ------------ what's showtac
# showtac is a script to collect Juniper router current status information
# the output is saved in a log file under the log directory

# the log file name reflects the time the log is taken

# ------------ version info ---------------

# this is version 6

# differences between version 5
# 1. added M320 commands eyw

# differences between version 4
# 1. added T640/T320/M7i/M10i commands
# 2. added IS-IS commands
# 3. added additional statistics gathering commands

# differences between version

# 1. added m40e commands

# differences between version
# 1. added 'show chassis environment routing-engine' for M160 RRW

# differences between version 1
# 1. detailed installation steps

# differences between prior versions r
# 1. added comments on script installation on older versions JUNOS )
# 2. added missing 'hour' in log filename

# ------------ installation ---------------

# this is an example of installation which puts the script under your home directory 2
# you can also put the script in other directories if you are familiar with Unix 0KfWF
#    user@router> start shell

......    <--- copy and paste the complete content of this script file here MT
#   ^D          <--- then ^D ( Ctrl + D ) on a new line W6Wt
#    % chmod +x showtac eQ
#    % exit bZR
#    user@router> 9zdROem

# this is an example of running the script, assuming that you've put the script under your home directory
#    user@router> start shell PdDI
#    % ./showtac xkC
#    % exit /

# you should be able to see the log file by:
#    user@router> show log ?
-
# on some older versions JUNOS, /var/log directory doesn't allow you to create log file }

# thus when you use the script it will abort the script and says sx@
#   ......showtac: cannot create /var/log/...... : permission denied f<

# you need to fix the /var/log directory permission bits by
#    % su ^R-s33[iOM  
#    % chmod go+w /var/log _

# ------------ script definition ---------------

# log filename is in the format of /var/log/hostname-log-YYYY-MM-DD-HH-MM-SS P

filename="/var/log/"`hostname`"-log-"`date +%Y-%m-%d-%H-%M-%S` TFtG-u|8T  

# prompt is in the format of username@hostname> ,0%`rq]@0{  
prompt=`whoami`"@"`hostname`">"

# subroutine to log the prompt & command , then the command output, then a blank line "
# $@ doesn't work so need workaround, thus assumes no more than 9 words on CLI command line v

   echo $prompt $1 $2 $3 $4 $5 $6 $7 $8 $9 >>$filename )
   cli -c "$1 $2 $3 $4 $5 $6 $7 $8 $9" >>$filename B=|K BNi  
   echo >>$filename [RP"A:V  
} 2INbJ5kI  

# here begins the actual script, you can add your commands here ;*f9DlPy  

run show version P(^=mxOA  

# get router model from 'show version' output sy
model=`grep -i model $filename | awk '{print $2}'`

run show chassis hardware #
run show chassis routing-engine 

# model dependent PFE commands tKaw[rc[  

case $model in
m5|m10) rgRXQ[V  
   run show chassis feb

m7i|m10i) 'P&fTrgu~  
   run show chassis cfeb SqOg$LbY0  

m20)
   run show chassis ssb ZUl#qXCq  

m40) iX1Qmn} `  
   run show chassis scb sG
;; Qiw&xaMp6  
m160|m40e)
   run show chassis sfm
   run show chassis sfm detail

t640|t320|m320) .w
   run show chassis sibs 'Fjt04"=  
   run show chassis spmb R0 =!G:%9G  



run show chassis fpc y""w<ga(;  
run show chassis fpc detail Q->-&MC^  
run show chassis environment En["RM ei  
NB%\w>:V1  
# model dependent environment commands {&$E3,  

case $model in %
m160|m40e) rgGl
   run show chassis environment pem
   run show chassis environment pcg
   run show chassis environment mcs
   run show chassis environment
  
   run show chassis environment
   run show chassis environment fpm

t640|t320|m320)
   run show chassis environment pem
   run show chassis environment scg
O  
   run show chassis environment cb
z  
   run show chassis environment sib

   run show chassis environment fpc

   run show chassis environment fpm

esac Q>Y|SofOs2  

run show chassis alarm

# routing-engine general health BIJ4

run show task memory =I S
run show system buffer I( f
run show system process extensive
run show system queue
run show system virtual-memory
run show system connections ZWAR

# general routing and routing protocols

run show route summary

run show ospf interface extensive
run show ospf neighbor extensive p
run show ospf statistics

run show isis interface extensive
run show isis adjacency extensive
u  
run show isis statistics
run show isis spf log G

run show bgp summary
run show bgp neighbor &

# traffic statistics

run show system statistics
run show pfe statistics error
run show pfe statistics dma +d
run show pfe statistics notification
run show pfe statistics traffic P
run show pfe statistics ip icmp s

# miscellaneous 

nd*n
run show system storage 2
run file list /var/log detail ''a~
run file list /var/crash detail H
run file list /var/tmp detail

                      转自:杜松之家
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP