2568|0

64

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

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

在各位购买的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 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


                转自:杜松之家
点赞 关注

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表