2014年8月13日 星期三

【Cisco EEM】Shutdown ISDN at Daily 18:00

使用Cisco EEM applet星期一至星期五自動shutdown isdn interface BRI0/0/0

=====================Cisco Router 1841 Configure=====================
event manager applet ShutdownISDN
 event timer cron name MonFri cron-entry "0 18 * * 1-5"
 action 1 cli command "enable"
 action 2 cli command "config term"
 action 3 cli command "interface bri0/0/0"
 action 4 cli command "shutdown"
 action 5 cli command "end"
 action 6 syslog msg "Shutdown BRI0/0/0 at 18:00"
!

=====================Show EEM policy registered=====================
TCB2NCCC#show event manager policy registered

No.  Class   Type    Event Type          Trap  Time Registered           Name
1    applet  system  timer cron          Off   Wed Aug 13 15:28:41 2014  ShutdownISDN
 name {MonFri} cron entry {0 18 * * 1-5}
 action 1 cli command "enable"
 action 2 cli command "config term"
 action 3 cli command "interface bri0/0/0"
 action 4 cli command "shutdown"
 action 5 cli command "end"
 action 6 syslog msg "Shutdown BRI0/0/0 at 18:00"


2014年8月5日 星期二

【Cacti】導入模板報錯 Error: XML: Hash version does not exist.

將新版本到處的cacti模板導入到舊版本的時候,就會報Error: XML: Hash version does not exist., 
解决的辦法是修改xml裏面的相關hash值就可以了。 

以下是cacti xml hash的一些說明: 


Take the following example: 

0018258d1c9487a6c58dd804f4a012007664> 
The first 2 digits are the type of the template. 
The next 4 digits are the Cacti version it was created on. 
The next 32 digits are a random number. 

"0.8.4"  => "0000",    
"0.8.5"  => "0001",    
"0.8.5a" => "0002",    
"0.8.6"  => "0003",    
"0.8.6a" => "0004",    
"0.8.6b" => "0005",    
"0.8.6c" => "0006",    
"0.8.6d" => "0007",    
"0.8.6e" => "0008",    
"0.8.6f" => "0009",    
"0.8.6g" => "0010",    
"0.8.6h" => "0011",    
"0.8.6i" => "0012",    
"0.8.6j" => "0013",    
"0.8.7"  => "0014",    
"0.8.7a" => "0015",    
"0.8.7b" => "0016",    
"0.8.7c" => "0017",    
"0.8.7d" => "0018"   
"0.8.7e" => "0019"   

For the example above, this template was exported with Cacti 0.8.7d. 

所以需要導入新版cacti模板的時候,只需要修改hash裏面的version相關字段即可。

【Thecus N16000Pro】rSyslog



###   ps | grep rsyslog ###

# ps | grep rsyslog
11595 root      311m S    /raid/data/module/rSyslog/system/sbin/rsyslogd -x -c5


###   cat /raid/data/module/rSyslog/system/etc/rsyslog-user.conf   ###

##
## User configuration managed through the web UI
##
## Create a share or use an existing share and replace /PATH/TO/SHARE with the actual path
## to the share. If the share resides on the master RAID the path would be
## "/raid/data/SHARENMAME" with SHARENAME being the name of the share.
##
## !!! Avoid spaces in the share name !!!
##
## The following modules are pre-loaded from the main configuration file:
##
##     immark
##     imuxsock
##     imklog
##

### COMMENT OUT OR REMOVE THE LINE BELOW WHEN YOU FINISHED CONFIGURATION ###
#NotYetConfigured
if $source == 'TP-N16000PRO' and $syslogseverity <= '6' then /raid/data/log/messages
# Log anything (except mail) of level info or higher. Don't log private authentication messages!
#*.info;mail.none;authpriv.none;cron.none                -/raid/data/log/messages

# The authpriv file has restricted access.
authpriv.*                                               /raid/data/log/secure

# Log all the mail messages in one place.
mail.*                                                  -/raid/data/log/maillog

# Log cron stuff
cron.*                                                  -/raid/data/log/cron

## ######### Receiving Messages from Remote Hosts ##########
## TCP Syslog Server: provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514 # start up TCP listener at port 514

## UDP Syslog Server: provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514 # start a UDP syslog server at standard port 514
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$RepeatedMsgReduction on
$AllowedSender UDP, 127.0.0.1, 10.90.90.245/32, 10.90.90.210/32, 192.168.90.254/32, 10.172.26.244/32, 192.168.14.252/32, 172.16.127.244/32, 10.211.0.88, 10.211.0.89, 10.211.0.250

