summaryrefslogtreecommitdiff
path: root/files/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'files/plugins')
-rwxr-xr-xfiles/plugins/apache_activity99
-rw-r--r--files/plugins/kvm_cpu101
-rw-r--r--files/plugins/kvm_io109
-rw-r--r--files/plugins/kvm_mem106
-rw-r--r--files/plugins/kvm_net148
-rwxr-xr-xfiles/plugins/selinux_avcstats111
-rwxr-xr-xfiles/plugins/selinuxenforced30
-rwxr-xr-xfiles/plugins/xen2
-rwxr-xr-xfiles/plugins/xen-cpu121
-rw-r--r--files/plugins/xen_cpu189
-rw-r--r--files/plugins/xen_mem6
-rw-r--r--files/plugins/xen_traffic_all75
-rwxr-xr-xfiles/plugins/xen_vbd14
-rw-r--r--files/plugins/xen_vm4
14 files changed, 706 insertions, 409 deletions
diff --git a/files/plugins/apache_activity b/files/plugins/apache_activity
deleted file mode 100755
index 65fc072..0000000
--- a/files/plugins/apache_activity
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/perl
-#
-# Parameters supported:
-#
-# config
-# autoconf
-#
-# Configurable variables
-#
-# url - Override default status-url
-#
-# Magic markers:
-#%# family=auto
-#%# capabilities=autoconf
-
-my $ret = undef;
-if (!eval "require LWP::UserAgent;") {
- $ret = "LWP::UserAgent not found";
-}
-
-my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://127.0.0.1:%d/server-status?auto";
-my @PORTS = exists $ENV{'ports'} ? split(' ', $ENV{'ports'}) : (80);
-my %chars = (
- # '\_' => 'Waiting',
- # 'S' => 'Starting up',
- 'R' => 'Reading request',
- 'W' => 'Sending reply',
- 'K' => 'Keepalive',
- 'D' => 'DNS lookup',
- 'C' => 'Closing',
- # 'L' => 'Logging',
- # 'G' => 'Gracefully finishing',
- # 'I' => 'Idle cleanup',
- # '\.' => 'Open slot',
- );
-
-# "_" Waiting for Connection, "S" Starting up, "R" Reading Request,
-# "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
-# "C" Closing connection, "L" Logging, "G" Gracefully finishing,
-# "I" Idle cleanup of worker, "." Open slot with no current process
-
-if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
- if ($ret) {
- print "no ($ret)\n";
- exit 1;
- }
- my $ua = LWP::UserAgent->new(timeout => 30);
- my @badports;
-
- foreach my $port (@PORTS) {
- my $url = sprintf $URL, $port;
- my $response = $ua->request(HTTP::Request->new('GET',$url));
- push @badports, $port unless $response->is_success and $response->content =~ /Scoreboard/im;
- }
-
- if (@badports) {
- print "no (no apache server-status on ports @badports)\n";
- exit 1;
- } else {
- print "yes\n";
- exit 0;
- }
-}
-
-if (exists $ARGV[0] and $ARGV[0] eq "config") {
- print "graph_title Apache activity\n";
- print "graph_args --base 1000 -l 0\n";
- print "graph_category apache\n";
- print "graph_vlabel processes\n";
- foreach my $port (@PORTS) {
- while (my ($char, $val) = each (%chars)) {
- $char =~ s/\\\./dot/;
- $char =~ s/\\\_/underline/;
- print "activity_${port}_${char}.label ";
- print $val, "\n";
- print "activity_${port}_${char}.type GAUGE\n";
- }
- }
- exit 0;
-}
-
-foreach my $port (@PORTS) {
- my $ua = LWP::UserAgent->new (timeout => 30);
- my $url = sprintf $URL, $port;
- my $response = $ua->request (HTTP::Request->new('GET',$url));
- if ($response->content =~ /^Scoreboard\:\s?(.*)$/sm) {
- my $string = $1;
- chomp $string;
- my @act = split (//, $string);
- foreach my $char (keys (%chars)) {
- my $num = scalar (grep (/$char/, @act));
- $char =~ s/\\\./dot/;
- $char =~ s/\\\_/underline/;
- print "activity_${port}_${char}.value $num\n";
- }
- }
-}
-
-
diff --git a/files/plugins/kvm_cpu b/files/plugins/kvm_cpu
new file mode 100644
index 0000000..f48d9f0
--- /dev/null
+++ b/files/plugins/kvm_cpu
@@ -0,0 +1,101 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# vim: set fileencoding=utf-8
+#
+# Munin plugin to show CPU used by vm
+#
+# Copyright Maxence Dunnewind, Rodolphe Quiédeville
+#
+# License : GPLv3
+#
+# parsed environment variables:
+# vmsuffix: part of vm name to be removed
+#
+#%# capabilities=autoconf
+#%# family=contrib
+
+import re, os, sys
+from subprocess import Popen, PIPE
+
+def config(vm_names):
+ ''' Print the plugin's config
+ @param vm_names : a list of "cleaned" vms' name
+ '''
+ percent = len(filter(lambda x: x[0:3] == 'cpu' and x[3] != ' ', open('/proc/stat', 'r').readlines())) * 100
+
+ base_config = """graph_title KVM Virtual Machine CPU usage
+graph_vlabel %%
+graph_category KVM
+graph_scale no
+graph_period second
+graph_info This graph shows the current CPU used by virtual machines
+graph_args --base 1000 -r --lower-limit 0 --upper-limit %d""" % percent
+ print base_config
+ draw = "AREA"
+ for vm in vm_names:
+ print "%s_cpu.label %s" % (vm, vm)
+ print "%s_cpu.min 0" % vm
+ print "%s_cpu.type DERIVE" % vm
+ print "%s_cpu.draw %s" % (vm, draw)
+ print "%s_cpu.info percent of cpu time used by virtual machine" % vm
+ draw = "STACK"
+
+
+def clean_vm_name(vm_name):
+ ''' Replace all special chars
+ @param vm_name : a vm's name
+ @return cleaned vm's name
+ '''
+
+ # suffix part defined in conf
+ suffix = os.getenv('vmsuffix')
+ if suffix:
+ vm_name = re.sub(suffix,'',vm_name)
+
+ return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
+
+def detect_kvm():
+ ''' Check if kvm is installed
+ '''
+ kvm = Popen("which kvm", shell=True, stdout=PIPE)
+ kvm.communicate()
+ return not bool(kvm.returncode)
+
+def find_vm_names(pids):
+ '''Find and clean vm names from pids
+ @return a dictionnary of {pids : cleaned vm name}
+ '''
+ result = {}
+ for pid in pids:
+ cmdline = open("/proc/%s/cmdline" % pid, "r")
+ result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-]*)\x00\-.*$",r"\1", cmdline.readline()))
+ return result
+
+def list_pids():
+ ''' Find the pid of kvm processes
+ @return a list of pids from running kvm
+ '''
+ pid = Popen("pidof qemu-kvm kvm", shell=True, stdout=PIPE)
+ return pid.communicate()[0].split()
+
+def fetch(vms):
+ ''' Fetch values for a list of pids
+ @param dictionnary {kvm_pid: cleaned vm name}
+ '''
+ for ( pid, name ) in vms.iteritems():
+ ( user, system ) = open("/proc/%s/stat" % pid, 'r').readline().split(' ')[13:15]
+ print '%s_cpu.value %d' % ( name, int(user) + int(system) )
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1:
+ if sys.argv[1] in ['autoconf', 'detect']:
+ if detect_kvm():
+ print "yes"
+ else:
+ print "no"
+ elif sys.argv[1] == "config":
+ config(find_vm_names(list_pids()).values())
+ else:
+ fetch(find_vm_names(list_pids()))
+ else:
+ fetch(find_vm_names(list_pids()))
diff --git a/files/plugins/kvm_io b/files/plugins/kvm_io
new file mode 100644
index 0000000..43941f5
--- /dev/null
+++ b/files/plugins/kvm_io
@@ -0,0 +1,109 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# vim: set fileencoding=utf-8
+#
+# Munin plugin to show io by vm
+#
+# Copyright Maxence Dunnewind, Rodolphe Quiédeville
+#
+# License : GPLv3
+#
+# parsed environment variables:
+# vmsuffix: part of vm name to be removed
+#
+#%# capabilities=autoconf
+#%# family=contrib
+
+import re, os, sys
+from subprocess import Popen, PIPE
+
+def config(vm_names):
+ ''' Print the plugin's config
+ @param vm_names : a list of "cleaned" vms' name
+ '''
+ base_config = """graph_title KVM Virtual Machine IO usage
+graph_vlabel Bytes read(-)/written(+) per second
+graph_category KVM
+graph_info This graph shows the block device I/O used of virtual machines
+graph_args --base 1024"""
+ print base_config
+
+ for vm in vm_names:
+ print "%s_read.label %s" % (vm, vm)
+ print "%s_read.type COUNTER" % vm
+ print "%s_read.min 0" % vm
+ print "%s_read.draw LINE1" % vm
+ print "%s_read.info I/O used by virtual machine %s" % (vm, vm)
+ print "%s_write.label %s" % (vm, vm)
+ print "%s_write.type COUNTER" % vm
+ print "%s_write.min 0" % vm
+ print "%s_write.draw LINE1" % vm
+ print "%s_write.negative %s_read" % (vm, vm)
+ print "%s_write.info I/O used by virtual machine %s" % (vm, vm)
+
+def clean_vm_name(vm_name):
+ ''' Replace all special chars
+ @param vm_name : a vm's name
+ @return cleaned vm's name
+ '''
+ # suffix part defined in conf
+ suffix = os.getenv('vmsuffix')
+ if suffix:
+ vm_name = re.sub(suffix,'',vm_name)
+
+ return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
+
+def fetch(vms):
+ ''' Fetch values for a list of pids
+ @param dictionnary {kvm_pid: cleaned vm name}
+ '''
+ res = {}
+ for pid in vms:
+ f = open("/proc/%s/io" % pid, "r")
+ for line in f.readlines():
+ if "read_bytes" in line:
+ read = line.split()[1]
+ print "%s_read.value %s" % (vms[pid], read)
+ if "write_bytes" in line:
+ write = line.split()[1]
+ print "%s_write.value %s" % (vms[pid], write)
+ break
+ f.close()
+
+def detect_kvm():
+ ''' Check if kvm is installed
+ '''
+ kvm = Popen("which kvm", shell=True, stdout=PIPE)
+ kvm.communicate()
+ return not bool(kvm.returncode)
+
+def find_vm_names(pids):
+ '''Find and clean vm names from pids
+ @return a dictionnary of {pids : cleaned vm name}
+ '''
+ result = {}
+ for pid in pids:
+ cmdline = open("/proc/%s/cmdline" % pid, "r")
+ result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-]*)\x00\-.*$",r"\1", cmdline.readline()))
+ return result
+
+def list_pids():
+ ''' Find the pid of kvm processes
+ @return a list of pids from running kvm
+ '''
+ pid = Popen("pidof qemu-kvm kvm", shell=True, stdout=PIPE)
+ return pid.communicate()[0].split()
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1:
+ if sys.argv[1] in ['autoconf', 'detect']:
+ if detect_kvm():
+ print "yes"
+ else:
+ print "no"
+ elif sys.argv[1] == "config":
+ config(find_vm_names(list_pids()).values())
+ else:
+ fetch(find_vm_names(list_pids()))
+ else:
+ fetch(find_vm_names(list_pids()))
diff --git a/files/plugins/kvm_mem b/files/plugins/kvm_mem
new file mode 100644
index 0000000..14fb793
--- /dev/null
+++ b/files/plugins/kvm_mem
@@ -0,0 +1,106 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# vim: set fileencoding=utf-8
+#
+# Munin plugin to show amount of memory used by vm
+#
+# Copyright Maxence Dunnewind, Rodolphe Quiédeville, Adrien Pujol
+#
+# License : GPLv3
+#
+# parsed environment variables:
+# vmsuffix: part of vm name to be removed
+#
+#%# capabilities=autoconf
+#%# family=contrib
+
+import re, os, sys
+from subprocess import Popen, PIPE
+
+def config(vm_names):
+ ''' Print the plugin's config
+ @param vm_names : a list of "cleaned" vms' name
+ '''
+ base_config = """graph_title KVM Virtual Machine Memory usage
+graph_vlabel Bytes
+graph_category KVM
+graph_info This graph shows the current amount of memory used by virtual machines
+graph_args --base 1024"""
+ print base_config
+ draw = "AREA"
+ for vm in vm_names:
+ print "%s_mem.label %s" % (vm, vm)
+ print "%s_mem.type GAUGE" % vm
+ if draw == 'AREA':
+ print "%s_mem.min 0" % vm
+ print "%s_mem.draw %s" % (vm, draw)
+ print "%s_mem.info memory used by virtual machine %s" % (vm, vm)
+ draw = "STACK"
+
+
+def clean_vm_name(vm_name):
+ ''' Replace all special chars
+ @param vm_name : a vm's name
+ @return cleaned vm's name
+ '''
+ # suffix part defined in conf
+ suffix = os.getenv('vmsuffix')
+ if suffix:
+ vm_name = re.sub(suffix,'',vm_name)
+
+ return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
+
+def fetch(vms):
+ ''' Fetch values for a list of pids
+ @param dictionnary {kvm_pid: cleaned vm name}
+ '''
+ res = {}
+ for pid in vms:
+ try:
+ cmdline = open("/proc/%s/cmdline" % pid, "r")
+ amount = re.sub(r"^.*-m\x00(.*)\x00-smp.*$",r"\1", cmdline.readline())
+ ammount = int(amount) * 1024 * 1024
+ print "%s_mem.value %s" % (vms[pid], ammount)
+ except:
+ cmdline = open("/proc/%s/cmdline" % pid, "r")
+ amount = re.sub(r"^.*-m\x00(\d+).*$",r"\1", cmdline.readline())
+ ammount = int(amount) * 1024 * 1024
+ print "%s_mem.value %s" % (vms[pid], ammount)
+
+def detect_kvm():
+ ''' Check if kvm is installed
+ '''
+ kvm = Popen("which kvm", shell=True, stdout=PIPE)
+ kvm.communicate()
+ return not bool(kvm.returncode)
+
+def find_vm_names(pids):
+ '''Find and clean vm names from pids
+ @return a dictionnary of {pids : cleaned vm name}
+ '''
+ result = {}
+ for pid in pids:
+ cmdline = open("/proc/%s/cmdline" % pid, "r")
+ result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-]*)\x00\-.*$",r"\1", cmdline.readline()))
+ return result
+
+def list_pids():
+ ''' Find the pid of kvm processes
+ @return a list of pids from running kvm
+ '''
+ pid = Popen("pidof qemu-kvm kvm", shell=True, stdout=PIPE)
+ return pid.communicate()[0].split()
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1:
+ if sys.argv[1] in ['autoconf', 'detect']:
+ if detect_kvm():
+ print "yes"
+ else:
+ print "no"
+ elif sys.argv[1] == "config":
+ config(find_vm_names(list_pids()).values())
+ else:
+ fetch(find_vm_names(list_pids()))
+ else:
+ fetch(find_vm_names(list_pids()))
diff --git a/files/plugins/kvm_net b/files/plugins/kvm_net
new file mode 100644
index 0000000..c7b5aca
--- /dev/null
+++ b/files/plugins/kvm_net
@@ -0,0 +1,148 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# vim: set fileencoding=utf-8
+#
+# Munin plugin to show the network I/O per vm
+# On redhat based systems
+#
+# Copyright Igor Borodikhin
+# Copyright Peter Meier
+#
+# License : GPLv3
+#
+#
+# parsed environment variables:
+# vmsuffix: part of vm name to be removed
+#
+#%# capabilities=autoconf
+#%# family=contrib
+
+import re, os, sys
+from subprocess import Popen, PIPE
+
+def config(vms):
+ ''' Print the plugin's config
+ @param vm_names : a list of "cleaned" vms' name
+ '''
+ base_config = """graph_title KVM Network I/O
+graph_vlabel Bytes rx(-)/tx(+) per second
+graph_category KVM
+graph_info This graph shows the network I/O of the virtual machines
+graph_args --base 1024"""
+ print base_config
+ for pid in vms:
+ macs = get_vm_macs(pid)
+ i = 0
+ for mac in macs:
+ print "%s_eth%s_in.label %s_eth%s" % (vms[pid],i, vms[pid], i)
+ print "%s_eth%s_in.type COUNTER" % (vms[pid], i)
+ print "%s_eth%s_in.min 0" % (vms[pid],i)
+ print "%s_eth%s_in.draw LINE2" % (vms[pid],i)
+ print "%s_eth%s_out.negative %s_eth%s_in" % (vms[pid], i, vms[pid], i)
+ print "%s_eth%s_out.label %s_eth%s" % (vms[pid], i, vms[pid], i)
+ print "%s_eth%s_out.type COUNTER" % (vms[pid], i)
+ print "%s_eth%s_out.min 0" % (vms[pid], i)
+ print "%s_eth%s_out.draw LINE2" % (vms[pid], i)
+ i += 1
+
+def clean_vm_name(vm_name):
+ ''' Replace all special chars
+ @param vm_name : a vm's name
+ @return cleaned vm's name
+ '''
+ # suffix part defined in conf
+ suffix = os.getenv('vmsuffix')
+ if suffix:
+ vm_name = re.sub(suffix,'',vm_name)
+
+ return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
+
+def fetch(vms):
+ ''' Fetch values for a list of pids
+ @param dictionnary {kvm_pid: cleaned vm name}
+ '''
+ res = {}
+ macs_to_inf = find_macs_to_inf()
+ interfaces = {}
+ for e in Popen('cat /proc/net/dev | awk \'{ print $1 ":" $9 }\'', shell=True, stdout=PIPE).communicate()[0].split('\n'):
+ s = e.split(':')
+ if len(s) == 3:
+ interfaces[s[0]] = (s[1],s[2])
+ for pid in vms:
+ macs = get_vm_macs(pid)
+ i = 0
+ for mac in macs:
+ inf = macs_to_inf[mac]
+ values = interfaces[inf]
+ if len(values) == 2:
+ print "%s_eth%s_in.value %s" % (vms[pid], i, values[0])
+ print "%s_eth%s_out.value %s" % (vms[pid], i, values[1])
+ i += 1
+
+def detect_kvm():
+ ''' Check if kvm is installed
+ '''
+ kvm = Popen("which kvm", shell=True, stdout=PIPE)
+ kvm.communicate()
+ return not bool(kvm.returncode)
+
+def find_vm_names(pids):
+ '''Find and clean vm names from pids
+ @return a dictionnary of {pids : cleaned vm name}
+ '''
+ result = {}
+ for pid in pids:
+ cmdline = open("/proc/%s/cmdline" % pid, "r")
+ result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-]*)\x00\-.*$",r"\1", cmdline.readline()))
+ return result
+
+def get_vm_macs(pid):
+ '''Find macs for a pid
+ @return the mac addresses for a specified pid
+ '''
+ cmdline = open("/proc/%s/cmdline" % pid, "r")
+ line = cmdline.readline()
+ # macs are fe:... on the host
+ macs = [ re.sub(r"^\d{2}",'fe',p.split('=')[1]) for p in line.split(",") if re.match(r"^mac(addr)?=",p) ]
+ return macs
+
+def list_pids():
+ ''' Find the pid of kvm processes
+ @return a list of pids from running kvm
+ '''
+ pid = Popen("pidof qemu-kvm kvm", shell=True, stdout=PIPE)
+ return pid.communicate()[0].split()
+
+def find_macs_to_inf():
+ ''' Find interfaces for vms
+ @return a dictionary of macs to inf
+ '''
+ result = {}
+ inf = ""
+ kvm = Popen("ip a | grep -E -A 1 '(tap|vnet)' | awk '{print $2}' | grep -v '^$'", shell=True, stdout=PIPE)
+ res = kvm.communicate()[0].split('\n')
+ for line in res:
+ if len(line) > 0:
+ if re.match(r"^tap.*", line):
+ inf = re.sub(r"(tap[^:]+):", r"\1", line)
+ elif re.match(r"^vnet.*", line):
+ inf = re.sub(r"(vnet[^:]+):", r"\1", line)
+ else:
+ result[line] = inf
+
+ return result
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1:
+ if sys.argv[1] in ['autoconf', 'detect']:
+ if detect_kvm():
+ print "yes"
+ else:
+ print "no"
+ elif sys.argv[1] == "config":
+ config(find_vm_names(list_pids()))
+ else:
+ fetch(find_vm_names(list_pids()))
+ else:
+ fetch(find_vm_names(list_pids()))
+
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))