登陆论坛 找回密码 地图 帮助
宽带山生活
版主:疯牛 西风 

<< [1] >>  [只看楼主] 点击数:8 回复数:1 此贴功能: [管理]

主题:发一个取M/T路由器信息的script,要求加精

90

来自:保密
注册:2008-03-08
发帖:6+5 
在各位购买的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转自:杜松之家



-------------------------------------------------------------------------------------------
这个家伙很懒,什么也没留下......

发表于:2008-05-13 16:24:05
推荐:我+老婆+宾得+一盏灯  by 雨加晴  [1001/26] ...楼主...

西风
254712

来自:上海
注册:2003-03-18
发帖:13+65 
嗯。。。不错!



-------------------------------------------------------------------------------------------
What will be will be well,for what is is well.

发表于:2008-05-13 17:12:42
推荐:车展的车子和女子 [图]   by taotao  [466/34] ...第1楼...

回复主题 [ 返回网络安全 ]
主题: 发一个取M/T路由器信息的script,要求加精
回复话题
手机看宽带山

关于我们 - 联系我们 - 加入我们 - 营销服务 - 友情链接 - 频道合作- PChome Widget
Copyright © 1996-2008 PChome.net All rights reserved. 电脑之家 版权所有