diff options
Diffstat (limited to 'files')
-rwxr-xr-x | files/plugins/selinux_avcstats | 111 | ||||
-rwxr-xr-x | files/plugins/selinuxenforced | 30 | ||||
-rwxr-xr-x | files/plugins/xen | 2 | ||||
-rwxr-xr-x | files/plugins/xen-cpu | 121 | ||||
-rw-r--r-- | files/plugins/xen_cpu | 189 | ||||
-rw-r--r-- | files/plugins/xen_mem | 6 | ||||
-rw-r--r-- | files/plugins/xen_traffic_all | 75 | ||||
-rwxr-xr-x | files/plugins/xen_vbd | 14 | ||||
-rw-r--r-- | files/plugins/xen_vm | 4 |
9 files changed, 242 insertions, 310 deletions
diff --git a/files/plugins/selinux_avcstats b/files/plugins/selinux_avcstats deleted file mode 100755 index b7d2dbb..0000000 --- a/files/plugins/selinux_avcstats +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh -# -# Plugin to monitor SELinux's Access Vector Cache (AVC). -# -# config (required) -# autoconf (optional - used by munin-config) -# -# Lars Strand, 2007 -# -# -# Magic markers (used by munin-config and some installation scripts (i.e. -# optional)): -#%# family=auto -#%# capabilities=autoconf - - -AVCSTATS="/selinux/avc/cache_stats" - -if [ "$1" = "autoconf" ]; then - if [ -r $AVCSTATS ]; then - echo yes - exit 0 - else - echo no - exit 1 - fi -fi - -if [ "$1" = "config" ]; then - - echo "graph_title SELinux's Access Vector Cache" - echo 'graph_args -l 0 --base 1000' - echo 'graph_vlabel AVC operations' - echo 'graph_category selinux' - - echo 'lookups.label lookups' - echo 'lookups.type DERIVE' - echo 'lookups.min 0' - echo 'lookups.max 1000000000' - echo 'lookups.draw AREA' - echo 'lookups.colour ff0000' # Red - echo 'lookups.info Number of access vector lookups. This number is a good indicator of the load beeing placed on the AVC.' - - echo 'hits.label hits' - echo 'hits.type DERIVE' - echo 'hits.min 0' - echo 'hits.max 1000000000' - echo 'hits.draw STACK' - echo 'hits.colour 0022ff' # Blue - echo 'hits.info Number of access vector hits.' - - echo 'misses.label misses' - echo 'misses.type DERIVE' - echo 'misses.min 0' - echo 'misses.max 1000000000' - echo 'misses.draw STACK' - echo 'misses.colour 990000' # Darker red - echo 'misses.info Number of cache misses.' - - echo 'allocations.label allocations' - echo 'allocations.type DERIVE' - echo 'allocations.min 0' - echo 'allocations.max 100000000' - echo 'allocations.draw STACK' - echo 'allocations.colour ffa500' # Orange - echo 'allocations.info Number of AVC entries allocated.' - - echo 'reclaims.label reclaims' - echo 'reclaims.type DERIVE' - echo 'reclaims.min 0' - echo 'reclaims.max 1000000000' - echo 'reclaims.draw STACK' - echo 'reclaims.colour 00aaaa' # Darker turquoise - echo 'reclaims.info Number of current total reclaimed AVC entries. If this keeps changing, you may need to increase the cache size (/selinux/avc/cache_threshold).' - - echo 'frees.label frees' - echo 'frees.type DERIVE' - echo 'frees.min 0' - echo 'frees.max 1000000000' - echo 'frees.draw STACK' - echo 'frees.colour 00ff7f' # Spring green - echo 'frees.info Number of free AVC entries.' - - exit 0 -fi - -if [ -r $AVCSTATS ]; then - awk ' NR > 1 { - lookups += $1; - hits += $2; - misses += $3; - allocations += $4; - reclaims += $5; - frees += $6; - } END { - print "lookups.value " lookups; - print "hits.value " hits; - print "misses.value " misses; - print "allocations.value " allocations; - print "reclaims.value " reclaims; - print "frees.value " frees; - } ' < $AVCSTATS -else - echo "lookups.value U" - echo "hits.value U" - echo "misses.value U" - echo "allocations.value U" - echo "reclaims.value U" - echo "frees.value U" -fi - diff --git a/files/plugins/selinuxenforced b/files/plugins/selinuxenforced deleted file mode 100755 index e157e3d..0000000 --- a/files/plugins/selinuxenforced +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -*- sh -*- -# -# Plugin to monitor the status of selinux -# -# Contributed by admin(at)immerda.ch - -if [ "$1" = "autoconf" ]; then - echo yes - exit 0 -fi - -if [ "$1" = "config" ]; then - echo 'graph_title enforced amount' - echo 'graph_args --upper-limit 1 -l 0 ' - echo 'graph_vlabel Is the system selinux enforced?' - echo 'graph_scale no\n'; - echo 'graph_category selinux' - echo 'enforced.label IsEnforced' - #echo 'enforced.draw AREA' - echo 'enforced.draw LINE2' - - exit 0 -fi - -if [ -r /selinux/enforce ]; then - echo -n "enforced.value " && cat /selinux/enforce -else - echo "enforced.value 0" -fi diff --git a/files/plugins/xen b/files/plugins/xen index a9f1a1e..378e040 100755 --- a/files/plugins/xen +++ b/files/plugins/xen @@ -20,7 +20,7 @@ fi # we cache xm list for 5 min for perfomance reasons ((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE '^\/var\/lib\/munin\/plugin-state\/xm_list\.state$') && \ [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || \ - /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state + /usr/sbin/xm list | grep -v "^Name .* ID" > /var/lib/munin/plugin-state/xm_list.state if [ "$1" = "config" ]; then diff --git a/files/plugins/xen-cpu b/files/plugins/xen-cpu deleted file mode 100755 index b456a14..0000000 --- a/files/plugins/xen-cpu +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/perl -wT -# -# Script to minitor the cpu usage of Xen domains -# -# Author: Adam Crews <doo <at> shroom <dot> com> -# -# License: GPL -# Based on the origional xen script from Matthias Pfafferodt, syntron at web.de -# -# Note: Your munin config must run this as root. -# -# Parameters -# config (required) -# autoconf (optional - used by munin-config) -# -#%# family=auto -#%# capabilities=autoconf - -# Define where to find xm tools -my $XM = '/usr/sbin/xm'; -my $XMTOP = '/usr/sbin/xentop'; - -############## -# You should not need to edit anything below here -# - -use strict; - -$ENV{PATH} = '/bin:/usr/bin:/usr/sbin'; - -# we cache xm list for 5 min for perfomance reasons -system('((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_list\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state'); -system('((find /var/lib/munin/plugin-state/xm_top.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_top\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_top.state | wc -l` -gt 1 ]) || /usr/sbin/xentop -b -i1 > /var/lib/munin/plugin-state/xm_top.state'); - -my $arg; undef($arg); -if (defined($ARGV[0])) { - $arg = 'config' if ($ARGV[0] eq 'config'); - $arg = 'autoconf' if ($ARGV[0] eq 'autoconf'); - - if ( "$arg" eq 'autoconf') { - if ( -e $XM && -e $XMTOP ) { - print "yes\n"; - exit 0; - } else { - print "no ($XM and/or $XMTOP not found\n"; - exit 1; - } - } - - if ( "$arg" eq 'config') { - my %cnf; undef(%cnf); - %cnf = ( - 'graph_title' => 'Xen Domain CPU Usage', - 'graph_args' => '--base 1000 -l 0 --upper-limit 100 --rigid', - 'graph_vlabel' => 'Percent (%)', - 'graph_category' => 'xen', - 'graph_info' => 'Display the % of CPU Usage for each domain', - ); - - my @domains = `cat /var/lib/munin/plugin-state/xm_list.state`; - # the header line is not in the cached file - #shift(@domains); # we dont need the header line - my $cnt = "0"; - foreach my $domain ( @domains ) { - my ($dom,undef) = split(/\s/, $domain, 2); - # we need to change - and . to _ or things get weird with the graphs - # some decent quoting would probably fix this, but this works for now - $dom =~ s/[-.]/_/g; - - $cnf{ "$dom" . '.label' } = "$dom"; - $cnf{ "$dom" . '.draw' } = 'STACK'; - $cnf{ "$dom" . '.min' } = '0'; - $cnf{ "$dom" . '.max' } = '100'; - $cnf{ "$dom" . '.info' } = '% CPU used for ' . "$dom"; - - if ( "$cnt" == "0") { $cnf{$dom.'.draw'} = 'AREA'; } - $cnt++; - } - - foreach my $key (sort(keys(%cnf))) { - print "$key $cnf{$key}\n"; - } - exit 0; - } -} - -# Nothing was passed as an argument, so let's just return the proper values - -my @stats = `cat /var/lib/munin/plugin-state/xm_top.state`; - -# remove the first 4 items that are junk that we don't need. -shift(@stats); -shift(@stats); -shift(@stats); -shift(@stats); - -my %vals; undef(%vals); - -foreach my $domain (@stats) { - # trim the leading whitespace - $domain =~ s/^\s+//; - my @v_tmp = split(/\s+/, $domain); - - # we need to change - and . to _ or things get weird with the graphs - # some decent quoting would probably fix this, but this works for now - $v_tmp[0] =~ s/[-.]/_/g; - - $vals{$v_tmp[0]}{'cpu_percent'} = $v_tmp[3]; - $vals{$v_tmp[0]}{'vcpu'} = $v_tmp[8]; - if ( $vals{$v_tmp[0]}{'vcpu'} =~ m/n\/a/ ) { - my $cpu = `grep -c "processor" < /proc/cpuinfo`; - if ( $cpu =~ m/^(\d+)$/ ) { - $vals{$v_tmp[0]}{'vcpu'} = $1; - } - } -} - -foreach my $key (sort(keys(%vals))) { - print "$key.value " . ($vals{$key}{'cpu_percent'}/$vals{'Domain_0'}{'vcpu'}), "\n"; -} - diff --git a/files/plugins/xen_cpu b/files/plugins/xen_cpu new file mode 100644 index 0000000..382c8b5 --- /dev/null +++ b/files/plugins/xen_cpu @@ -0,0 +1,189 @@ +#!/usr/bin/perl -w +# +# xen_cpu_v2.pl 1.00 +# Script to minitor the CPU usage of Xen domains +# Zoltan HERPAI (c) 2009, wigyori@uid0.hu +# +# Based loosely on Adam Crews' xen_cpu script +# +# This script tries to measure the CPU usage of the Xen guests +# accurately. +# The problem with the current monitoring script is that these +# scripts use the CPU output of xentop or xm list, which might be +# inaccurate due to the resources used up at the time of the query by +# the xm or xentop command. +# +# This script stores the previous value of the CPU sec value of the given +# guests in a tempfile, then does some simple calculations to get the real +# CPU usage percentage of the guests. +# + +#%# family=auto +#%# capabilities=autoconf + +use strict; +use POSIX; + +# Define where to find xm tools +my $XM = '/usr/sbin/xm'; +my $XMTOP = '/usr/sbin/xentop'; +my $curtime = time(); +my $basename = `/usr/bin/env basename $0`; chop ($basename); +my $TEMPFILE = "/tmp/$basename"; + +my $debug = 0; + +############## +# You should not need to edit anything below here +# + +$ENV{PATH} = '/bin:/usr/bin:/usr/sbin'; + +my $arg; +if ( defined($ARGV[0]) ) +{ + if ( $ARGV[0] eq 'config' ) + { + $arg = 'config'; + } + if ( $ARGV[0] eq 'autoconf' ) + { + $arg = 'autoconf'; + } + + if ( $arg eq 'autoconf') + { + if ( -e $XM && -e $XMTOP ) + { + print "yes\n"; + exit 0; + } + else + { + print "no ($XM and/or $XMTOP not found\n"; + exit 1; + } + } + + if ( $arg eq 'config' ) + { + my %cnf; + %cnf = ( + 'graph_title' => 'Xen Domain CPU Usage v2', + 'graph_args' => '--base 1000 -l 0 --upper-limit 100 --rigid', + 'graph_vlabel' => 'Percent (%)', + 'graph_category' => 'xen', + 'graph_info' => 'Display the % of CPU Usage for each domain', + ); + + my @domains = `$XM list`; + my $cnt = 0; + shift(@domains); # we dont need the header line + foreach my $domain ( @domains ) + { + my ($dom,undef) = split(/\s/, $domain, 2); + $dom =~ s/[-.]/_/g; + $cnf{ "$dom" . '.label' } = "$dom"; + $cnf{ "$dom" . '.draw' } = 'STACK'; + $cnf{ "$dom" . '.min' } = '0'; + $cnf{ "$dom" . '.max' } = '100'; + $cnf{ "$dom" . '.info' } = '% CPU used for ' . "$dom"; +# $cnf{ "$dom" . '.draw' } = 'AREA'; + if ( $cnt == 0 ) + { + $cnf{ "$dom" . '.draw' } = 'AREA'; + } + $cnt++; + } + foreach my $key (sort(keys(%cnf))) + { + print "$key $cnf{$key}\n"; + } + exit 0; + } +} + +my @xmlist = `$XM list`; +shift (@xmlist); + +my %dom; my $name; my $oldtime; +# Read old data +if ( -e $TEMPFILE ) +{ + open(FH, "<", $TEMPFILE) or die $!; + $oldtime = <FH>; + + if ( $debug ) + { + print "Oldtime: $oldtime\n"; + } + + while (<FH>) + { + # Get the guest name and its CPU usage, and store it in $dom + $_ =~ /(\S+)\s+\S+\s+\S+\s+\d+\s+\S+\s+(\S+)/; + $dom{$1}->{'oldtime'} = $2; + } + + close FH; +} + +my $diff; my $cpusum = 0; +foreach my $domain ( @xmlist ) +{ + # Get the domains' name and current CPU usage, store it in $dom + $domain =~ /(\S+)\s+\S+\s+\S+\s+\d+\s+\S+\s+(\S+)/; + $dom{$1}->{'newtime'} = $2; + + $diff = $dom{$1}->{'newtime'} - $dom{$1}->{'oldtime'}; + $diff = sprintf("%.2f", $diff); + + # Calc the diff between old and new cputime, or reset the counter + if ( $diff < 0 ) + { + $diff = $dom{$1}->{'newtime'}; + } + $dom{$1}->{'diff'} = $diff; + + # Calc a sum CPU usage + $cpusum = $cpusum + $diff; +} + +my $numcpus = `$XM info |grep nr_cpus |cut -d \: -f 2`; +my $timediff = $curtime - $oldtime; +my $tcpuavail = $numcpus * $timediff; + +if ( $debug ) +{ + print "UsedCPUtime sum: $cpusum\n"; + print "CPUs: $numcpus\n"; + print "Timediff: $timediff\n"; + print "Total CPU time available: $tcpuavail\n"; +} + +my $key; my $value; +while (($key, $value) = each %dom) +{ + # Calc a percentage based on the used CPU time sum + my $tmp = 0; + $tmp = ( $dom{$key}->{'diff'} / $cpusum ) * 100; + $dom{$key}->{'pc_time'} = sprintf("%.2f", $tmp); + + # Calc a percentage based on the _total_ available CPU time + $tmp = 0; + $tmp = ( $dom{$key}->{'diff'} / $tcpuavail ) * 100; + $dom{$key}->{'pc_tcpu'} = sprintf("%.2f", $tmp); + + if ( $debug ) + { + print "$key newtime: ".$dom{$key}->{'newtime'}.", oldtime: ".$dom{$key}->{'oldtime'}.", diff: ".$dom{$key}->{'diff'}.", pc_bytime ".$dom{$key}->{'pc_time'}.", pc_bytcpu ".$dom{$key}->{'pc_tcpu'}."\n"; + } + print "$key.value ".$dom{$key}->{'pc_tcpu'}."\n"; +} + +# We'll need to log out the current "xm list" output, and the current time also. +open(FH, ">", $TEMPFILE) or die $!; +print FH $curtime."\n"; +print FH @xmlist; +close FH; + diff --git a/files/plugins/xen_mem b/files/plugins/xen_mem index 16d91cf..a260fbd 100644 --- a/files/plugins/xen_mem +++ b/files/plugins/xen_mem @@ -46,7 +46,7 @@ # we cache xm list for 5 min for perfomance reasons ((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE '^\/var\/lib\/munin\/plugin-state\/xm_list\.state$') && \ [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || \ - /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state + /usr/sbin/xm list | grep -v "^Name .* ID" > /var/lib/munin/plugin-state/xm_list.state if [ "$1" = "autoconf" ]; then echo yes @@ -63,7 +63,7 @@ if [ "$1" = "config" ]; then echo 'graph_info This graph shows affected memory for each domain.' echo 'Domain_0.label Domain-0' echo 'Domain_0.draw AREA' -cat /var/lib/munin/plugin-state/xm_list.state | grep -v 'Mem' | grep -v 'Domain-0' | while read i; do +cat /var/lib/munin/plugin-state/xm_list.state | grep -v 'Domain-0' | while read i; do name=`echo $i | awk '{ print $1 }' | sed 's/[\/.-]/_/g'` echo -n "$name.label " echo $i | awk '{ print $1 }' @@ -73,7 +73,7 @@ done exit 0 fi -cat /var/lib/munin/plugin-state/xm_list.state | grep -v 'Mem' | while read i; do +cat /var/lib/munin/plugin-state/xm_list.state | while read i; do name=`echo $i | awk '{ print $1 }' | sed 's/[\/.-]/_/g'` echo -n "$name.value " echo $i | awk '{ print $3 * 1024 * 1024 }' diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index c5bbfbb..72f3b27 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Author: mario manno <projects@manno.name> # Description: measure traffic for all xen hosts # @@ -14,7 +14,7 @@ # we cache xm list for 5 min for perfomance reasons ((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE '^\/var\/lib\/munin\/plugin-state\/xm_list\.state$') && \ [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || \ - /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state + /usr/sbin/xm list | grep -v "^Name .* ID" > /var/lib/munin/plugin-state/xm_list.state if [ "$1" = "autoconf" ]; then if which xm > /dev/null ; then @@ -32,6 +32,19 @@ if [ "$1" = "autoconf" ]; then exit 0 fi +# we update network devices only twice an hour +function net_state { + dom=$1 + if [ `find /var/lib/munin/plugin-state/xm_net_$dom.state -mmin +30 2> /dev/null | wc -l` -gt 0 ] || [ ! -f /var/lib/munin/plugin-state/xm_net_$dom.state ]; then + content=$(/usr/sbin/xm network-list $dom) + if [ $? -eq 0 ]; then + echo "${content}" | egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@' > /var/lib/munin/plugin-state/xm_net_$dom.state + else + [ -f /var/lib/munin/plugin-state/xm_net_$dom.state ] && rm /var/lib/munin/plugin-state/xm_net_$dom.state + fi + fi +} + if [ "$1" = "config" ]; then echo 'graph_title Xen Traffic' echo 'graph_vlabel bits received (-) / sent (+) per ${graph_period}' @@ -39,43 +52,38 @@ if [ "$1" = "config" ]; then echo 'graph_category xen' DOMAINS=$(cat /var/lib/munin/plugin-state/xm_list.state | awk '{print $1}' | egrep -v "^(Name|Domain-0)") for dom in $DOMAINS; do - # we update network devices only twice an hour - ((find /var/lib/munin/plugin-state/xm_net_$dom.state -mmin -30 > /dev/null 2>&1) && \ - [ `cat /var/lib/munin/plugin-state/xm_net_$dom.state | wc -l` -gt 0 ]) || \ - (/usr/sbin/xm network-list $dom |\ - egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@' > /var/lib/munin/plugin-state/xm_net_$dom.state) - devs=$(cat /var/lib/munin/plugin-state/xm_net_$dom.state) - 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 + net_state $dom + if [ -f /var/lib/munin/plugin-state/xm_net_$dom.state ]; then + devs=$(cat /var/lib/munin/plugin-state/xm_net_$dom.state) + 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'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 + 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 + fi done exit 0 fi DOMAINS=$(cat /var/lib/munin/plugin-state/xm_list.state | awk '{print $1}' | egrep -v "^(Name|Domain-0)") for dom in $DOMAINS; do - # we update network devices only twice an hour - ((find /var/lib/munin/plugin-state/xm_net_$dom.state -mmin -30 > /dev/null 2>&1) && \ - [ `cat /var/lib/munin/plugin-state/xm_net_$dom.state | wc -l` -gt 0 ]) || \ - (/usr/sbin/xm network-list $dom |\ - egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@' > /var/lib/munin/plugin-state/xm_net_$dom.state) - devs=$(cat /var/lib/munin/plugin-state/xm_net_$dom.state) - real_name=$( echo $dom | sed -e's/-/_/g' ) - name=$real_name - for dev in $devs; do + net_state $dom + if [ -f /var/lib/munin/plugin-state/xm_net_$dom.state ]; then + devs=$(cat /var/lib/munin/plugin-state/xm_net_$dom.state) + 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 @@ -86,6 +94,7 @@ for dom in $DOMAINS; do print name"Down.value " $1 "\n"name"Up.value " $9 \ }' \ /proc/net/dev - done + done + fi done diff --git a/files/plugins/xen_vbd b/files/plugins/xen_vbd index 4eca5a6..e34d41c 100755 --- a/files/plugins/xen_vbd +++ b/files/plugins/xen_vbd @@ -17,8 +17,8 @@ $XM = '/usr/sbin/xm'; $XMTOP = '/usr/sbin/xentop'; # we cache xm list for 5 min for perfomance reasons -system('((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_list\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state'); -system('((find /var/lib/munin/plugin-state/xm_top.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_top\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_top.state | wc -l` -gt 1 ]) || /usr/sbin/xentop -b -i1 > /var/lib/munin/plugin-state/xm_top.state'); +system('((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_list\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || /usr/sbin/xm list | grep -v "^Name .* ID" > /var/lib/munin/plugin-state/xm_list.state'); +system('((find /var/lib/munin/plugin-state/xm_top.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_top\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_top.state | wc -l` -gt 1 ]) || /usr/sbin/xentop -b -i1 | grep -E "^ " > /var/lib/munin/plugin-state/xm_top.state'); # ah, parameters coming in if ( defined($ARGV[0])) @@ -50,8 +50,7 @@ if ( defined($ARGV[0])) 'graph_info' => 'Display the I/O operations for each domain', ); - @domains = `cat /var/lib/munin/plugin-state/xm_list.state`; - shift(@domains); # we don't need the header line + @domains = `cat /var/lib/munin/plugin-state/xm_list.state | grep -v 'Domain-0'`; foreach $domain ( @domains ) { @@ -86,12 +85,9 @@ if ( defined($ARGV[0])) # No args, get rolling -my @stats = `cat /var/lib/munin/plugin-state/xm_top.state`; +my @stats = `cat /var/lib/munin/plugin-state/xm_top.state | grep -v 'Domain-0'`; -# remove the first 4 items that are junk that we don't need. -shift(@stats); -shift(@stats); -shift(@stats); +# remove the first line shift(@stats); my %vals; undef(%vals); diff --git a/files/plugins/xen_vm b/files/plugins/xen_vm index a69b5fe..725e800 100644 --- a/files/plugins/xen_vm +++ b/files/plugins/xen_vm @@ -48,7 +48,7 @@ XM="/usr/sbin/xm" # we cache xm list for 5 min for perfomance reasons ((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE '^\/var\/lib\/munin\/plugin-state\/xm_list\.state$') && \ [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || \ - /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state + /usr/sbin/xm list | grep -v "^Name .* ID" > /var/lib/munin/plugin-state/xm_list.state if [ "$1" = "autoconf" ]; then echo yes @@ -69,4 +69,4 @@ fi domains=`cat /var/lib/munin/plugin-state/xm_list.state | wc -l` echo -n "domains.value " -echo $(($domains-2)) +echo $(($domains-1)) |