summaryrefslogtreecommitdiff
path: root/files/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'files/plugins')
-rw-r--r--files/plugins/xen_traffic_all63
1 files changed, 40 insertions, 23 deletions
diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all
index 1216a7d..3fcb508 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
@@ -28,36 +34,47 @@ if [ "$1" = "config" ]; then
echo 'graph_category xen'
DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)")
for dom in $DOMAINS; do
- name=$( echo $dom | sed -e's/-/_/g' )
- #echo $name"UP.label $name"
- #echo $name"DOWN.label $name"
+ devs=$( xm network-list $dom |\
+ egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@')
+ real_name=$( echo $dom | sed -e's/-/_/g' )
+ name=$real_name
+ for dev in $devs; do
+ if [ ${#devs} -gt 1 ]; then
+ name=$real_name"_"`echo $dev | sed 's/\./\_/'`
+ fi
+ #echo $name"UP.label $name"
+ #echo $name"DOWN.label $name"
- echo $name'Down.label received'
- echo $name'Down.type COUNTER'
- echo $name'Down.graph no'
- echo "${name}Down.cdef ${name}Down,8,*"
- echo "${name}Up.label ${name}"
- echo $name'Up.type COUNTER'
- echo "${name}Up.negative ${name}Down"
- echo "${name}Up.cdef ${name}Up,8,*"
+ echo $name'Down.label received'
+ echo $name'Down.type COUNTER'
+ echo $name'Down.graph no'
+ echo "${name}Down.cdef ${name}Down,8,*"
+ echo "${name}Up.label ${name}"
+ echo $name'Up.type COUNTER'
+ echo "${name}Up.negative ${name}Down"
+ echo "${name}Up.cdef ${name}Up,8,*"
+ done
done
exit 0
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"_"`echo $dev | sed 's/\./\_/'`
+ 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