summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Davidson <james.davidson@vyatta.com>2013-04-25 12:50:12 -0700
committerJames Davidson <james.davidson@vyatta.com>2013-04-26 11:05:32 -0700
commitdb838e8e080d257d8b7b40f049a498c04e88690d (patch)
treeebd29c15be53cd026102ba63fb97adc6bcf8f378
parenta22437cdde533c4a4f9f0305b0f6bd17281a4d1f (diff)
downloadvyatta-op-db838e8e080d257d8b7b40f049a498c04e88690d.tar.gz
vyatta-op-db838e8e080d257d8b7b40f049a498c04e88690d.zip
Update "monitor interfaces" generation scripts
Update the "monitor interfaces" node generation scripts to create the same node content as is currently checked in as individual files.
-rwxr-xr-x[-rw-r--r--]gen-monitor-interface-templates.sh81
-rwxr-xr-x[-rw-r--r--]gen-monitor-vif-interface-templates.sh85
2 files changed, 98 insertions, 68 deletions
diff --git a/gen-monitor-interface-templates.sh b/gen-monitor-interface-templates.sh
index a4f75b4..ee9e9ca 100644..100755
--- a/gen-monitor-interface-templates.sh
+++ b/gen-monitor-interface-templates.sh
@@ -1,5 +1,6 @@
#!/bin/bash
#monitor interfaces [type] [name] traffic
+#monitor interfaces [type] [name] traffic flow
#monitor interfaces [type] [name] traffic save [filename]
#monitor interfaces [type] [name] traffic detail
#monitor interfaces [type] [name] traffic detail filter
@@ -10,71 +11,91 @@
#monitor interfaces [type] [name] traffic unlimited filter
declare -a types=(
+ "bonding" \
"bridge" \
- "pseudo-ethernet" \
"ethernet" \
- "bonding" \
- "tunnel" \
"loopback" \
+ "pseudo-ethernet" \
+ "tunnel" \
+ "vrrp" \
"vti"
)
+TEMPLATE_DIR=generated-templates/monitor/interfaces
+mkdir -p $TEMPLATE_DIR
+cd $TEMPLATE_DIR
+
for type in "${types[@]}"; do
+ mkdir -p $type/node.tag/flow
mkdir -p $type/node.tag/traffic/save/node.tag
mkdir -p $type/node.tag/traffic/detail/filter/node.tag
mkdir -p $type/node.tag/traffic/detail/unlimited/filter/node.tag
mkdir -p $type/node.tag/traffic/filter/node.tag
mkdir -p $type/node.tag/traffic/unlimited/filter/node.tag
- #node.tag
- echo "help: Monitor specified $type interface" > $type/node.tag/node.def
+ # node.tag
+ echo "help: Monitor specified $type interface" >| $type/node.tag/node.def
echo "allowed: \${vyatta_sbindir}/vyatta-interfaces.pl --show $type" >> $type/node.tag/node.def
echo 'run: bmon -p $4' >> $type/node.tag/node.def
- echo '' >> $type/node.tag/node.def
- # standard
- echo "help: Montior captured traffic on specified $type interface" > $type/node.tag/traffic/node.def
- echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4' >> $type/node.tag/traffic/node.def
+ # flow
+ echo 'help: Monitor flows on specified interface' >| $type/node.tag/flow/node.def
+ echo 'run: sudo /usr/sbin/iftop -i $4' >> $type/node.tag/flow/node.def
- # save
- echo 'help: Save monitored traffic to a file' > $type/node.tag/traffic/save/node.def
- echo -e 'help: Save monitored traffic to a file\nrun: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --save "${@:7}"' > $type/node.tag/traffic/save/node.tag/node.def
+ # traffic
+ echo "help: Montior captured traffic on specified $type interface" >| $type/node.tag/traffic/node.def
+ echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4' >> $type/node.tag/traffic/node.def
- # detail
- echo -e "help: Monitor detailed traffic for the specified $type interface"> $type/node.tag/traffic/detail/node.def
+ # traffic save
+ echo 'help: Save monitored traffic to a file' >| $type/node.tag/traffic/save/node.def
+ echo -e 'help: Save monitored traffic to a file\nrun: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --save "${@:7}"' >| $type/node.tag/traffic/save/node.tag/node.def
+ # traffic detail
+ echo -e "help: Monitor detailed traffic for the specified $type interface" >| $type/node.tag/traffic/detail/node.def
echo -e 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --detail' >> $type/node.tag/traffic/detail/node.def
- # detail filter
- echo "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/traffic/detail/filter/node.def
- echo -e "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/traffic/detail/filter/node.tag/node.def
+ # traffic detail filter
+ echo "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/traffic/detail/filter/node.def
+ echo -e "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/traffic/detail/filter/node.tag/node.def
echo -e "allowed: echo -e '<pcap-filter>'" >> $type/node.tag/traffic/detail/filter/node.tag/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --detail --filter "${@:8}"' >> $type/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/traffic/detail/unlimited/node.def
+ # traffic detail unlimited
+ echo -e "help: Monitor detailed traffic for the specified $type interface" >| $type/node.tag/traffic/detail/unlimited/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --detail --unlimited' >> $type/node.tag/traffic/detail/unlimited/node.def
- # detail unlimited filter
- echo "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/traffic/detail/unlimited/filter/node.def
- echo "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/traffic/detail/unlimited/filter/node.tag/node.def
+ # traffic detail unlimited filter
+ echo "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/traffic/detail/unlimited/filter/node.def
+ echo "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/traffic/detail/unlimited/filter/node.tag/node.def
echo "allowed: echo -e '<pcap-filter>'" >> $type/node.tag/traffic/detail/unlimited/filter/node.tag/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --detail --unlimited --filter "${@:9}"' >> $type/node.tag/traffic/detail/unlimited/filter/node.tag/node.def
- #filter
- echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/traffic/filter/node.def
- echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/traffic/filter/node.tag/node.def
+ # traffic filter
+ echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/traffic/filter/node.def
+ echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/traffic/filter/node.tag/node.def
echo "allowed: echo -e '<pcap-filter>'" >> $type/node.tag/traffic/filter/node.tag/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --filter "${@:7}"' >> $type/node.tag/traffic/filter/node.tag/node.def
- # unlimited
- echo "help: Monitor traffic for the specified $type interface" > $type/node.tag/traffic/unlimited/node.def
+ # traffic unlimited
+ echo "help: Monitor traffic for the specified $type interface" >| $type/node.tag/traffic/unlimited/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --unlimited' >> $type/node.tag/traffic/unlimited/node.def
- # unlimited filter
- echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/traffic/unlimited/filter/node.def
- echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/traffic/unlimited/filter/node.tag/node.def
+ # traffic unlimited filter
+ echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/traffic/unlimited/filter/node.def
+ echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/traffic/unlimited/filter/node.tag/node.def
echo "allowed: echo -e '<pcap-filter>'" >> $type/node.tag/traffic/unlimited/filter/node.tag/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --unlimited --filter "${@:8}"' >> $type/node.tag/traffic/unlimited/filter/node.tag/node.def
done
+
+# Overrides
+# This is where specific tweaks to the above can be made
+
+# loopback
+sed -i -e 's;run: bmon -p $4;;' loopback/node.tag/node.def
+
+# vti
+rm -rf vti/node.tag/flow
+
+# VRRP
+sed -i -e 's;allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show vrrp;allowed: ${vyatta_bindir}/vyatta-show-interfaces.pl --vrrp --action=allowed;' vrrp/node.tag/node.def
diff --git a/gen-monitor-vif-interface-templates.sh b/gen-monitor-vif-interface-templates.sh
index c36881c..b0ef822 100644..100755
--- a/gen-monitor-vif-interface-templates.sh
+++ b/gen-monitor-vif-interface-templates.sh
@@ -1,73 +1,82 @@
#!/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
+#monitor interfaces [type] [name] vif flow
+#monitor interfaces [type] [name] vif traffic
+#monitor interfaces [type] [name] vif traffic save [filename]
+#monitor interfaces [type] [name] vif traffic detail
+#monitor interfaces [type] [name] vif traffic detail filter
+#monitor interfaces [type] [name] vif traffic detail unlimited
+#monitor interfaces [type] [name] vif traffic detail unlimited filter
+#monitor interfaces [type] [name] vif traffic filter
+#monitor interfaces [type] [name] vif traffic unlimited
+#monitor interfaces [type] [name] vif traffic unlimited filter
declare -a types=(
- "ethernet" \
"bonding" \
+ "ethernet" \
)
+TEMPLATE_DIR=generated-templates/monitor/interfaces
+mkdir -p $TEMPLATE_DIR
+cd $TEMPLATE_DIR
+
for type in "${types[@]}"; do
+ mkdir -p $type/node.tag/vif/node.tag/flow
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
+
+ # 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
+ echo 'run: bmon -p $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
+ # flow
+ echo 'help: Monitor flows on specified interface' >| $type/node.tag/vif/node.tag/flow/node.def
+ echo 'run: sudo /usr/sbin/iftop -i $4.$6' >> $type/node.tag/vif/node.tag/flow/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
+ # traffic
+ 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
- # detail
- echo -e "help: Monitor detailed traffic for the specified $type interface"> $type/node.tag/vif/node.tag/traffic/detail/node.def
+ # traffic 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
+ # traffic 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
+ # traffic 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 -e "allowed: echo -e '<pcap-filter>'" >> $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
+ # traffic 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
+ # traffic 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 "allowed: echo -e '<pcap-filter>'" >> $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
+ # traffic 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 "allowed: echo -e '<pcap-filter>'" >> $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
+ # traffic 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
+ # traffic 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 "allowed: echo -e '<pcap-filter>'" >> $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