manage running-config in git
[dell-switch] / README
1 # manage Dell switch running-config in git
2
3 dpavlin@black:~/dell-switch$ ./sw-running-config.sh sw-dpc
4
5
6
7 # ssh auto-login script for Dell switches
8
9 ./ips | xargs -i ./dell-switch.pl {} "show bridge address"
10
11 ./ips | xargs -i ./dell-switch.pl {} "show interfaces status"
12
13 ./ips | xargs -i ./dell-switch.pl {} "show running-config"
14
15 This will save all commands executed to git repository under log/
16
17 However, somethimes you just need to execute few commands but don't want
18 log output (if configuring switches in batch, for example). You can do
19 that by setting NO_LOG enviroment variable like this:
20
21 grep -A 1 sw-lib /etc/munin/munin.conf | grep 10.20 | awk '{ print $2 }' \
22 | NO_LOG=1 xargs -i ./dell-switch.pl 'snmp-server community public-or-not ro view Default' 'exit' 'copy running-config startup-config'
23
24
25 To use fans script first pull show system from all switches:
26
27 ./ips | xargs -i ./dell-switch.pl {} "show system"
28
29
30 Backup switch configuration to tftp server:
31
32 ./ips 1,2 | awk '{ print "./dell-switch.pl "$1" \"copy startup-config tftp://10.20.0.253/backups/"$2".config\"" }' | NO_LOG=1 sh -x
33
34
35 To use snmp* utils, create snmp.conf with:
36
37 COMMUNITY=my-comminity-or-public
38
39
40 # Find mac address on network
41
42 collect all mac addresses using snmp
43
44 dpavlin@black:~/dell-switch$ ./sw-mac-port.sh 
45
46 find interesting mac
47
48 dpavlin@black:~/dell-switch$ ./find-port-for-mac 00:1e:8c:0a:49:3c # eeepy eth0
49 sw-e300 1 00:1e:8c:0a:49:3c 23
50 sw-e300-2 1 00:1e:8c:0a:49:3c 21
51 # mac 00:1e:8c:0a:49:3c on 41 switches
52
53 dpavlin@black:~/dell-switch$ ./find-port-for-mac 00:80:c8:37:6d:76 # eeepy eth3
54 sw-e300 1 00:80:c8:37:6d:76 17
55 # mac 00:80:c8:37:6d:76 on 41 switches
56
57
58
59 # switch configuration helpers
60
61 ssh-switch-port-vlan sw port vlan
62 ssh-switch-port-shutdown sw port [no]
63 ssh-snmp-server-rw sw
64