diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-09-15 19:25:51 -0500 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-10-27 17:11:29 -0500 |
commit | a01a95b0b8de1dfee3236e9e00b2fdd4c9aa17e9 (patch) | |
tree | 08b2c16a49c2359b98425da264cd50193181401a /gen-monitor-vif-interface-templates.sh | |
parent | 6af87429ae97d7cd069268ad3597508e6954d5e8 (diff) | |
download | vyatta-op-a01a95b0b8de1dfee3236e9e00b2fdd4c9aa17e9.tar.gz vyatta-op-a01a95b0b8de1dfee3236e9e00b2fdd4c9aa17e9.zip |
Implement packet capture for vifs
(cherry picked from commit 94e26478b7bc4aaa785660c6d77b55483c66df76)
Diffstat (limited to 'gen-monitor-vif-interface-templates.sh')
-rw-r--r-- | gen-monitor-vif-interface-templates.sh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/gen-monitor-vif-interface-templates.sh b/gen-monitor-vif-interface-templates.sh new file mode 100644 index 0000000..b8149f1 --- /dev/null +++ b/gen-monitor-vif-interface-templates.sh @@ -0,0 +1,70 @@ +#!/bin/bash +#monitor interfaces [type] [name] traffic +#monitor interfaces [type] [name] traffic save [filename] +#monitor interfaces [type] [name] traffic detail +#monitor interfaces [type] [name] traffic detail filter +#monitor interfaces [type] [name] traffic detail unlimited +#monitor interfaces [type] [name] traffic detail unlimited filter +#monitor interfaces [type] [name] traffic filter +#monitor interfaces [type] [name] traffic unlimited +#monitor interfaces [type] [name] traffic unlimited filter + +declare -a types=( + "ethernet" \ + "bonding" \ +) + +for type in "${types[@]}"; do + mkdir -p $type/node.tag/vif/node.tag/traffic/save/node.tag + mkdir -p $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag + mkdir -p $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag + mkdir -p $type/node.tag/vif/node.tag/traffic/filter/node.tag + mkdir -p $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag + + #node.tag + echo "help: Monitor specified $type interface" > $type/node.tag/vif/node.tag/node.def + echo "allowed: \${vyatta_sbindir}/vyatta-interfaces.pl --show $type --vif \${COMP_WORDS[COMP_CWORD-2]}" >> $type/node.tag/vif/node.tag/node.def + echo "run: \${vyatta_bindir}/vyatta-show-interfaces.pl --intf=\"$4.$6\"" >> $type/node.tag/vif/node.tag/node.def + + # standard + echo "help: Montior captured traffic on specified $type interface" > $type/node.tag/vif/node.tag/traffic/node.def + echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6' >> $type/node.tag/vif/node.tag/traffic/node.def + + # save + echo 'help: Save monitored traffic to a file' > $type/node.tag/vif/node.tag/traffic/save/node.def + echo -e 'help: Save monitored traffic to a file\nrun: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --save "${@:9}"' > $type/node.tag/vif/node.tag/traffic/save/node.tag/node.def + + # detail + echo -e "help: Monitor detailed traffic for the specified $type interface"> $type/node.tag/vif/node.tag/traffic/detail/node.def + + echo -e 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail' >> $type/node.tag/vif/node.tag/traffic/detail/node.def + + # detail filter + echo "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/filter/node.def + echo -e "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag/node.def + echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail --filter "${@:10}"' >> $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag/node.def + + # detail unlimited + echo -e "help: Monitor detailed traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/unlimited/node.def + echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail --unlimited' >> $type/node.tag/vif/node.tag/traffic/detail/unlimited/node.def + + # detail unlimited filter + echo "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.def + echo "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag/node.def + echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail --unlimited --filter "${@:11}"' >> $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag/node.def + + #filter + echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/filter/node.def + echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/filter/node.tag/node.def + echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --filter "${@:9}"' >> $type/node.tag/vif/node.tag/traffic/filter/node.tag/node.def + + # unlimited + echo "help: Monitor traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/unlimited/node.def + echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --unlimited' >> $type/node.tag/vif/node.tag/traffic/unlimited/node.def + + # unlimited filter + echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.def + echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag/node.def + echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --unlimited --filter "${@:10}"' >> $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag/node.def + +done |