$template tpe-asa5550,"/raid/data/syslog/tpe-asa5550/tpe-asa5550-%$YEAR%%$MONTH%%$DAY%.log"
if $fromhost-ip == '10.90.90.245' then -?tpe-asa5550

$template tpe-F800,"/raid/data/syslog/tpe-F800/tpe-F800-%$YEAR%%$MONTH%%$DAY%.log"
if $fromhost-ip == '10.90.90.210' then -?tpe-F800

$template tpe-E8500,"/raid/data/syslog/tpe-E8500/tpe-E8500-%$YEAR%%$MONTH%%$DAY%.log"
if $fromhost-ip == '192.168.90.254' then -?tpe-E8500

$template tpe-E2400,"/raid/data/syslog/tpe-E2400/tpe-E2400-%$YEAR%%$MONTH%%$DAY%.log"
if $fromhost-ip == '10.172.26.244' then -?tpe-E2400

$template tpe-014pix,"/raid/data/syslog/tpe-014pix/tpe-014pix-%$YEAR%%$MONTH%%$DAY%.log"
if $fromhost-ip == '192.168.14.252' then -?tpe-014pix

$template tpe-hqpix,"/raid/data/syslog/tpe-hqpix/tpe-hqpix-%$YEAR%%$MONTH%%$DAY%.log"
if $fromhost-ip == '172.16.127.244' then -?tpe-hqpix

$template tpe-4506-01,"/raid/data/syslog/tpe-4506-01/tpe-4506-01-%$YEAR%%$MONTH%%$DAY%.log"
if $fromhost-ip == '10.211.0.88' then -?tpe-4506-01

$template tpe-4506-02,"/raid/data/syslog/tpe-4506-02/tpe-4506-02-%$YEAR%%$MONTH%%$DAY%.log"
if $fromhost-ip == '10.211.0.89' then -?tpe-4506-02

$template tpe-7609,"/raid/data/syslog/tpe-7609/tpe-7609-%$YEAR%%$MONTH%%$DAY%.log"
if $fromhost-ip == '10.211.0.250' then -?tpe-7609

【Thecus N16000Pro】/raid/data/log/dailytar.sh




cat dailytar.sh
#!/bin/sh
cd /raid/syslog/tpe-asa5550/
fname=`find -mmin +1 -type f -name '*.log'`
md5sum $fname > $fname.md5
tar -zcvf $fname.tar.gz $fname* --remove-files
md5sum $fname.tar.gz > $fname.tar.gz.md5
cd /raid/syslog/tpe-F800/
fname=`find -mmin +1 -type f -name '*.log'`
md5sum $fname > $fname.md5
tar -zcvf $fname.tar.gz $fname* --remove-files
md5sum $fname.tar.gz > $fname.tar.gz.md5
cd /raid/syslog/tpe-E8500/
fname=`find -mmin +1 -type f -name '*.log'`
md5sum $fname > $fname.md5
tar -zcvf $fname.tar.gz $fname* --remove-files
md5sum $fname.tar.gz > $fname.tar.gz.md5
cd /raid/data/syslog/tpe-E2400/
fname=`find -mmin +1 -type f -name '*.log'`
md5sum $fname > $fname.md5
tar -zcvf $fname.tar.gz $fname* --remove-files
md5sum $fname.tar.gz > $fname.tar.gz.md5
cd /raid0/data/syslog/tpe-hqpix/
fname=`find -mmin +1 -type f -name '*.log'`
md5sum $fname > $fname.md5
tar -zcvf $fname.tar.gz $fname* --remove-files
md5sum $fname.tar.gz > $fname.tar.gz.md5
cd /raid0/data/syslog/tpe-014pix/
fname=`find -mmin +1 -type f -name '*.log'`
md5sum $fname > $fname.md5
tar -zcvf $fname.tar.gz $fname* --remove-files
md5sum $fname.tar.gz > $fname.tar.gz.md5
cd /raid0/data/syslog/tpe-4506-01/
fname=`find -mmin +1 -type f -name '*.log'`
md5sum $fname > $fname.md5
tar -zcvf $fname.tar.gz $fname* --remove-files
md5sum $fname.tar.gz > $fname.tar.gz.md5
cd /raid0/data/syslog/tpe-4506-02/
fname=`find -mmin +1 -type f -name '*.log'`
md5sum $fname > $fname.md5
tar -zcvf $fname.tar.gz $fname* --remove-files
md5sum $fname.tar.gz > $fname.tar.gz.md5
cd /raid0/data/syslog/tpe-7609/
fname=`find -mmin +1 -type f -name '*.log'`
md5sum $fname > $fname.md5
tar -zcvf $fname.tar.gz $fname* --remove-files
md5sum $fname.tar.gz > $fname.tar.gz.md5