summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorMarcel Haerry <haerry@puzzle.ch>2008-07-16 14:09:01 +0200
committerMarcel Haerry <haerry@puzzle.ch>2008-07-16 14:09:01 +0200
commita73d92553609a8195beaf6d531d5c0c20e9b5f07 (patch)
treeb1dcfb77ca062d06f154af0aa41c1c044ace50c2 /files
parent07a5491ba8f4fb8cbf556eebf562da918548bda0 (diff)
fixed xen_traffic_all plugin
Diffstat (limited to 'files')
-rw-r--r--files/plugins/xen_traffic_all33
1 files changed, 21 insertions, 12 deletions
diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all
index 1216a7d..73eb504 100644
--- a/files/plugins/xen_traffic_all
+++ b/files/plugins/xen_traffic_all
@@ -1,6 +1,12 @@
#!/bin/sh
# Author: mario manno <projects@manno.name>
# Description: measure traffic for all xen hosts
+#
+# 16.07.2008: improved the Plugin by Puzzle ITC to
+# enable the traffic monitoring for domains
+# with more than 1 one interface
+# If there is more than one device, the domainname
+# will get the vif name appended.
#
#%# family=auto
#%# capabilities=autoconf
@@ -46,18 +52,21 @@ fi
DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)")
for dom in $DOMAINS; do
- dev=$( xm network-list $dom |\
+ devs=$( xm network-list $dom |\
egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@')
- name=$( echo $dom | sed -e's/-/_/g' )
- #awk -v name="$name" -v interface="$dev" -F'[: \t]+' \
- #'{ sub(/^ */,""); if ($1 == interface) \
- #print name"DOWN.value "$2"\n"name"UP.value "$10; }' /proc/net/dev
- awk -v name="$name" -v interface="$dev" \
- 'BEGIN { gsub(/\./, "\\.", interface) } \
- $1 ~ "^" interface ":" {
- split($0, a, /: */); $0 = a[2]; \
- print name"Down.value " $1 "\n"name"Up.value " $9 \
- }' \
- /proc/net/dev
+ real_name=$( echo $dom | sed -e's/-/_/g' )
+ name=$real_name
+ for dev in $devs; do
+ if [ ${#devs} -gt 1 ]; then
+ name=$real_name"_"$dev
+ fi
+ awk -v name="$name" -v interface="$dev" \
+ 'BEGIN { gsub(/\./, "\\.", interface) } \
+ $1 ~ "^" interface ":" {
+ split($0, a, /: */); $0 = a[2]; \
+ print name"Down.value " $1 "\n"name"Up.value " $9 \
+ }' \
+ /proc/net/dev
+ done
done