From f637dc37d96a1715634734c5ef9d7d5ecd13a447 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 30 Jan 2008 21:37:34 +0000 Subject: rearranged some stuff git-svn-id: https://svn/ipuppet/trunk/modules/munin@607 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/gentoo_lastupdated | 71 ++++++++++++++++++++++ files/plugins/selinux_avcstats | 111 ++++++++++++++++++++++++++++++++++ files/plugins/selinuxenforced | 32 ++++++++++ files/plugins/xen | 52 ++++++++++++++++ files/plugins/xen-cpu | 125 +++++++++++++++++++++++++++++++++++++++ files/plugins/xen_memory | 63 ++++++++++++++++++++ files/plugins/xen_vbd | 109 ++++++++++++++++++++++++++++++++++ 7 files changed, 563 insertions(+) create mode 100755 files/plugins/gentoo_lastupdated create mode 100755 files/plugins/selinux_avcstats create mode 100755 files/plugins/selinuxenforced create mode 100755 files/plugins/xen create mode 100755 files/plugins/xen-cpu create mode 100755 files/plugins/xen_memory create mode 100755 files/plugins/xen_vbd (limited to 'files') diff --git a/files/plugins/gentoo_lastupdated b/files/plugins/gentoo_lastupdated new file mode 100755 index 0000000..42fd362 --- /dev/null +++ b/files/plugins/gentoo_lastupdated @@ -0,0 +1,71 @@ +#!/usr/bin/perl +# -*- perl -*- +# +# (C) 2007 immerda project +# +# Plugin to monitor the last update of the gentoo +# +# Parameters: +# +# config +# autoconf +# +# $Id: users.in 1212 2006-10-29 20:11:58Z janl $ +# +#%# family=auto +#%# capabilities=autoconf + +# update /etc/munin/plugin-conf.d/munin-node with: +# [gentoo_*] +# user root +# env.logfile /var/log/emerge.log +# env.tail /usr/bin/tail +# env.grep /bin/grep + +my $logfile = $ENV{'logfile'} || '/var/log/emerge.log'; +my $grep = $ENV{'grep'} || `which grep`; +my $date = $ENV{'date'} || `which date`; +my $tail = $ENV{'tail'} || `which tail`; +chomp($grep); +chomp($date); +chomp($tail); + +if ( defined($ARGV[0])) { + if ($ARGV[0] eq 'autoconf') { + print "yes\n"; + exit 0; + } + + if ( $ARGV[0] eq "config" ) { + print "graph_title Gentoo: Last update X days ago\n"; + #print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel days\n"; + print "graph_scale no\n"; + print "graph_category system\n"; + #print "graph_printf %.1lf\n"; + print "lastupdated.label last updated [d ago]\n"; + print "lastupdated.type GAUGE\n"; + #print "tty.draw AREASTACK\n"; + #print "tty.colour 00FF00\n"; + exit 0; + } +} + +$days = 0; +$last = 0; +$now = 0; + +$l=`$grep "emerge" $logfile | $grep world | $grep -v fetchonly | tail -1`; + +($last,$rest) = split /:/,$l; +$now = `$date +%s`; +if($last eq "" or $last == 0 or $now == 0 or $date eq ""){ + $days = ""; +}else{ + $days=($now-$last)/60/60/24; # in tagen +} + +print "lastupdated.value $days\n"; + +# vim:syntax=perl + diff --git a/files/plugins/selinux_avcstats b/files/plugins/selinux_avcstats new file mode 100755 index 0000000..9687be0 --- /dev/null +++ b/files/plugins/selinux_avcstats @@ -0,0 +1,111 @@ +#!/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 system' + + 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 new file mode 100755 index 0000000..2f88b9b --- /dev/null +++ b/files/plugins/selinuxenforced @@ -0,0 +1,32 @@ +#!/bin/sh +# -*- sh -*- +# +# Plugin to count the daily amount of Virii (qmailscan) +# +# Contributed by David Obando (david@cryptix.de) - 03.12.2005 +# + +# define the logfiles. when you rotate them at any other time than 00:00 you have to define two logfiles: +#LOG0=/var/spool/qmailscan/quarantine.log +#LOG1=/var/spool/qmailscan/quarantine.log.1 + +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 + +echo -n "enforced.value " && cat /selinux/enforce + diff --git a/files/plugins/xen b/files/plugins/xen new file mode 100755 index 0000000..575cd3b --- /dev/null +++ b/files/plugins/xen @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Script to monitor CPU usage of Xen domains +# +# Parameters understood: +# +# conifg (required) +# autoconf (optinal - used by munin-config) +# + +MAXDOMAINS=16 + +if [ "$1" = "autoconf" ]; then + if which xm > /dev/null ; then + echo yes + exit 0 + fi + echo "no (xm not found)" + exit 1 +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title Xen Domain Utilerisation' + echo 'graph_args --base 1000 -l 0' + echo 'graph_scale no' + echo 'graph_vlabel mS' + echo 'graph_category xen' + echo 'graph_info This graph shows of many mS wall time where used by a domain' + /usr/sbin/xm list | grep -v "^Name .* Console$" | \ + while read name domid mem cpu state time console; do + name=`echo $name | sed -e"s/-/_/"` + echo "$name.label $name" + echo "$name.type COUNTER" +# if [ "$name" = "Domain_0" ]; then +# echo "$name.draw AREA" +# else +# echo "$name.draw STACK" +# fi + echo "$name.min 0" + echo "$name.info Wall clock time spend for $name" + done + exit 0 +fi + +/usr/sbin/xm list | grep -v "^Name" | grep -v "^Name .* Console$" | \ +while read name domid mem cpu state time console; do + name=`echo $name | sed -e"s/-/_/"` + time=`echo $time | sed -e "s/\.//"` + echo "$name.value $time" +done + diff --git a/files/plugins/xen-cpu b/files/plugins/xen-cpu new file mode 100755 index 0000000..0ef301e --- /dev/null +++ b/files/plugins/xen-cpu @@ -0,0 +1,125 @@ +#!/usr/bin/perl -wT +# +# Script to minitor the cpu usage of Xen domains +# +# Author: Adam Crews shroom 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'; + +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 = `$XM list`; + 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 @chunks; undef(@chunks); + +{ + # run the xentop command a few times because the first reading is not always accurate + local $/ = undef; + @chunks = split(/^xentop - .*$/m, `$XMTOP -b -i2 -d2`); +} + +# Take only the last run of xentop +my @stats = split (/\n/,pop(@chunks)); + +# 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_memory b/files/plugins/xen_memory new file mode 100755 index 0000000..90bc705 --- /dev/null +++ b/files/plugins/xen_memory @@ -0,0 +1,63 @@ +#!/bin/sh +# +# Script to monitor memory status of the xen host +# +# Parameters understood: +# +# config (required) +# autoconf (optional - used by munin-config) +# + +MAXDOMAINS=16 + +if [ "$1" = "autoconf" ]; then + if which xm > /dev/null ; then + echo yes + exit 0 + fi + echo "no (xm not found)" + exit 1 +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title Xen Memory' + echo 'graph_args --base 1000 -l 0' + echo 'graph_scale no' + echo 'graph_vlabel MB' + echo 'graph_category xen' + echo 'graph_info This graph shows of many mS wall time where used by a domain' + # xm info | while read name bla value; do echo "$name $value"; done + /usr/sbin/xm info | while read name bla value; do + #total_memory 2047 + #free_memory 1476 + name=`echo $name | sed -e"s/-/_/"` + + if [ "$name" = "total_memory" ]; then + echo "$name.label $name" + echo "$name.type GAUGE" + echo "$name.min 0" + echo "$name.info total memory" + fi + if [ "$name" = "free_memory" ]; then + echo "$name.label $name" + echo "$name.type GAUGE" + echo "$name.draw AREA" +# echo "$name.draw STACK" + echo "$name.min 0" + echo "$name.info free memory" + fi + done + exit 0 +fi + +/usr/sbin/xm info | while read name bla value; do + name=`echo $name | sed -e"s/-/_/"` + if [ "$name" = "total_memory" ]; then + echo "$name.value $value" + fi + if [ "$name" = "free_memory" ]; then + echo "$name.value $value" + fi +done + diff --git a/files/plugins/xen_vbd b/files/plugins/xen_vbd new file mode 100755 index 0000000..238bf08 --- /dev/null +++ b/files/plugins/xen_vbd @@ -0,0 +1,109 @@ +#!/usr/bin/perl +# +# 2007-06-01 Zoltan HERPAI +# +# Credits goes for: +# Adam Crews for his xen_cpu plugin +# Mario Manno for his xen_traffic_all plugin +# +# Script to monitor the I/O usage of Xen domains +# Version 0.1 +# +#%# family=auto +#%# capabilities=autoconf + +# Location of xm tools +$XM = '/usr/sbin/xm'; +$XMTOP = '/usr/sbin/xentop'; + +# ah, parameters coming in +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 0; + } + } + + if ( $arg eq 'config' ) + { + %cnf = ( + 'graph_title' => 'Xen Domain I/O usage', + 'graph_args' => '--base 1024 -l 0', + 'graph_vlabel' => 'read (-), write (+)', + 'graph_category' => 'xen', + 'graph_info' => 'Display the I/O operations for each domain', + ); + + @domains = `$XM list`; + shift(@domains); # we don't need the header line + + foreach $domain ( @domains ) + { + ($dom, undef) = split(/\s/, $domain); + $dom =~ s/[-.]/_/g; + + $cnf{ $dom.'RD' . '.label' } = 'read'; + $cnf{ $dom.'RD' . '.type' } = 'COUNTER'; + $cnf{ $dom.'RD' . '.graph' } = 'no'; + $cnf{ $dom.'RD' . '.cdef' } = $dom.'RD,8,*'; + + $cnf{ $dom.'WR' . '.label' } = $dom; + $cnf{ $dom.'WR' . '.type' } = 'COUNTER'; + $cnf{ $dom.'WR' . '.negative' } = $dom.'RD'; + $cnf{ $dom.'WR' . '.cdef' } = $dom.'WR,8,*'; + + if ( "$cnt" == "0" ) + { + $cnf { "$dom" . '.draw' } = 'AREA'; + } + $cnt++; + } + + foreach $key ( sort(keys(%cnf)) ) + { + print "$key $cnf{$key}\n"; + } + exit 0; + + } +} + + +# No args, get rolling +# NAME STATE CPU(sec) CPU(%) MEM(k) MEM(%) MAXMEM(k) MAXMEM(%) VCPUS NETS NETTX(k) NETRX(k) VBDS VBD_OO VBD_RD VBD_WR SSID +$tmpfile = "/tmp/munin_xen_vbd_tmp"; + +system("$XMTOP -b -i1 > $tmpfile"); +open(I,"$tmpfile"); +while(){ + chomp; + s/^\s*//g; + @tmp=split(/\s+/, $_); + next if $tmp[0] eq "NAME"; + + $domname = $tmp[0]; + $domname =~ s/[-.]/_/g; + $vbdrd = $tmp[14]; + $vbdwr = $tmp[15]; + + $vals{$domname."RD"}{'value'} = $vbdrd; + $vals{$domname."WR"}{'value'} = $vbdwr; +} + +foreach $key ( sort(keys(%vals)) ) +{ + print "$key.value " . ($vals{$key}{'value'}) . "\n"; +} + -- cgit v1.2.3 From 9082862f719e3fe9eac5192114893e4281a6d1fb Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 30 Jan 2008 21:37:34 +0000 Subject: rearranged some stuff --- files/plugins/gentoo_lastupdated | 71 ++++++++++++++++++++++ files/plugins/selinux_avcstats | 111 ++++++++++++++++++++++++++++++++++ files/plugins/selinuxenforced | 32 ++++++++++ files/plugins/xen | 52 ++++++++++++++++ files/plugins/xen-cpu | 125 +++++++++++++++++++++++++++++++++++++++ files/plugins/xen_memory | 63 ++++++++++++++++++++ files/plugins/xen_vbd | 109 ++++++++++++++++++++++++++++++++++ 7 files changed, 563 insertions(+) create mode 100755 files/plugins/gentoo_lastupdated create mode 100755 files/plugins/selinux_avcstats create mode 100755 files/plugins/selinuxenforced create mode 100755 files/plugins/xen create mode 100755 files/plugins/xen-cpu create mode 100755 files/plugins/xen_memory create mode 100755 files/plugins/xen_vbd (limited to 'files') diff --git a/files/plugins/gentoo_lastupdated b/files/plugins/gentoo_lastupdated new file mode 100755 index 0000000..42fd362 --- /dev/null +++ b/files/plugins/gentoo_lastupdated @@ -0,0 +1,71 @@ +#!/usr/bin/perl +# -*- perl -*- +# +# (C) 2007 immerda project +# +# Plugin to monitor the last update of the gentoo +# +# Parameters: +# +# config +# autoconf +# +# $Id: users.in 1212 2006-10-29 20:11:58Z janl $ +# +#%# family=auto +#%# capabilities=autoconf + +# update /etc/munin/plugin-conf.d/munin-node with: +# [gentoo_*] +# user root +# env.logfile /var/log/emerge.log +# env.tail /usr/bin/tail +# env.grep /bin/grep + +my $logfile = $ENV{'logfile'} || '/var/log/emerge.log'; +my $grep = $ENV{'grep'} || `which grep`; +my $date = $ENV{'date'} || `which date`; +my $tail = $ENV{'tail'} || `which tail`; +chomp($grep); +chomp($date); +chomp($tail); + +if ( defined($ARGV[0])) { + if ($ARGV[0] eq 'autoconf') { + print "yes\n"; + exit 0; + } + + if ( $ARGV[0] eq "config" ) { + print "graph_title Gentoo: Last update X days ago\n"; + #print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel days\n"; + print "graph_scale no\n"; + print "graph_category system\n"; + #print "graph_printf %.1lf\n"; + print "lastupdated.label last updated [d ago]\n"; + print "lastupdated.type GAUGE\n"; + #print "tty.draw AREASTACK\n"; + #print "tty.colour 00FF00\n"; + exit 0; + } +} + +$days = 0; +$last = 0; +$now = 0; + +$l=`$grep "emerge" $logfile | $grep world | $grep -v fetchonly | tail -1`; + +($last,$rest) = split /:/,$l; +$now = `$date +%s`; +if($last eq "" or $last == 0 or $now == 0 or $date eq ""){ + $days = ""; +}else{ + $days=($now-$last)/60/60/24; # in tagen +} + +print "lastupdated.value $days\n"; + +# vim:syntax=perl + diff --git a/files/plugins/selinux_avcstats b/files/plugins/selinux_avcstats new file mode 100755 index 0000000..9687be0 --- /dev/null +++ b/files/plugins/selinux_avcstats @@ -0,0 +1,111 @@ +#!/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 system' + + 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 new file mode 100755 index 0000000..2f88b9b --- /dev/null +++ b/files/plugins/selinuxenforced @@ -0,0 +1,32 @@ +#!/bin/sh +# -*- sh -*- +# +# Plugin to count the daily amount of Virii (qmailscan) +# +# Contributed by David Obando (david@cryptix.de) - 03.12.2005 +# + +# define the logfiles. when you rotate them at any other time than 00:00 you have to define two logfiles: +#LOG0=/var/spool/qmailscan/quarantine.log +#LOG1=/var/spool/qmailscan/quarantine.log.1 + +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 + +echo -n "enforced.value " && cat /selinux/enforce + diff --git a/files/plugins/xen b/files/plugins/xen new file mode 100755 index 0000000..575cd3b --- /dev/null +++ b/files/plugins/xen @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Script to monitor CPU usage of Xen domains +# +# Parameters understood: +# +# conifg (required) +# autoconf (optinal - used by munin-config) +# + +MAXDOMAINS=16 + +if [ "$1" = "autoconf" ]; then + if which xm > /dev/null ; then + echo yes + exit 0 + fi + echo "no (xm not found)" + exit 1 +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title Xen Domain Utilerisation' + echo 'graph_args --base 1000 -l 0' + echo 'graph_scale no' + echo 'graph_vlabel mS' + echo 'graph_category xen' + echo 'graph_info This graph shows of many mS wall time where used by a domain' + /usr/sbin/xm list | grep -v "^Name .* Console$" | \ + while read name domid mem cpu state time console; do + name=`echo $name | sed -e"s/-/_/"` + echo "$name.label $name" + echo "$name.type COUNTER" +# if [ "$name" = "Domain_0" ]; then +# echo "$name.draw AREA" +# else +# echo "$name.draw STACK" +# fi + echo "$name.min 0" + echo "$name.info Wall clock time spend for $name" + done + exit 0 +fi + +/usr/sbin/xm list | grep -v "^Name" | grep -v "^Name .* Console$" | \ +while read name domid mem cpu state time console; do + name=`echo $name | sed -e"s/-/_/"` + time=`echo $time | sed -e "s/\.//"` + echo "$name.value $time" +done + diff --git a/files/plugins/xen-cpu b/files/plugins/xen-cpu new file mode 100755 index 0000000..0ef301e --- /dev/null +++ b/files/plugins/xen-cpu @@ -0,0 +1,125 @@ +#!/usr/bin/perl -wT +# +# Script to minitor the cpu usage of Xen domains +# +# Author: Adam Crews shroom 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'; + +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 = `$XM list`; + 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 @chunks; undef(@chunks); + +{ + # run the xentop command a few times because the first reading is not always accurate + local $/ = undef; + @chunks = split(/^xentop - .*$/m, `$XMTOP -b -i2 -d2`); +} + +# Take only the last run of xentop +my @stats = split (/\n/,pop(@chunks)); + +# 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_memory b/files/plugins/xen_memory new file mode 100755 index 0000000..90bc705 --- /dev/null +++ b/files/plugins/xen_memory @@ -0,0 +1,63 @@ +#!/bin/sh +# +# Script to monitor memory status of the xen host +# +# Parameters understood: +# +# config (required) +# autoconf (optional - used by munin-config) +# + +MAXDOMAINS=16 + +if [ "$1" = "autoconf" ]; then + if which xm > /dev/null ; then + echo yes + exit 0 + fi + echo "no (xm not found)" + exit 1 +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title Xen Memory' + echo 'graph_args --base 1000 -l 0' + echo 'graph_scale no' + echo 'graph_vlabel MB' + echo 'graph_category xen' + echo 'graph_info This graph shows of many mS wall time where used by a domain' + # xm info | while read name bla value; do echo "$name $value"; done + /usr/sbin/xm info | while read name bla value; do + #total_memory 2047 + #free_memory 1476 + name=`echo $name | sed -e"s/-/_/"` + + if [ "$name" = "total_memory" ]; then + echo "$name.label $name" + echo "$name.type GAUGE" + echo "$name.min 0" + echo "$name.info total memory" + fi + if [ "$name" = "free_memory" ]; then + echo "$name.label $name" + echo "$name.type GAUGE" + echo "$name.draw AREA" +# echo "$name.draw STACK" + echo "$name.min 0" + echo "$name.info free memory" + fi + done + exit 0 +fi + +/usr/sbin/xm info | while read name bla value; do + name=`echo $name | sed -e"s/-/_/"` + if [ "$name" = "total_memory" ]; then + echo "$name.value $value" + fi + if [ "$name" = "free_memory" ]; then + echo "$name.value $value" + fi +done + diff --git a/files/plugins/xen_vbd b/files/plugins/xen_vbd new file mode 100755 index 0000000..238bf08 --- /dev/null +++ b/files/plugins/xen_vbd @@ -0,0 +1,109 @@ +#!/usr/bin/perl +# +# 2007-06-01 Zoltan HERPAI +# +# Credits goes for: +# Adam Crews for his xen_cpu plugin +# Mario Manno for his xen_traffic_all plugin +# +# Script to monitor the I/O usage of Xen domains +# Version 0.1 +# +#%# family=auto +#%# capabilities=autoconf + +# Location of xm tools +$XM = '/usr/sbin/xm'; +$XMTOP = '/usr/sbin/xentop'; + +# ah, parameters coming in +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 0; + } + } + + if ( $arg eq 'config' ) + { + %cnf = ( + 'graph_title' => 'Xen Domain I/O usage', + 'graph_args' => '--base 1024 -l 0', + 'graph_vlabel' => 'read (-), write (+)', + 'graph_category' => 'xen', + 'graph_info' => 'Display the I/O operations for each domain', + ); + + @domains = `$XM list`; + shift(@domains); # we don't need the header line + + foreach $domain ( @domains ) + { + ($dom, undef) = split(/\s/, $domain); + $dom =~ s/[-.]/_/g; + + $cnf{ $dom.'RD' . '.label' } = 'read'; + $cnf{ $dom.'RD' . '.type' } = 'COUNTER'; + $cnf{ $dom.'RD' . '.graph' } = 'no'; + $cnf{ $dom.'RD' . '.cdef' } = $dom.'RD,8,*'; + + $cnf{ $dom.'WR' . '.label' } = $dom; + $cnf{ $dom.'WR' . '.type' } = 'COUNTER'; + $cnf{ $dom.'WR' . '.negative' } = $dom.'RD'; + $cnf{ $dom.'WR' . '.cdef' } = $dom.'WR,8,*'; + + if ( "$cnt" == "0" ) + { + $cnf { "$dom" . '.draw' } = 'AREA'; + } + $cnt++; + } + + foreach $key ( sort(keys(%cnf)) ) + { + print "$key $cnf{$key}\n"; + } + exit 0; + + } +} + + +# No args, get rolling +# NAME STATE CPU(sec) CPU(%) MEM(k) MEM(%) MAXMEM(k) MAXMEM(%) VCPUS NETS NETTX(k) NETRX(k) VBDS VBD_OO VBD_RD VBD_WR SSID +$tmpfile = "/tmp/munin_xen_vbd_tmp"; + +system("$XMTOP -b -i1 > $tmpfile"); +open(I,"$tmpfile"); +while(){ + chomp; + s/^\s*//g; + @tmp=split(/\s+/, $_); + next if $tmp[0] eq "NAME"; + + $domname = $tmp[0]; + $domname =~ s/[-.]/_/g; + $vbdrd = $tmp[14]; + $vbdwr = $tmp[15]; + + $vals{$domname."RD"}{'value'} = $vbdrd; + $vals{$domname."WR"}{'value'} = $vbdwr; +} + +foreach $key ( sort(keys(%vals)) ) +{ + print "$key.value " . ($vals{$key}{'value'}) . "\n"; +} + -- cgit v1.2.3 From 62f6d972b6ca769bf7b75e78615bc0f3ffbbb081 Mon Sep 17 00:00:00 2001 From: am Date: Thu, 31 Jan 2008 16:18:21 +0000 Subject: =?UTF-8?q?tinydns=20munin=20modul=20f=C3=BCr=20immer1-4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn/ipuppet/trunk/modules/munin@635 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/tinydns | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100755 files/plugins/tinydns (limited to 'files') diff --git a/files/plugins/tinydns b/files/plugins/tinydns new file mode 100755 index 0000000..0fb78ff --- /dev/null +++ b/files/plugins/tinydns @@ -0,0 +1,172 @@ +#!/usr/bin/perl -T + +# tinydns-munin-plugin + +# Copyright (C) 2007 admin at immerda.ch +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# with the HELP of +# tinygraph -- a RRDtool frontend for tinydns statistics +# Copyright (C) 2005 Ulrich Zehl + +#use strict; # to activate .... + + +#use Time::TAI64 qw(tai2unix); + +$A = 0; +$NS = 0; +$CNAME = 0; +$SOA = 0; +$PTR = 0; +$HINFO = 0; +$MX = 0; +$TXT = 0; +$RP = 0; +$SIG = 0; +$KEY = 0; +$AAAA = 0; +$A6 = 0; +$IXFR = 0; +$AXFR = 0; +$ANY = 0; + +$logfile = $ENV{logdir} || "/var/tinydns/log/main/current"; + +if ( $ARGV[0] and $ARGV[0] eq "config" ) +{ + print "host_name $ENV{FQDN}\n"; + print "graph_title tinydns\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_category DNS\n"; + print "a.type COUNTER\n"; + print "mx.type COUNTER\n"; + + print "a.label A\n"; + print "ns.label NS\n"; + print "cname.label CNAME\n"; + print "soa.label SOA\n"; + print "ptr.label PTR\n"; + print "mx.label MX\n"; + print "aaaa.label AAAA\n"; + print "any.label ANY\n"; + print "hinfo.label HINFO\n"; + print "txt.label TXT\n"; + print "rp.label RP\n"; + print "sig.label SIG\n"; + print "key.label KEY\n"; + print "a6.label A6\n"; + print "ixfr.label IXFR\n"; + print "axfr.label AXFR\n"; + + print "a.type COUNTER\n"; + print "ns.type COUNTER\n"; + print "cname.type COUNTER\n"; + print "soa.type COUNTER\n"; + print "ptr.type COUNTER\n"; + print "mx.type COUNTER\n"; + print "aaaa.type COUNTER\n"; + print "any.type COUNTER\n"; + print "hinfo.type COUNTER\n"; + print "txt.type COUNTER\n"; + print "rp.type COUNTER\n"; + print "sig.type COUNTER\n"; + print "key.type COUNTER\n"; + print "a6.type COUNTER\n"; + print "ixfr.type COUNTER\n"; + print "axfr.type COUNTER\n"; + exit 0; +} + +my %querytypes = ( + '0001' => 'A', + '0002' => 'NS', + '0005' => 'CNAME', + '0006' => 'SOA', + '000c' => 'PTR', + '000d' => 'HINFO', + '000f' => 'MX', + '0010' => 'TXT', + '0011' => 'RP', + '0018' => 'SIG', + '0019' => 'KEY', + '001c' => 'AAAA', + '0026' => 'A6', + '00fb' => 'IXFR', + '00fc' => 'AXFR', + '00ff' => 'ANY', +); + +my %sum = ( + (map {$_ => 0} values %querytypes), +); + +sub process_line($) +{ + my $line = shift; + if ($line =~ /^(@[a-f0-9]{24}) ([a-f0-9]{8}):[a-f0-9]{4}:[a-f0-9]{4} ([\+\-IC\/]) ([a-f0-9]{4}) (.+)$/) + { + #my $time = tai2unix($1); + my $ip = join(".", unpack("C*", pack("H8", $2))); + my $rtype = $3; + my $qtype = $querytypes{$4}; + #my $qstring = $5; # currently unused + + if ($rtype eq '+') + { + if ($qtype eq 'A'){$A++;}; + if ($qtype eq 'NS'){$NS++;}; + if ($qtype eq 'CNAME'){$CNAME++;}; + if ($qtype eq 'SOA'){$SOA++;}; + if ($qtype eq 'PTR'){$PTR++;}; + if ($qtype eq 'HINFO'){$HINFO++;}; + if ($qtype eq 'MX'){$MX++;}; + if ($qtype eq 'TXT'){$TXT++;}; + if ($qtype eq 'RP'){$RP++;}; + if ($qtype eq 'SIG'){$SIG++;}; + if ($qtype eq 'KEY'){$KEY++;}; + if ($qtype eq 'AAAA'){$AAAA++;}; + if ($qtype eq 'A6'){$A6++;}; + if ($qtype eq 'IXFR'){$IXFR++;}; + if ($qtype eq 'AXFR'){$AXFR++;}; + if ($qtype eq 'ANY'){$ANY++;}; + } + } +} + +open(LOG, "<$logfile") or die "Error opening $logfile: $!"; + +while () +{ + process_line($_); +} + +print "a.value $A\n"; +print "ns.value $NS\n"; +print "cname.value $CNAME\n"; +print "soa.value $SOA\n"; +print "ptr.value $PTR\n"; +print "mx.value $MX\n"; +print "aaaa.value $AAAA\n"; +print "any.value $ANY\n"; +print "hinfo.value $HINFO\n"; +print "txt.value $TXT\n"; +print "rp.value $RP\n"; +print "sig.value $SIG\n"; +print "key.value $KEY\n"; +print "a6.value $A6\n"; +print "ixfr.value $IXFR\n"; +print "axfr.value $AXFR\n"; + -- cgit v1.2.3 From 08e80baa5fa793c9f712edd7d0eb7e760a3e5e5a Mon Sep 17 00:00:00 2001 From: andreas Date: Thu, 31 Jan 2008 16:18:21 +0000 Subject: =?UTF-8?q?tinydns=20munin=20modul=20f=C3=BCr=20immer1-4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/plugins/tinydns | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100755 files/plugins/tinydns (limited to 'files') diff --git a/files/plugins/tinydns b/files/plugins/tinydns new file mode 100755 index 0000000..0fb78ff --- /dev/null +++ b/files/plugins/tinydns @@ -0,0 +1,172 @@ +#!/usr/bin/perl -T + +# tinydns-munin-plugin + +# Copyright (C) 2007 admin at immerda.ch +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# with the HELP of +# tinygraph -- a RRDtool frontend for tinydns statistics +# Copyright (C) 2005 Ulrich Zehl + +#use strict; # to activate .... + + +#use Time::TAI64 qw(tai2unix); + +$A = 0; +$NS = 0; +$CNAME = 0; +$SOA = 0; +$PTR = 0; +$HINFO = 0; +$MX = 0; +$TXT = 0; +$RP = 0; +$SIG = 0; +$KEY = 0; +$AAAA = 0; +$A6 = 0; +$IXFR = 0; +$AXFR = 0; +$ANY = 0; + +$logfile = $ENV{logdir} || "/var/tinydns/log/main/current"; + +if ( $ARGV[0] and $ARGV[0] eq "config" ) +{ + print "host_name $ENV{FQDN}\n"; + print "graph_title tinydns\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_category DNS\n"; + print "a.type COUNTER\n"; + print "mx.type COUNTER\n"; + + print "a.label A\n"; + print "ns.label NS\n"; + print "cname.label CNAME\n"; + print "soa.label SOA\n"; + print "ptr.label PTR\n"; + print "mx.label MX\n"; + print "aaaa.label AAAA\n"; + print "any.label ANY\n"; + print "hinfo.label HINFO\n"; + print "txt.label TXT\n"; + print "rp.label RP\n"; + print "sig.label SIG\n"; + print "key.label KEY\n"; + print "a6.label A6\n"; + print "ixfr.label IXFR\n"; + print "axfr.label AXFR\n"; + + print "a.type COUNTER\n"; + print "ns.type COUNTER\n"; + print "cname.type COUNTER\n"; + print "soa.type COUNTER\n"; + print "ptr.type COUNTER\n"; + print "mx.type COUNTER\n"; + print "aaaa.type COUNTER\n"; + print "any.type COUNTER\n"; + print "hinfo.type COUNTER\n"; + print "txt.type COUNTER\n"; + print "rp.type COUNTER\n"; + print "sig.type COUNTER\n"; + print "key.type COUNTER\n"; + print "a6.type COUNTER\n"; + print "ixfr.type COUNTER\n"; + print "axfr.type COUNTER\n"; + exit 0; +} + +my %querytypes = ( + '0001' => 'A', + '0002' => 'NS', + '0005' => 'CNAME', + '0006' => 'SOA', + '000c' => 'PTR', + '000d' => 'HINFO', + '000f' => 'MX', + '0010' => 'TXT', + '0011' => 'RP', + '0018' => 'SIG', + '0019' => 'KEY', + '001c' => 'AAAA', + '0026' => 'A6', + '00fb' => 'IXFR', + '00fc' => 'AXFR', + '00ff' => 'ANY', +); + +my %sum = ( + (map {$_ => 0} values %querytypes), +); + +sub process_line($) +{ + my $line = shift; + if ($line =~ /^(@[a-f0-9]{24}) ([a-f0-9]{8}):[a-f0-9]{4}:[a-f0-9]{4} ([\+\-IC\/]) ([a-f0-9]{4}) (.+)$/) + { + #my $time = tai2unix($1); + my $ip = join(".", unpack("C*", pack("H8", $2))); + my $rtype = $3; + my $qtype = $querytypes{$4}; + #my $qstring = $5; # currently unused + + if ($rtype eq '+') + { + if ($qtype eq 'A'){$A++;}; + if ($qtype eq 'NS'){$NS++;}; + if ($qtype eq 'CNAME'){$CNAME++;}; + if ($qtype eq 'SOA'){$SOA++;}; + if ($qtype eq 'PTR'){$PTR++;}; + if ($qtype eq 'HINFO'){$HINFO++;}; + if ($qtype eq 'MX'){$MX++;}; + if ($qtype eq 'TXT'){$TXT++;}; + if ($qtype eq 'RP'){$RP++;}; + if ($qtype eq 'SIG'){$SIG++;}; + if ($qtype eq 'KEY'){$KEY++;}; + if ($qtype eq 'AAAA'){$AAAA++;}; + if ($qtype eq 'A6'){$A6++;}; + if ($qtype eq 'IXFR'){$IXFR++;}; + if ($qtype eq 'AXFR'){$AXFR++;}; + if ($qtype eq 'ANY'){$ANY++;}; + } + } +} + +open(LOG, "<$logfile") or die "Error opening $logfile: $!"; + +while () +{ + process_line($_); +} + +print "a.value $A\n"; +print "ns.value $NS\n"; +print "cname.value $CNAME\n"; +print "soa.value $SOA\n"; +print "ptr.value $PTR\n"; +print "mx.value $MX\n"; +print "aaaa.value $AAAA\n"; +print "any.value $ANY\n"; +print "hinfo.value $HINFO\n"; +print "txt.value $TXT\n"; +print "rp.value $RP\n"; +print "sig.value $SIG\n"; +print "key.value $KEY\n"; +print "a6.value $A6\n"; +print "ixfr.value $IXFR\n"; +print "axfr.value $AXFR\n"; + -- cgit v1.2.3 From bad976aee83677afeccdd9750fe791e7665fbfbd Mon Sep 17 00:00:00 2001 From: am Date: Fri, 1 Feb 2008 11:46:02 +0000 Subject: =?UTF-8?q?neuer=20versuch=20mit=20munin=20f=C3=BCr=20immer1-5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn/ipuppet/trunk/modules/munin@662 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/pg__connections | 142 ++++++++++++++++++++++++++++++++++++++++++ files/plugins/pg__locks | 119 +++++++++++++++++++++++++++++++++++ files/plugins/pg_conn | 51 +++++++++++++++ 3 files changed, 312 insertions(+) create mode 100755 files/plugins/pg__connections create mode 100755 files/plugins/pg__locks create mode 100755 files/plugins/pg_conn (limited to 'files') diff --git a/files/plugins/pg__connections b/files/plugins/pg__connections new file mode 100755 index 0000000..ca95f56 --- /dev/null +++ b/files/plugins/pg__connections @@ -0,0 +1,142 @@ +#!/usr/bin/perl -w +# Plugin for monitor postgres connections. +# +# Licenced under GPL v2. +# +# Usage: +# +# Symlink into /etc/munin/plugins/ and add the monitored +# database to the filename. e.g.: +# +# ln -s /usr/share/munin/plugins/pg__connections \ +# /etc/munin/plugins/pg__connections +# This should, however, be given through autoconf and suggest. +# +# If required, give username, password and/or Postgresql server +# host through environment variables. +# +# You must also activate Postgresql statistics. See +# http://www.postgresql.org/docs/7.4/interactive/monitoring-stats.html +# for how to enable this. Specifically, the following lines must +# exist in your postgresql.conf: +# +# stats_start_collector = true +# stats_block_level = true +# +# +# Parameters: +# +# config (required) +# +# Config variables: +# +# dbhost - Which database server to use. Defaults to +# 'localhost'. +# dbname - Which database to use. Defaults to template1 +# dbuser - A Postgresql user account with read permission to +# the given database. Defaults to +# 'postgres'. Anyway, Munin must be told which user +# this plugin should be run as. +# dbpass - The corresponding password, if +# applicable. Default to undef. Remember that +# pg_hba.conf must be configured accordingly. +# +# Magic markers +#%# family=auto +#%# capabilities=autoconf + +use strict; +use DBI; + +my $dbhost = $ENV{'dbhost'} || '127.0.0.1'; +my $dbname = $ENV{'dbname'} || 'template1'; +my $dbuser = $ENV{'dbuser'} || 'postgres'; +my $dbuserx = $ENV{'dbuserx'} || ''; +my $dbport = $ENV{'dbport'} || '5432'; +my $dbpass = $ENV{'dbpass'} || ''; + +# Check for DBD::Pg +if (! eval "require DBD::Pg;") { + print "requires DBD::Pg\n"; + exit 1; +} + +my $dsn = "DBI:Pg:dbname=$dbname;host=$dbhost;port=$dbport"; +#print "$dsn\n"; +my $dbh = DBI->connect ($dsn, $dbuser, + $dbpass, + {RaiseError =>1}) || die ""; + + + +if (exists $ARGV[0]) { + if ($ARGV[0] eq 'autoconf') { + # Check for DBD::Pg + if (! eval "require DBD::Pg;") { + print "no (DBD::Pg not found)"; + exit 1; + } + if ($dbh) { + print "yes\n"; + exit 0; + } else { + print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; + exit 1; + } + } + + if ($ARGV[0] eq "config") { + my $sql_max = "SHOW max_connections;"; + my $sth_max = $dbh->prepare($sql_max); + $sth_max->execute(); + my ($max_connections) = $sth_max->fetchrow(); + my $warning = int ($max_connections * 0.7); + my $critical = int ($max_connections * 0.8); + print "graph_title PostgresSQL active connections\n"; + print "graph_args -l 0 --base 1000\n"; + print "graph_vlabel Connections\n"; + print "graph_category Postgresql\n"; + print "graph_info Shows active Postgresql connections from $dbname\n"; + + + my $sql = "select datname, count(*) from pg_stat_activity group by datname"; + my $sth = $dbh->prepare($sql); + $sth->execute(); + my $setarea = "yes"; + while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) { + print "$datname.label $datname active connections\n"; + print "$datname.info $datname active connections\n"; + print "$datname.type GAUGE\n"; + if ($setarea eq "yes") { + print "$datname.draw AREA\n"; + $setarea=""; + } else { + print "$datname.draw STACK\n"; + } + } + + print "max_connections.label Max. connections\n"; + print "max_connections.info Max. connections\n"; + print "max_connections.type GAUGE\n"; + + print "warning $warning\n"; + print "critical $critical\n"; + exit 0; + } +} + + +# select datname, count(*) from pg_stat_activity group by datname +my $sql_max = "SHOW max_connections;"; +my $sth_max = $dbh->prepare($sql_max); +$sth_max->execute(); +my ($max_connections) = $sth_max->fetchrow(); + +#my $sql = "SELECT COUNT (*) FROM pg_stat_activity;"; +my $sql = "select datname, count(*) from pg_stat_activity group by datname"; +my $sth = $dbh->prepare($sql); +$sth->execute(); +while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) { + print "$datname.value $curr_conn\n"; +} +print "max_connections.value $max_connections\n"; diff --git a/files/plugins/pg__locks b/files/plugins/pg__locks new file mode 100755 index 0000000..33a9a8a --- /dev/null +++ b/files/plugins/pg__locks @@ -0,0 +1,119 @@ +#!/usr/bin/perl -w +# Plugin for monitor postgres connections. +# +# Licenced under GPL v2. +# +# Usage: +# +# Symlink into /etc/munin/plugins/ and add the monitored +# database to the filename. e.g.: +# +# ln -s /usr/share/munin/plugins/pg__locks \ +# /etc/munin/plugins/pg__locks +# This should, however, be given through autoconf and suggest. +# +# If required, give username, password and/or Postgresql server +# host through environment variables. +# +# You must also activate Postgresql statistics. See +# http://www.postgresql.org/docs/8.1/interactive/monitoring-locks.html +# for how to enable this. Specifically, the following lines must +# exist in your postgresql.conf: +# +# stats_start_collector = true +# stats_block_level = true +# +# +# Parameters: +# +# config (required) +# +# Config variables: +# +# dbhost - Which database server to use. Defaults to +# 'localhost'. +# dbname - Which database to use. Defaults to template1 +# dbuser - A Postgresql user account with read permission to +# the given database. Defaults to +# 'postgres'. Anyway, Munin must be told which user +# this plugin should be run as. +# dbpass - The corresponding password, if +# applicable. Default to undef. Remember that +# pg_hba.conf must be configured accordingly. +# +# Magic markers +#%# family=auto +#%# capabilities=autoconf + +use strict; +use DBI; + +my $dbhost = $ENV{'dbhost'} || '127.0.0.1'; +my $dbname = $ENV{'dbname'} || 'template1'; +my $dbuser = $ENV{'dbuser'} || 'postgres'; +my $dbport = $ENV{'dbport'} || '5432'; +my $dbpass = $ENV{'dbpass'} || ''; + +# Check for DBD::Pg +if (! eval "require DBD::Pg;") { + exit 1; +} + +my $dsn = "DBI:Pg:dbname=$dbname;host=$dbhost;port=$dbport"; +#print "$dsn\n"; +my $dbh = DBI->connect ($dsn, $dbuser, + $dbpass, + {RaiseError =>1}) || die ""; + + + +if (exists $ARGV[0]) { + if ($ARGV[0] eq 'autoconf') { + # Check for DBD::Pg + if (! eval "require DBD::Pg;") { + print "no (DBD::Pg not found)"; + exit 1; + } + if ($dbh) { + print "yes\n"; + exit 0; + } else { + print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; + exit 1; + } + } + + if ($ARGV[0] eq "config") { + print "graph_title PostgresSQL locks\n"; + print "graph_args --base 1000\n"; + print "graph_vlabel Locks\n"; + print "graph_category Postgresql\n"; + print "graph_info Shows Postgresql locks\n"; + print "locks.label Locks\n"; + print "locks.info Locks (more info here, please... :)\n"; + print "locks.type GAUGE\n"; + print "locks.warning 5\n"; + print "locks.critical 10\n"; + print "exlocks.label Exclusive locks\n"; + print "exlocks.info Exclusive locks (here too, please... :)\n"; + print "exlocks.type GAUGE\n"; + print "exlocks.warning 5\n"; + print "exlocks.critical 10\n"; + exit 0; + } +} + +my $sql="SELECT mode,COUNT(mode) FROM pg_locks GROUP BY mode ORDER BY mode;"; +my $sth = $dbh->prepare ($sql); +$sth->execute (); +my $locks = 0; +my $exlocks = 0; +while (my ($mode, $count) = $sth->fetchrow ()) { + if ($mode =~ /exclusive/i) { + $exlocks = $exlocks + $count; + } + $locks = $locks+$count; +} +print "locks.value $locks\n"; +print "exlocks.value $exlocks\n"; + diff --git a/files/plugins/pg_conn b/files/plugins/pg_conn new file mode 100755 index 0000000..aa2ebb7 --- /dev/null +++ b/files/plugins/pg_conn @@ -0,0 +1,51 @@ +#!/bin/sh +# +# Plugin to monitor PostgreSQL connections. +# +# Parameters: +# +# config (required) +# autoconf (optional - only used by munin-config) +# Based on netstat plugin +# $Log$ +# eric@ohmforce.com +# +# +# Magic markers (optional - used by munin-config and some installation +# scripts): +#%# family=auto +#%# capabilities=autoconf + + + +if [ "$1" = "autoconf" ]; then + if ( netstat -s 2>/dev/null >/dev/null ); then + echo yes + exit 0 + else + if [ $? -eq 127 ] + then + echo "no (netstat program not found)" + exit 1 + else + echo no + exit 1 + fi + fi +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title PostgreSQL' + echo 'graph_args -l 0 ' + echo 'graph_vlabel Number of PostgreSQL connections' + echo 'graph_category postgresql' + echo 'graph_period second' + echo 'graph_info This graph shows the number of opened connections on PostgreSQL.' + echo 'established.label established' + echo 'established.type GAUGE' + echo 'established.max 500' + echo 'established.info The number of currently open connections.' + exit 0 +fi +netstat -a | awk '{ print $4 }'| grep postgres | wc -l | xargs echo established.value -- cgit v1.2.3 From b4fd40ac48b7a67dd35e3a1e079c1ad38ddcb105 Mon Sep 17 00:00:00 2001 From: andreas Date: Fri, 1 Feb 2008 11:46:02 +0000 Subject: =?UTF-8?q?neuer=20versuch=20mit=20munin=20f=C3=BCr=20immer1-5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/plugins/pg__connections | 142 ++++++++++++++++++++++++++++++++++++++++++ files/plugins/pg__locks | 119 +++++++++++++++++++++++++++++++++++ files/plugins/pg_conn | 51 +++++++++++++++ 3 files changed, 312 insertions(+) create mode 100755 files/plugins/pg__connections create mode 100755 files/plugins/pg__locks create mode 100755 files/plugins/pg_conn (limited to 'files') diff --git a/files/plugins/pg__connections b/files/plugins/pg__connections new file mode 100755 index 0000000..ca95f56 --- /dev/null +++ b/files/plugins/pg__connections @@ -0,0 +1,142 @@ +#!/usr/bin/perl -w +# Plugin for monitor postgres connections. +# +# Licenced under GPL v2. +# +# Usage: +# +# Symlink into /etc/munin/plugins/ and add the monitored +# database to the filename. e.g.: +# +# ln -s /usr/share/munin/plugins/pg__connections \ +# /etc/munin/plugins/pg__connections +# This should, however, be given through autoconf and suggest. +# +# If required, give username, password and/or Postgresql server +# host through environment variables. +# +# You must also activate Postgresql statistics. See +# http://www.postgresql.org/docs/7.4/interactive/monitoring-stats.html +# for how to enable this. Specifically, the following lines must +# exist in your postgresql.conf: +# +# stats_start_collector = true +# stats_block_level = true +# +# +# Parameters: +# +# config (required) +# +# Config variables: +# +# dbhost - Which database server to use. Defaults to +# 'localhost'. +# dbname - Which database to use. Defaults to template1 +# dbuser - A Postgresql user account with read permission to +# the given database. Defaults to +# 'postgres'. Anyway, Munin must be told which user +# this plugin should be run as. +# dbpass - The corresponding password, if +# applicable. Default to undef. Remember that +# pg_hba.conf must be configured accordingly. +# +# Magic markers +#%# family=auto +#%# capabilities=autoconf + +use strict; +use DBI; + +my $dbhost = $ENV{'dbhost'} || '127.0.0.1'; +my $dbname = $ENV{'dbname'} || 'template1'; +my $dbuser = $ENV{'dbuser'} || 'postgres'; +my $dbuserx = $ENV{'dbuserx'} || ''; +my $dbport = $ENV{'dbport'} || '5432'; +my $dbpass = $ENV{'dbpass'} || ''; + +# Check for DBD::Pg +if (! eval "require DBD::Pg;") { + print "requires DBD::Pg\n"; + exit 1; +} + +my $dsn = "DBI:Pg:dbname=$dbname;host=$dbhost;port=$dbport"; +#print "$dsn\n"; +my $dbh = DBI->connect ($dsn, $dbuser, + $dbpass, + {RaiseError =>1}) || die ""; + + + +if (exists $ARGV[0]) { + if ($ARGV[0] eq 'autoconf') { + # Check for DBD::Pg + if (! eval "require DBD::Pg;") { + print "no (DBD::Pg not found)"; + exit 1; + } + if ($dbh) { + print "yes\n"; + exit 0; + } else { + print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; + exit 1; + } + } + + if ($ARGV[0] eq "config") { + my $sql_max = "SHOW max_connections;"; + my $sth_max = $dbh->prepare($sql_max); + $sth_max->execute(); + my ($max_connections) = $sth_max->fetchrow(); + my $warning = int ($max_connections * 0.7); + my $critical = int ($max_connections * 0.8); + print "graph_title PostgresSQL active connections\n"; + print "graph_args -l 0 --base 1000\n"; + print "graph_vlabel Connections\n"; + print "graph_category Postgresql\n"; + print "graph_info Shows active Postgresql connections from $dbname\n"; + + + my $sql = "select datname, count(*) from pg_stat_activity group by datname"; + my $sth = $dbh->prepare($sql); + $sth->execute(); + my $setarea = "yes"; + while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) { + print "$datname.label $datname active connections\n"; + print "$datname.info $datname active connections\n"; + print "$datname.type GAUGE\n"; + if ($setarea eq "yes") { + print "$datname.draw AREA\n"; + $setarea=""; + } else { + print "$datname.draw STACK\n"; + } + } + + print "max_connections.label Max. connections\n"; + print "max_connections.info Max. connections\n"; + print "max_connections.type GAUGE\n"; + + print "warning $warning\n"; + print "critical $critical\n"; + exit 0; + } +} + + +# select datname, count(*) from pg_stat_activity group by datname +my $sql_max = "SHOW max_connections;"; +my $sth_max = $dbh->prepare($sql_max); +$sth_max->execute(); +my ($max_connections) = $sth_max->fetchrow(); + +#my $sql = "SELECT COUNT (*) FROM pg_stat_activity;"; +my $sql = "select datname, count(*) from pg_stat_activity group by datname"; +my $sth = $dbh->prepare($sql); +$sth->execute(); +while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) { + print "$datname.value $curr_conn\n"; +} +print "max_connections.value $max_connections\n"; diff --git a/files/plugins/pg__locks b/files/plugins/pg__locks new file mode 100755 index 0000000..33a9a8a --- /dev/null +++ b/files/plugins/pg__locks @@ -0,0 +1,119 @@ +#!/usr/bin/perl -w +# Plugin for monitor postgres connections. +# +# Licenced under GPL v2. +# +# Usage: +# +# Symlink into /etc/munin/plugins/ and add the monitored +# database to the filename. e.g.: +# +# ln -s /usr/share/munin/plugins/pg__locks \ +# /etc/munin/plugins/pg__locks +# This should, however, be given through autoconf and suggest. +# +# If required, give username, password and/or Postgresql server +# host through environment variables. +# +# You must also activate Postgresql statistics. See +# http://www.postgresql.org/docs/8.1/interactive/monitoring-locks.html +# for how to enable this. Specifically, the following lines must +# exist in your postgresql.conf: +# +# stats_start_collector = true +# stats_block_level = true +# +# +# Parameters: +# +# config (required) +# +# Config variables: +# +# dbhost - Which database server to use. Defaults to +# 'localhost'. +# dbname - Which database to use. Defaults to template1 +# dbuser - A Postgresql user account with read permission to +# the given database. Defaults to +# 'postgres'. Anyway, Munin must be told which user +# this plugin should be run as. +# dbpass - The corresponding password, if +# applicable. Default to undef. Remember that +# pg_hba.conf must be configured accordingly. +# +# Magic markers +#%# family=auto +#%# capabilities=autoconf + +use strict; +use DBI; + +my $dbhost = $ENV{'dbhost'} || '127.0.0.1'; +my $dbname = $ENV{'dbname'} || 'template1'; +my $dbuser = $ENV{'dbuser'} || 'postgres'; +my $dbport = $ENV{'dbport'} || '5432'; +my $dbpass = $ENV{'dbpass'} || ''; + +# Check for DBD::Pg +if (! eval "require DBD::Pg;") { + exit 1; +} + +my $dsn = "DBI:Pg:dbname=$dbname;host=$dbhost;port=$dbport"; +#print "$dsn\n"; +my $dbh = DBI->connect ($dsn, $dbuser, + $dbpass, + {RaiseError =>1}) || die ""; + + + +if (exists $ARGV[0]) { + if ($ARGV[0] eq 'autoconf') { + # Check for DBD::Pg + if (! eval "require DBD::Pg;") { + print "no (DBD::Pg not found)"; + exit 1; + } + if ($dbh) { + print "yes\n"; + exit 0; + } else { + print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; + exit 1; + } + } + + if ($ARGV[0] eq "config") { + print "graph_title PostgresSQL locks\n"; + print "graph_args --base 1000\n"; + print "graph_vlabel Locks\n"; + print "graph_category Postgresql\n"; + print "graph_info Shows Postgresql locks\n"; + print "locks.label Locks\n"; + print "locks.info Locks (more info here, please... :)\n"; + print "locks.type GAUGE\n"; + print "locks.warning 5\n"; + print "locks.critical 10\n"; + print "exlocks.label Exclusive locks\n"; + print "exlocks.info Exclusive locks (here too, please... :)\n"; + print "exlocks.type GAUGE\n"; + print "exlocks.warning 5\n"; + print "exlocks.critical 10\n"; + exit 0; + } +} + +my $sql="SELECT mode,COUNT(mode) FROM pg_locks GROUP BY mode ORDER BY mode;"; +my $sth = $dbh->prepare ($sql); +$sth->execute (); +my $locks = 0; +my $exlocks = 0; +while (my ($mode, $count) = $sth->fetchrow ()) { + if ($mode =~ /exclusive/i) { + $exlocks = $exlocks + $count; + } + $locks = $locks+$count; +} +print "locks.value $locks\n"; +print "exlocks.value $exlocks\n"; + diff --git a/files/plugins/pg_conn b/files/plugins/pg_conn new file mode 100755 index 0000000..aa2ebb7 --- /dev/null +++ b/files/plugins/pg_conn @@ -0,0 +1,51 @@ +#!/bin/sh +# +# Plugin to monitor PostgreSQL connections. +# +# Parameters: +# +# config (required) +# autoconf (optional - only used by munin-config) +# Based on netstat plugin +# $Log$ +# eric@ohmforce.com +# +# +# Magic markers (optional - used by munin-config and some installation +# scripts): +#%# family=auto +#%# capabilities=autoconf + + + +if [ "$1" = "autoconf" ]; then + if ( netstat -s 2>/dev/null >/dev/null ); then + echo yes + exit 0 + else + if [ $? -eq 127 ] + then + echo "no (netstat program not found)" + exit 1 + else + echo no + exit 1 + fi + fi +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title PostgreSQL' + echo 'graph_args -l 0 ' + echo 'graph_vlabel Number of PostgreSQL connections' + echo 'graph_category postgresql' + echo 'graph_period second' + echo 'graph_info This graph shows the number of opened connections on PostgreSQL.' + echo 'established.label established' + echo 'established.type GAUGE' + echo 'established.max 500' + echo 'established.info The number of currently open connections.' + exit 0 +fi +netstat -a | awk '{ print $4 }'| grep postgres | wc -l | xargs echo established.value -- cgit v1.2.3 From ef97c202ad675255deb20bdfce59fe03ad757a63 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 29 Mar 2008 14:27:08 +0000 Subject: fixed header git-svn-id: https://svn/ipuppet/trunk/modules/munin@1142 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/selinuxenforced | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'files') diff --git a/files/plugins/selinuxenforced b/files/plugins/selinuxenforced index 2f88b9b..16a3f66 100755 --- a/files/plugins/selinuxenforced +++ b/files/plugins/selinuxenforced @@ -1,14 +1,9 @@ #!/bin/sh # -*- sh -*- # -# Plugin to count the daily amount of Virii (qmailscan) +# Plugin to monitor the status of selinux # -# Contributed by David Obando (david@cryptix.de) - 03.12.2005 -# - -# define the logfiles. when you rotate them at any other time than 00:00 you have to define two logfiles: -#LOG0=/var/spool/qmailscan/quarantine.log -#LOG1=/var/spool/qmailscan/quarantine.log.1 +# Contributed by admin(at)immerda.ch if [ "$1" = "autoconf" ]; then echo yes -- cgit v1.2.3 From 14105f0629c105ffe276807fc2c6adfe84fbdac7 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 29 Mar 2008 14:27:08 +0000 Subject: fixed header --- files/plugins/selinuxenforced | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'files') diff --git a/files/plugins/selinuxenforced b/files/plugins/selinuxenforced index 2f88b9b..16a3f66 100755 --- a/files/plugins/selinuxenforced +++ b/files/plugins/selinuxenforced @@ -1,14 +1,9 @@ #!/bin/sh # -*- sh -*- # -# Plugin to count the daily amount of Virii (qmailscan) +# Plugin to monitor the status of selinux # -# Contributed by David Obando (david@cryptix.de) - 03.12.2005 -# - -# define the logfiles. when you rotate them at any other time than 00:00 you have to define two logfiles: -#LOG0=/var/spool/qmailscan/quarantine.log -#LOG1=/var/spool/qmailscan/quarantine.log.1 +# Contributed by admin(at)immerda.ch if [ "$1" = "autoconf" ]; then echo yes -- cgit v1.2.3 From bb8699288512aa2d1de7ad12b0420146f8daabfd Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 30 Mar 2008 17:34:40 +0000 Subject: added default apache modules git-svn-id: https://svn/ipuppet/trunk/modules/munin@1152 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/apache_activity | 99 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 files/plugins/apache_activity (limited to 'files') diff --git a/files/plugins/apache_activity b/files/plugins/apache_activity new file mode 100755 index 0000000..65fc072 --- /dev/null +++ b/files/plugins/apache_activity @@ -0,0 +1,99 @@ +#!/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"; + } + } +} + + -- cgit v1.2.3 From d6783519aae52160c3e5448728c443e24ad7f45c Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 30 Mar 2008 17:34:40 +0000 Subject: added default apache modules --- files/plugins/apache_activity | 99 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 files/plugins/apache_activity (limited to 'files') diff --git a/files/plugins/apache_activity b/files/plugins/apache_activity new file mode 100755 index 0000000..65fc072 --- /dev/null +++ b/files/plugins/apache_activity @@ -0,0 +1,99 @@ +#!/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"; + } + } +} + + -- cgit v1.2.3 From ebdcae0d53a7ee50e2abb2f6606f731cb76c83e8 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Tue, 22 Apr 2008 11:28:54 +0200 Subject: empty module $MODULENAME --- files/.git_placeholder | 1 + 1 file changed, 1 insertion(+) create mode 100644 files/.git_placeholder (limited to 'files') diff --git a/files/.git_placeholder b/files/.git_placeholder new file mode 100644 index 0000000..89cb1fe --- /dev/null +++ b/files/.git_placeholder @@ -0,0 +1 @@ +# file needed for git - don't remove it -- cgit v1.2.3 From fd83ae45a94213366b069b1e0278868129430006 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Tue, 22 Apr 2008 15:31:37 +0200 Subject: added nagios plugins --- files/plugins/nagios_hosts | 28 ++++++++++++++++++++++++++++ files/plugins/nagios_perf_ | 35 +++++++++++++++++++++++++++++++++++ files/plugins/nagios_svc | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100755 files/plugins/nagios_hosts create mode 100755 files/plugins/nagios_perf_ create mode 100755 files/plugins/nagios_svc (limited to 'files') diff --git a/files/plugins/nagios_hosts b/files/plugins/nagios_hosts new file mode 100755 index 0000000..04fe8ed --- /dev/null +++ b/files/plugins/nagios_hosts @@ -0,0 +1,28 @@ +#!/bin/bash + +if [ "$1" = "config" ]; then + echo 'graph_title Nagios host stats' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel hosts' + echo 'graph_category nagios' + echo 'graph_info The number of hosts checked by nagios' + echo 'up.label up' + echo 'up.draw AREA' + echo 'up.info number of hosts UP' + echo 'down.label down' + echo 'down.draw STACK' + echo 'down.info number of hosts DOWN' + echo 'unr.label unr' + echo 'unr.draw STACK' + echo 'unr.info number of hosts UNREACHABLE' + + exit 0 +fi + +echo -n 'up.value ' +nagios2stats --mrtg --data NUMHSTUP +echo -n 'down.value ' +nagios2stats --mrtg --data NUMHSTDOWN +echo -n 'unr.value ' +nagios2stats --mrtg --data NUMHSTUNR + diff --git a/files/plugins/nagios_perf_ b/files/plugins/nagios_perf_ new file mode 100755 index 0000000..f819def --- /dev/null +++ b/files/plugins/nagios_perf_ @@ -0,0 +1,35 @@ +#!/bin/bash + +NAME=$(basename $0) + +TYPE=${NAME##nagios_perf_} + +[ "x$TYPE" = 'xhosts' ] && TYPE_ABBR=HST +[ "x$TYPE" = 'xsvc' ] && TYPE_ABBR=SVC +[ -z "$TYPE_ABBR" ] && echo "unknown type $TYPE" >&2 && exit 1 + +if [ "$1" = "config" ]; then + echo "graph_title Nagios $TYPE performance stats" + echo "graph_args --base 1000" + echo "graph_vlabel seconds" + echo "graph_category nagios" + echo "graph_info Check performance statistics" + + echo "act_lat_$TYPE_ABBR.label act lat" + echo "act_lat_$TYPE_ABBR.type GAUGE" + echo "act_lat_$TYPE_ABBR.draw AREA" + echo "act_lat_$TYPE_ABBR.cdef act_lat_$TYPE_ABBR,1000,/" + echo "act_lat_$TYPE_ABBR.info average latency of active checks over the last 5 minutes" + + echo "act_ext_$TYPE_ABBR.label act ext" + echo "act_ext_$TYPE_ABBR.type GAUGE" + echo "act_ext_$TYPE_ABBR.draw LINE1" + echo "act_ext_$TYPE_ABBR.cdef act_ext_$TYPE_ABBR,1000,/" + echo "act_ext_$TYPE_ABBR.info average execution time of active checks over the last 5 minutes" + + exit 0 +fi + +echo "act_lat_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}LAT) +echo "act_ext_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}EXT) + diff --git a/files/plugins/nagios_svc b/files/plugins/nagios_svc new file mode 100755 index 0000000..3938999 --- /dev/null +++ b/files/plugins/nagios_svc @@ -0,0 +1,33 @@ +#!/bin/bash + +if [ "$1" = "config" ]; then + echo 'graph_title Nagios service stats' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel services' + echo 'graph_category nagios' + echo 'graph_info The number of services checked by nagios' + echo 'ok.label ok' + echo 'ok.draw AREA' + echo 'ok.info number of services OK' + echo 'warn.label warn' + echo 'warn.draw STACK' + echo 'warn.info number of services WARNING' + echo 'crit.label crit' + echo 'crit.draw STACK' + echo 'crit.info number of services CRITICAL' + echo 'unkn.label unkn' + echo 'unkn.draw STACK' + echo 'unkn.info number of services UNKNOWN' + + exit 0 +fi + +echo -n 'ok.value ' +nagios2stats --mrtg --data NUMSVCOK +echo -n 'warn.value ' +nagios2stats --mrtg --data NUMSVCWARN +echo -n 'crit.value ' +nagios2stats --mrtg --data NUMSVCCRIT +echo -n 'unkn.value ' +nagios2stats --mrtg --data NUMSVCUNKN + -- cgit v1.2.3 From 70e9b0703c41ebbd7f9902488f41c3d90e77981a Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Tue, 22 Apr 2008 15:41:02 +0200 Subject: added new xen plugin --- files/plugins/xen_traffic_all | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 files/plugins/xen_traffic_all (limited to 'files') diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all new file mode 100644 index 0000000..1216a7d --- /dev/null +++ b/files/plugins/xen_traffic_all @@ -0,0 +1,63 @@ +#!/bin/sh +# Author: mario manno +# Description: measure traffic for all xen hosts +# +#%# family=auto +#%# capabilities=autoconf + +if [ "$1" = "autoconf" ]; then + if which xm > /dev/null ; then + echo yes + else + echo "no (xm not found)" + exit 1 + fi + if [ -r /proc/net/dev ]; then + echo yes + else + echo "no (/proc/net/dev not found)" + exit 1 + fi + exit 0 +fi + +if [ "$1" = "config" ]; then + echo 'graph_title Xen Traffic' + echo 'graph_vlabel bits received (-) / sent (+) per ${graph_period}' + echo 'graph_args --base 1024 -l 0' + 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" + + 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 + exit 0 +fi + +DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)") +for dom in $DOMAINS; do + dev=$( 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 +done + -- cgit v1.2.3 From 65fb027d8cf639c565b0f9fb53b5fbe9ee25dc7b Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Tue, 22 Apr 2008 20:26:12 +0200 Subject: try to add an empty dir --- files/empty/.git_placeholder | 1 + 1 file changed, 1 insertion(+) create mode 100644 files/empty/.git_placeholder (limited to 'files') diff --git a/files/empty/.git_placeholder b/files/empty/.git_placeholder new file mode 100644 index 0000000..91162ec --- /dev/null +++ b/files/empty/.git_placeholder @@ -0,0 +1 @@ +# just used for git -- cgit v1.2.3 From 9dca19736cd11ed42cfdb8aed30c8628b22231cb Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 24 Apr 2008 13:26:14 +0000 Subject: merged with puzzle upstream git-svn-id: https://svn/ipuppet/trunk/modules/munin@1254 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/nagios_hosts | 28 +++++++++++++++++++ files/plugins/nagios_perf_ | 35 ++++++++++++++++++++++++ files/plugins/nagios_svc | 33 +++++++++++++++++++++++ files/plugins/xen_traffic_all | 63 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100755 files/plugins/nagios_hosts create mode 100755 files/plugins/nagios_perf_ create mode 100755 files/plugins/nagios_svc create mode 100644 files/plugins/xen_traffic_all (limited to 'files') diff --git a/files/plugins/nagios_hosts b/files/plugins/nagios_hosts new file mode 100755 index 0000000..04fe8ed --- /dev/null +++ b/files/plugins/nagios_hosts @@ -0,0 +1,28 @@ +#!/bin/bash + +if [ "$1" = "config" ]; then + echo 'graph_title Nagios host stats' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel hosts' + echo 'graph_category nagios' + echo 'graph_info The number of hosts checked by nagios' + echo 'up.label up' + echo 'up.draw AREA' + echo 'up.info number of hosts UP' + echo 'down.label down' + echo 'down.draw STACK' + echo 'down.info number of hosts DOWN' + echo 'unr.label unr' + echo 'unr.draw STACK' + echo 'unr.info number of hosts UNREACHABLE' + + exit 0 +fi + +echo -n 'up.value ' +nagios2stats --mrtg --data NUMHSTUP +echo -n 'down.value ' +nagios2stats --mrtg --data NUMHSTDOWN +echo -n 'unr.value ' +nagios2stats --mrtg --data NUMHSTUNR + diff --git a/files/plugins/nagios_perf_ b/files/plugins/nagios_perf_ new file mode 100755 index 0000000..f819def --- /dev/null +++ b/files/plugins/nagios_perf_ @@ -0,0 +1,35 @@ +#!/bin/bash + +NAME=$(basename $0) + +TYPE=${NAME##nagios_perf_} + +[ "x$TYPE" = 'xhosts' ] && TYPE_ABBR=HST +[ "x$TYPE" = 'xsvc' ] && TYPE_ABBR=SVC +[ -z "$TYPE_ABBR" ] && echo "unknown type $TYPE" >&2 && exit 1 + +if [ "$1" = "config" ]; then + echo "graph_title Nagios $TYPE performance stats" + echo "graph_args --base 1000" + echo "graph_vlabel seconds" + echo "graph_category nagios" + echo "graph_info Check performance statistics" + + echo "act_lat_$TYPE_ABBR.label act lat" + echo "act_lat_$TYPE_ABBR.type GAUGE" + echo "act_lat_$TYPE_ABBR.draw AREA" + echo "act_lat_$TYPE_ABBR.cdef act_lat_$TYPE_ABBR,1000,/" + echo "act_lat_$TYPE_ABBR.info average latency of active checks over the last 5 minutes" + + echo "act_ext_$TYPE_ABBR.label act ext" + echo "act_ext_$TYPE_ABBR.type GAUGE" + echo "act_ext_$TYPE_ABBR.draw LINE1" + echo "act_ext_$TYPE_ABBR.cdef act_ext_$TYPE_ABBR,1000,/" + echo "act_ext_$TYPE_ABBR.info average execution time of active checks over the last 5 minutes" + + exit 0 +fi + +echo "act_lat_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}LAT) +echo "act_ext_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}EXT) + diff --git a/files/plugins/nagios_svc b/files/plugins/nagios_svc new file mode 100755 index 0000000..3938999 --- /dev/null +++ b/files/plugins/nagios_svc @@ -0,0 +1,33 @@ +#!/bin/bash + +if [ "$1" = "config" ]; then + echo 'graph_title Nagios service stats' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel services' + echo 'graph_category nagios' + echo 'graph_info The number of services checked by nagios' + echo 'ok.label ok' + echo 'ok.draw AREA' + echo 'ok.info number of services OK' + echo 'warn.label warn' + echo 'warn.draw STACK' + echo 'warn.info number of services WARNING' + echo 'crit.label crit' + echo 'crit.draw STACK' + echo 'crit.info number of services CRITICAL' + echo 'unkn.label unkn' + echo 'unkn.draw STACK' + echo 'unkn.info number of services UNKNOWN' + + exit 0 +fi + +echo -n 'ok.value ' +nagios2stats --mrtg --data NUMSVCOK +echo -n 'warn.value ' +nagios2stats --mrtg --data NUMSVCWARN +echo -n 'crit.value ' +nagios2stats --mrtg --data NUMSVCCRIT +echo -n 'unkn.value ' +nagios2stats --mrtg --data NUMSVCUNKN + diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all new file mode 100644 index 0000000..1216a7d --- /dev/null +++ b/files/plugins/xen_traffic_all @@ -0,0 +1,63 @@ +#!/bin/sh +# Author: mario manno +# Description: measure traffic for all xen hosts +# +#%# family=auto +#%# capabilities=autoconf + +if [ "$1" = "autoconf" ]; then + if which xm > /dev/null ; then + echo yes + else + echo "no (xm not found)" + exit 1 + fi + if [ -r /proc/net/dev ]; then + echo yes + else + echo "no (/proc/net/dev not found)" + exit 1 + fi + exit 0 +fi + +if [ "$1" = "config" ]; then + echo 'graph_title Xen Traffic' + echo 'graph_vlabel bits received (-) / sent (+) per ${graph_period}' + echo 'graph_args --base 1024 -l 0' + 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" + + 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 + exit 0 +fi + +DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)") +for dom in $DOMAINS; do + dev=$( 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 +done + -- cgit v1.2.3 From 20f5f7d8c26c9272ef302606a6d71ef1b943919a Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 24 Apr 2008 13:26:14 +0000 Subject: merged with puzzle upstream --- files/plugins/nagios_hosts | 28 +++++++++++++++++++ files/plugins/nagios_perf_ | 35 ++++++++++++++++++++++++ files/plugins/nagios_svc | 33 +++++++++++++++++++++++ files/plugins/xen_traffic_all | 63 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100755 files/plugins/nagios_hosts create mode 100755 files/plugins/nagios_perf_ create mode 100755 files/plugins/nagios_svc create mode 100644 files/plugins/xen_traffic_all (limited to 'files') diff --git a/files/plugins/nagios_hosts b/files/plugins/nagios_hosts new file mode 100755 index 0000000..04fe8ed --- /dev/null +++ b/files/plugins/nagios_hosts @@ -0,0 +1,28 @@ +#!/bin/bash + +if [ "$1" = "config" ]; then + echo 'graph_title Nagios host stats' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel hosts' + echo 'graph_category nagios' + echo 'graph_info The number of hosts checked by nagios' + echo 'up.label up' + echo 'up.draw AREA' + echo 'up.info number of hosts UP' + echo 'down.label down' + echo 'down.draw STACK' + echo 'down.info number of hosts DOWN' + echo 'unr.label unr' + echo 'unr.draw STACK' + echo 'unr.info number of hosts UNREACHABLE' + + exit 0 +fi + +echo -n 'up.value ' +nagios2stats --mrtg --data NUMHSTUP +echo -n 'down.value ' +nagios2stats --mrtg --data NUMHSTDOWN +echo -n 'unr.value ' +nagios2stats --mrtg --data NUMHSTUNR + diff --git a/files/plugins/nagios_perf_ b/files/plugins/nagios_perf_ new file mode 100755 index 0000000..f819def --- /dev/null +++ b/files/plugins/nagios_perf_ @@ -0,0 +1,35 @@ +#!/bin/bash + +NAME=$(basename $0) + +TYPE=${NAME##nagios_perf_} + +[ "x$TYPE" = 'xhosts' ] && TYPE_ABBR=HST +[ "x$TYPE" = 'xsvc' ] && TYPE_ABBR=SVC +[ -z "$TYPE_ABBR" ] && echo "unknown type $TYPE" >&2 && exit 1 + +if [ "$1" = "config" ]; then + echo "graph_title Nagios $TYPE performance stats" + echo "graph_args --base 1000" + echo "graph_vlabel seconds" + echo "graph_category nagios" + echo "graph_info Check performance statistics" + + echo "act_lat_$TYPE_ABBR.label act lat" + echo "act_lat_$TYPE_ABBR.type GAUGE" + echo "act_lat_$TYPE_ABBR.draw AREA" + echo "act_lat_$TYPE_ABBR.cdef act_lat_$TYPE_ABBR,1000,/" + echo "act_lat_$TYPE_ABBR.info average latency of active checks over the last 5 minutes" + + echo "act_ext_$TYPE_ABBR.label act ext" + echo "act_ext_$TYPE_ABBR.type GAUGE" + echo "act_ext_$TYPE_ABBR.draw LINE1" + echo "act_ext_$TYPE_ABBR.cdef act_ext_$TYPE_ABBR,1000,/" + echo "act_ext_$TYPE_ABBR.info average execution time of active checks over the last 5 minutes" + + exit 0 +fi + +echo "act_lat_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}LAT) +echo "act_ext_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}EXT) + diff --git a/files/plugins/nagios_svc b/files/plugins/nagios_svc new file mode 100755 index 0000000..3938999 --- /dev/null +++ b/files/plugins/nagios_svc @@ -0,0 +1,33 @@ +#!/bin/bash + +if [ "$1" = "config" ]; then + echo 'graph_title Nagios service stats' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel services' + echo 'graph_category nagios' + echo 'graph_info The number of services checked by nagios' + echo 'ok.label ok' + echo 'ok.draw AREA' + echo 'ok.info number of services OK' + echo 'warn.label warn' + echo 'warn.draw STACK' + echo 'warn.info number of services WARNING' + echo 'crit.label crit' + echo 'crit.draw STACK' + echo 'crit.info number of services CRITICAL' + echo 'unkn.label unkn' + echo 'unkn.draw STACK' + echo 'unkn.info number of services UNKNOWN' + + exit 0 +fi + +echo -n 'ok.value ' +nagios2stats --mrtg --data NUMSVCOK +echo -n 'warn.value ' +nagios2stats --mrtg --data NUMSVCWARN +echo -n 'crit.value ' +nagios2stats --mrtg --data NUMSVCCRIT +echo -n 'unkn.value ' +nagios2stats --mrtg --data NUMSVCUNKN + diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all new file mode 100644 index 0000000..1216a7d --- /dev/null +++ b/files/plugins/xen_traffic_all @@ -0,0 +1,63 @@ +#!/bin/sh +# Author: mario manno +# Description: measure traffic for all xen hosts +# +#%# family=auto +#%# capabilities=autoconf + +if [ "$1" = "autoconf" ]; then + if which xm > /dev/null ; then + echo yes + else + echo "no (xm not found)" + exit 1 + fi + if [ -r /proc/net/dev ]; then + echo yes + else + echo "no (/proc/net/dev not found)" + exit 1 + fi + exit 0 +fi + +if [ "$1" = "config" ]; then + echo 'graph_title Xen Traffic' + echo 'graph_vlabel bits received (-) / sent (+) per ${graph_period}' + echo 'graph_args --base 1024 -l 0' + 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" + + 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 + exit 0 +fi + +DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)") +for dom in $DOMAINS; do + dev=$( 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 +done + -- cgit v1.2.3 From b312f62d11fa036c2e75d6afaafb14b03d38660b Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 25 Apr 2008 11:23:45 +0000 Subject: fixed category git-svn-id: https://svn/ipuppet/trunk/modules/munin@1263 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/selinux_avcstats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files') diff --git a/files/plugins/selinux_avcstats b/files/plugins/selinux_avcstats index 9687be0..b7d2dbb 100755 --- a/files/plugins/selinux_avcstats +++ b/files/plugins/selinux_avcstats @@ -31,7 +31,7 @@ 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 system' + echo 'graph_category selinux' echo 'lookups.label lookups' echo 'lookups.type DERIVE' -- cgit v1.2.3 From 323fe6ec08ab758001f10b8f9a9b56656d2131cd Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 25 Apr 2008 11:23:45 +0000 Subject: fixed category --- files/plugins/selinux_avcstats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files') diff --git a/files/plugins/selinux_avcstats b/files/plugins/selinux_avcstats index 9687be0..b7d2dbb 100755 --- a/files/plugins/selinux_avcstats +++ b/files/plugins/selinux_avcstats @@ -31,7 +31,7 @@ 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 system' + echo 'graph_category selinux' echo 'lookups.label lookups' echo 'lookups.type DERIVE' -- cgit v1.2.3 From e9910cf5749f5c3f96199cd2a91c269dbbaa5ef3 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 19 May 2008 18:50:29 +0200 Subject: removed unneeded file --- files/.git_placeholder | 1 - 1 file changed, 1 deletion(-) delete mode 100644 files/.git_placeholder (limited to 'files') diff --git a/files/.git_placeholder b/files/.git_placeholder deleted file mode 100644 index 89cb1fe..0000000 --- a/files/.git_placeholder +++ /dev/null @@ -1 +0,0 @@ -# file needed for git - don't remove it -- cgit v1.2.3 From 4f8fbfcc736d02ec0528b0df571d5d4a458c261e Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2008 20:02:35 +0000 Subject: Merge commit 'puzzle/development' git-svn-id: https://svn/ipuppet/trunk/modules/munin@1600 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/empty/.git_placeholder | 1 + 1 file changed, 1 insertion(+) create mode 100644 files/empty/.git_placeholder (limited to 'files') diff --git a/files/empty/.git_placeholder b/files/empty/.git_placeholder new file mode 100644 index 0000000..91162ec --- /dev/null +++ b/files/empty/.git_placeholder @@ -0,0 +1 @@ +# just used for git -- cgit v1.2.3 From 805d56cac760f6d047b83c470c080bee3342165f Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2008 20:02:35 +0000 Subject: Merge commit 'puzzle/development' --- files/empty/.git_placeholder | 1 + 1 file changed, 1 insertion(+) create mode 100644 files/empty/.git_placeholder (limited to 'files') diff --git a/files/empty/.git_placeholder b/files/empty/.git_placeholder new file mode 100644 index 0000000..91162ec --- /dev/null +++ b/files/empty/.git_placeholder @@ -0,0 +1 @@ +# just used for git -- cgit v1.2.3 From 9da545785dca34eb9e76321bf3a2396521e3ac45 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 8 Jul 2008 18:41:55 +0000 Subject: merged with davids and removed a case statement, which made no sense git-svn-id: https://svn/ipuppet/trunk/modules/munin@1778 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/modules_dir/.ignore | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 files/modules_dir/.ignore (limited to 'files') diff --git a/files/modules_dir/.ignore b/files/modules_dir/.ignore new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From d1da2f1bc572a889534623910a86bbf3334ae615 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 8 Jul 2008 18:41:55 +0000 Subject: merged with davids and removed a case statement, which made no sense --- files/modules_dir/.ignore | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 files/modules_dir/.ignore (limited to 'files') diff --git a/files/modules_dir/.ignore b/files/modules_dir/.ignore new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From a73d92553609a8195beaf6d531d5c0c20e9b5f07 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Wed, 16 Jul 2008 14:09:01 +0200 Subject: fixed xen_traffic_all plugin --- files/plugins/xen_traffic_all | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'files') 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 # 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 -- cgit v1.2.3 From aa90466bb4a4c0404321531f40311d5c0726684f Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Wed, 16 Jul 2008 16:41:05 +0200 Subject: for munin a . is a delimeter, so replacing . with _ --- files/plugins/xen_traffic_all | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files') diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index 73eb504..55740f0 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -58,7 +58,7 @@ for dom in $DOMAINS; do name=$real_name for dev in $devs; do if [ ${#devs} -gt 1 ]; then - name=$real_name"_"$dev + name=$real_name"_"`echo $dev | sed 's/\./\_/'` fi awk -v name="$name" -v interface="$dev" \ 'BEGIN { gsub(/\./, "\\.", interface) } \ -- cgit v1.2.3 From 2de5b80d2686711e0d7b0d8aabee6e14919709af Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Wed, 16 Jul 2008 17:25:31 +0200 Subject: fixing config --- files/plugins/xen_traffic_all | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'files') diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index 55740f0..3fcb508 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -34,18 +34,26 @@ 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 -- cgit v1.2.3 From cf9b3c380fbef1ff10f5e40f22bb2d3ef436c077 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 17 Jul 2008 12:58:47 +0000 Subject: Merge commit 'puzzle/development' git-svn-id: https://svn/ipuppet/trunk/modules/munin@1863 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/xen_traffic_all | 63 +++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 23 deletions(-) (limited to 'files') 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 # 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 -- cgit v1.2.3 From 4e6ec49e07afe8b04defa9ef06bb2ae0b7cceb04 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 17 Jul 2008 12:58:47 +0000 Subject: Merge commit 'puzzle/development' --- files/plugins/xen_traffic_all | 63 +++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 23 deletions(-) (limited to 'files') 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 # 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 -- cgit v1.2.3 From a0eba1c444207b6fad449e3de61d60fcdd6994d9 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 19 Jul 2008 15:12:10 +0000 Subject: factored out squid munin plugin, cleaned up some whitespaces in xen plugin git-svn-id: https://svn/ipuppet/trunk/modules/munin@1909 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/xen_traffic_all | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'files') diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index 3fcb508..1e9b06e 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -43,17 +43,17 @@ if [ "$1" = "config" ]; then name=$real_name"_"`echo $dev | sed 's/\./\_/'` fi #echo $name"UP.label $name" - #echo $name"DOWN.label $name" + #echo $name"DOWN.label $name" echo $name'Down.label received' - echo $name'Down.type COUNTER' + echo $name'Down.type COUNTER' echo $name'Down.graph no' - echo "${name}Down.cdef ${name}Down,8,*" + echo "${name}Down.cdef ${name}Down,8,*" echo "${name}Up.label ${name}" - echo $name'Up.type COUNTER' + echo $name'Up.type COUNTER' echo "${name}Up.negative ${name}Down" - echo "${name}Up.cdef ${name}Up,8,*" - done + echo "${name}Up.cdef ${name}Up,8,*" + done done exit 0 fi -- cgit v1.2.3 From edf55dda28e3642fd9fc849bcfd91f09e3844161 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 19 Jul 2008 15:12:10 +0000 Subject: factored out squid munin plugin, cleaned up some whitespaces in xen plugin --- files/plugins/xen_traffic_all | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'files') diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index 3fcb508..1e9b06e 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -43,17 +43,17 @@ if [ "$1" = "config" ]; then name=$real_name"_"`echo $dev | sed 's/\./\_/'` fi #echo $name"UP.label $name" - #echo $name"DOWN.label $name" + #echo $name"DOWN.label $name" echo $name'Down.label received' - echo $name'Down.type COUNTER' + echo $name'Down.type COUNTER' echo $name'Down.graph no' - echo "${name}Down.cdef ${name}Down,8,*" + echo "${name}Down.cdef ${name}Down,8,*" echo "${name}Up.label ${name}" - echo $name'Up.type COUNTER' + echo $name'Up.type COUNTER' echo "${name}Up.negative ${name}Down" - echo "${name}Up.cdef ${name}Up,8,*" - done + echo "${name}Up.cdef ${name}Up,8,*" + done done exit 0 fi -- cgit v1.2.3 From 551262955361a05b9f28c4871a89efaf51488139 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 21 Jul 2008 10:32:13 +0200 Subject: implemented cgi usage for munin graphing for centso --- files/config/host/logrotate.CentOS | 35 ++++++++++++++ files/config/host/munin.conf.header.CentOS | 73 ++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 files/config/host/logrotate.CentOS create mode 100644 files/config/host/munin.conf.header.CentOS (limited to 'files') diff --git a/files/config/host/logrotate.CentOS b/files/config/host/logrotate.CentOS new file mode 100644 index 0000000..411de3f --- /dev/null +++ b/files/config/host/logrotate.CentOS @@ -0,0 +1,35 @@ +/var/log/munin/munin-update.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-graph.log { + daily + missingok + rotate 7 + compress + notifempty + create 660 munin apache +} + +/var/log/munin/munin-html.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-limits.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS new file mode 100644 index 0000000..314a979 --- /dev/null +++ b/files/config/host/munin.conf.header.CentOS @@ -0,0 +1,73 @@ +# Example configuration file for Munin, generated by 'make build' + +# The next three variables specifies where the location of the RRD +# databases, the HTML output, and the logs, severally. They all +# must be writable by the user running munin-cron. +dbdir /var/lib/munin +htmldir /var/www/munin +logdir /var/log/munin +rundir /var/run/munin + +# Where to look for the HTML templates +tmpldir /etc/munin/templates + +# Make graphs show values per minute instead of per second +#graph_period minute + +# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime +# something changes (OK -> WARNING, CRITICAL -> OK, etc) +#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm +#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm +# +# For those with Nagios, the following might come in handy. In addition, +# the services must be defined in the Nagios server as well. +#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg + +graph_strategy cgi + +# a simple host tree +#[localhost] +# address 127.0.0.1 +# use_node_name yes + +# +# A more complex example of a host tree +# +## First our "normal" host. +# [fii.foo.com] +# address foo +# +## Then our other host... +# [fay.foo.com] +# address fay +# +## Then we want totals... +# [foo.com;Totals] #Force it into the "foo.com"-domain... +# update no # Turn off data-fetching for this "host". +# +# # The graph "load1". We want to see the loads of both machines... +# # "fii=fii.foo.com:load.load" means "label=machine:graph.field" +# load1.graph_title Loads side by side +# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# +# # The graph "load2". Now we want them stacked on top of each other. +# load2.graph_title Loads on top of each other +# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# load2.dummy_field.draw AREA # We want area instead the default LINE2. +# load2.dummy_field.label dummy # This is needed. Silly, really. +# +# # The graph "load3". Now we want them summarised into one field +# load3.graph_title Loads summarised +# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load +# load3.combined_loads.label Combined loads # Must be set, as this is +# # not a dummy field! +# +## ...and on a side note, I want them listen in another order (default is +## alphabetically) +# +# # Since [foo.com] would be interpreted as a host in the domain "com", we +# # specify that this is a domain by adding a semicolon. +# [foo.com;] +# node_order Totals fii.foo.com fay.foo.com +# + -- cgit v1.2.3 From e1999bb72e4c4fdd39d4b6556b53d78a46ddd71c Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 21 Jul 2008 16:02:48 +0200 Subject: correct naming of the placeholder --- files/empty/.git_placeholder | 1 - files/empty/.ignore | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 files/empty/.git_placeholder create mode 100644 files/empty/.ignore (limited to 'files') diff --git a/files/empty/.git_placeholder b/files/empty/.git_placeholder deleted file mode 100644 index 91162ec..0000000 --- a/files/empty/.git_placeholder +++ /dev/null @@ -1 +0,0 @@ -# just used for git diff --git a/files/empty/.ignore b/files/empty/.ignore new file mode 100644 index 0000000..91162ec --- /dev/null +++ b/files/empty/.ignore @@ -0,0 +1 @@ +# just used for git -- cgit v1.2.3 From 02fa3009703f0817a4f2f84ba53aef617391ac1d Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 21 Jul 2008 18:51:12 +0200 Subject: fixed html location for munin --- files/config/host/munin.conf.header.CentOS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files') diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS index 314a979..da05b5a 100644 --- a/files/config/host/munin.conf.header.CentOS +++ b/files/config/host/munin.conf.header.CentOS @@ -4,7 +4,7 @@ # databases, the HTML output, and the logs, severally. They all # must be writable by the user running munin-cron. dbdir /var/lib/munin -htmldir /var/www/munin +htmldir /var/www/html/munin/ logdir /var/log/munin rundir /var/run/munin -- cgit v1.2.3 From 9579c7f3228be87d120886b1440f4eda09234bf4 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 22 Jul 2008 21:14:46 +0000 Subject: merged with immerda git-svn-id: https://svn/ipuppet/trunk/modules/munin@1915 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/config/host/logrotate.CentOS | 35 ++++++++++++++ files/config/host/munin.conf.header.CentOS | 77 ++++++++++++++++++++++++++++++ files/plugins/xen_traffic_all | 2 - 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 files/config/host/logrotate.CentOS create mode 100644 files/config/host/munin.conf.header.CentOS (limited to 'files') diff --git a/files/config/host/logrotate.CentOS b/files/config/host/logrotate.CentOS new file mode 100644 index 0000000..411de3f --- /dev/null +++ b/files/config/host/logrotate.CentOS @@ -0,0 +1,35 @@ +/var/log/munin/munin-update.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-graph.log { + daily + missingok + rotate 7 + compress + notifempty + create 660 munin apache +} + +/var/log/munin/munin-html.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-limits.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS new file mode 100644 index 0000000..dcadd6b --- /dev/null +++ b/files/config/host/munin.conf.header.CentOS @@ -0,0 +1,77 @@ +# Example configuration file for Munin, generated by 'make build' + +# The next three variables specifies where the location of the RRD +# databases, the HTML output, and the logs, severally. They all +# must be writable by the user running munin-cron. +dbdir /var/lib/munin +htmldir /var/www/html/munin/ +logdir /var/log/munin +rundir /var/run/munin + +# Where to look for the HTML templates +tmpldir /etc/munin/templates + +# Make graphs show values per minute instead of per second +#graph_period minute + +graph_strategy cgi + +# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime +# something changes (OK -> WARNING, CRITICAL -> OK, etc) +#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm +#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm +# +# For those with Nagios, the following might come in handy. In addition, +# the services must be defined in the Nagios server as well. +#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg + +contacts me +contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root +contact.me.always_send warning critical + +# a simple host tree +#[localhost] +# address 127.0.0.1 +# use_node_name yes + +# +# A more complex example of a host tree +# +## First our "normal" host. +# [fii.foo.com] +# address foo +# +## Then our other host... +# [fay.foo.com] +# address fay +# +## Then we want totals... +# [foo.com;Totals] #Force it into the "foo.com"-domain... +# update no # Turn off data-fetching for this "host". +# +# # The graph "load1". We want to see the loads of both machines... +# # "fii=fii.foo.com:load.load" means "label=machine:graph.field" +# load1.graph_title Loads side by side +# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# +# # The graph "load2". Now we want them stacked on top of each other. +# load2.graph_title Loads on top of each other +# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# load2.dummy_field.draw AREA # We want area instead the default LINE2. +# load2.dummy_field.label dummy # This is needed. Silly, really. +# +# # The graph "load3". Now we want them summarised into one field +# load3.graph_title Loads summarised +# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load +# load3.combined_loads.label Combined loads # Must be set, as this is +# # not a dummy field! +# +## ...and on a side note, I want them listen in another order (default is +## alphabetically) +# +# # Since [foo.com] would be interpreted as a host in the domain "com", we +# # specify that this is a domain by adding a semicolon. +# [foo.com;] +# node_order Totals fii.foo.com fay.foo.com +# + diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index 1e9b06e..76d4ded 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -42,8 +42,6 @@ if [ "$1" = "config" ]; then 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' -- cgit v1.2.3 From f333f2ab43ea1c4d8abae333cff1a4f3471d90e7 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 22 Jul 2008 21:14:46 +0000 Subject: merged with immerda --- files/config/host/logrotate.CentOS | 35 ++++++++++++++ files/config/host/munin.conf.header.CentOS | 77 ++++++++++++++++++++++++++++++ files/plugins/xen_traffic_all | 2 - 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 files/config/host/logrotate.CentOS create mode 100644 files/config/host/munin.conf.header.CentOS (limited to 'files') diff --git a/files/config/host/logrotate.CentOS b/files/config/host/logrotate.CentOS new file mode 100644 index 0000000..411de3f --- /dev/null +++ b/files/config/host/logrotate.CentOS @@ -0,0 +1,35 @@ +/var/log/munin/munin-update.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-graph.log { + daily + missingok + rotate 7 + compress + notifempty + create 660 munin apache +} + +/var/log/munin/munin-html.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-limits.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS new file mode 100644 index 0000000..dcadd6b --- /dev/null +++ b/files/config/host/munin.conf.header.CentOS @@ -0,0 +1,77 @@ +# Example configuration file for Munin, generated by 'make build' + +# The next three variables specifies where the location of the RRD +# databases, the HTML output, and the logs, severally. They all +# must be writable by the user running munin-cron. +dbdir /var/lib/munin +htmldir /var/www/html/munin/ +logdir /var/log/munin +rundir /var/run/munin + +# Where to look for the HTML templates +tmpldir /etc/munin/templates + +# Make graphs show values per minute instead of per second +#graph_period minute + +graph_strategy cgi + +# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime +# something changes (OK -> WARNING, CRITICAL -> OK, etc) +#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm +#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm +# +# For those with Nagios, the following might come in handy. In addition, +# the services must be defined in the Nagios server as well. +#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg + +contacts me +contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root +contact.me.always_send warning critical + +# a simple host tree +#[localhost] +# address 127.0.0.1 +# use_node_name yes + +# +# A more complex example of a host tree +# +## First our "normal" host. +# [fii.foo.com] +# address foo +# +## Then our other host... +# [fay.foo.com] +# address fay +# +## Then we want totals... +# [foo.com;Totals] #Force it into the "foo.com"-domain... +# update no # Turn off data-fetching for this "host". +# +# # The graph "load1". We want to see the loads of both machines... +# # "fii=fii.foo.com:load.load" means "label=machine:graph.field" +# load1.graph_title Loads side by side +# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# +# # The graph "load2". Now we want them stacked on top of each other. +# load2.graph_title Loads on top of each other +# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# load2.dummy_field.draw AREA # We want area instead the default LINE2. +# load2.dummy_field.label dummy # This is needed. Silly, really. +# +# # The graph "load3". Now we want them summarised into one field +# load3.graph_title Loads summarised +# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load +# load3.combined_loads.label Combined loads # Must be set, as this is +# # not a dummy field! +# +## ...and on a side note, I want them listen in another order (default is +## alphabetically) +# +# # Since [foo.com] would be interpreted as a host in the domain "com", we +# # specify that this is a domain by adding a semicolon. +# [foo.com;] +# node_order Totals fii.foo.com fay.foo.com +# + diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index 1e9b06e..76d4ded 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -42,8 +42,6 @@ if [ "$1" = "config" ]; then 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' -- cgit v1.2.3 From 9dedeb3b20ae001deebb33d282a6beb678f6fd95 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 22 Jul 2008 21:14:50 +0000 Subject: finale puzzle merge git-svn-id: https://svn/ipuppet/trunk/modules/munin@1916 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/empty/.git_placeholder | 1 - files/empty/.ignore | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 files/empty/.git_placeholder create mode 100644 files/empty/.ignore (limited to 'files') diff --git a/files/empty/.git_placeholder b/files/empty/.git_placeholder deleted file mode 100644 index 91162ec..0000000 --- a/files/empty/.git_placeholder +++ /dev/null @@ -1 +0,0 @@ -# just used for git diff --git a/files/empty/.ignore b/files/empty/.ignore new file mode 100644 index 0000000..91162ec --- /dev/null +++ b/files/empty/.ignore @@ -0,0 +1 @@ +# just used for git -- cgit v1.2.3 From 422c0e53ec096d20fe5314e1cae85b5de1f18893 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 22 Jul 2008 21:14:50 +0000 Subject: finale puzzle merge --- files/empty/.git_placeholder | 1 - files/empty/.ignore | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 files/empty/.git_placeholder create mode 100644 files/empty/.ignore (limited to 'files') diff --git a/files/empty/.git_placeholder b/files/empty/.git_placeholder deleted file mode 100644 index 91162ec..0000000 --- a/files/empty/.git_placeholder +++ /dev/null @@ -1 +0,0 @@ -# just used for git diff --git a/files/empty/.ignore b/files/empty/.ignore new file mode 100644 index 0000000..91162ec --- /dev/null +++ b/files/empty/.ignore @@ -0,0 +1 @@ +# just used for git -- cgit v1.2.3 From 17fd283a948527e37f1d76937cbeb655953d40dc Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Tue, 5 Aug 2008 17:38:46 +0200 Subject: factored postgres plugins into the postgres module --- files/plugins/pg__connections | 142 ------------------------------------------ files/plugins/pg__locks | 119 ----------------------------------- files/plugins/pg_conn | 51 --------------- 3 files changed, 312 deletions(-) delete mode 100755 files/plugins/pg__connections delete mode 100755 files/plugins/pg__locks delete mode 100755 files/plugins/pg_conn (limited to 'files') diff --git a/files/plugins/pg__connections b/files/plugins/pg__connections deleted file mode 100755 index ca95f56..0000000 --- a/files/plugins/pg__connections +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/perl -w -# Plugin for monitor postgres connections. -# -# Licenced under GPL v2. -# -# Usage: -# -# Symlink into /etc/munin/plugins/ and add the monitored -# database to the filename. e.g.: -# -# ln -s /usr/share/munin/plugins/pg__connections \ -# /etc/munin/plugins/pg__connections -# This should, however, be given through autoconf and suggest. -# -# If required, give username, password and/or Postgresql server -# host through environment variables. -# -# You must also activate Postgresql statistics. See -# http://www.postgresql.org/docs/7.4/interactive/monitoring-stats.html -# for how to enable this. Specifically, the following lines must -# exist in your postgresql.conf: -# -# stats_start_collector = true -# stats_block_level = true -# -# -# Parameters: -# -# config (required) -# -# Config variables: -# -# dbhost - Which database server to use. Defaults to -# 'localhost'. -# dbname - Which database to use. Defaults to template1 -# dbuser - A Postgresql user account with read permission to -# the given database. Defaults to -# 'postgres'. Anyway, Munin must be told which user -# this plugin should be run as. -# dbpass - The corresponding password, if -# applicable. Default to undef. Remember that -# pg_hba.conf must be configured accordingly. -# -# Magic markers -#%# family=auto -#%# capabilities=autoconf - -use strict; -use DBI; - -my $dbhost = $ENV{'dbhost'} || '127.0.0.1'; -my $dbname = $ENV{'dbname'} || 'template1'; -my $dbuser = $ENV{'dbuser'} || 'postgres'; -my $dbuserx = $ENV{'dbuserx'} || ''; -my $dbport = $ENV{'dbport'} || '5432'; -my $dbpass = $ENV{'dbpass'} || ''; - -# Check for DBD::Pg -if (! eval "require DBD::Pg;") { - print "requires DBD::Pg\n"; - exit 1; -} - -my $dsn = "DBI:Pg:dbname=$dbname;host=$dbhost;port=$dbport"; -#print "$dsn\n"; -my $dbh = DBI->connect ($dsn, $dbuser, - $dbpass, - {RaiseError =>1}) || die ""; - - - -if (exists $ARGV[0]) { - if ($ARGV[0] eq 'autoconf') { - # Check for DBD::Pg - if (! eval "require DBD::Pg;") { - print "no (DBD::Pg not found)"; - exit 1; - } - if ($dbh) { - print "yes\n"; - exit 0; - } else { - print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; - exit 1; - } - } - - if ($ARGV[0] eq "config") { - my $sql_max = "SHOW max_connections;"; - my $sth_max = $dbh->prepare($sql_max); - $sth_max->execute(); - my ($max_connections) = $sth_max->fetchrow(); - my $warning = int ($max_connections * 0.7); - my $critical = int ($max_connections * 0.8); - print "graph_title PostgresSQL active connections\n"; - print "graph_args -l 0 --base 1000\n"; - print "graph_vlabel Connections\n"; - print "graph_category Postgresql\n"; - print "graph_info Shows active Postgresql connections from $dbname\n"; - - - my $sql = "select datname, count(*) from pg_stat_activity group by datname"; - my $sth = $dbh->prepare($sql); - $sth->execute(); - my $setarea = "yes"; - while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) { - print "$datname.label $datname active connections\n"; - print "$datname.info $datname active connections\n"; - print "$datname.type GAUGE\n"; - if ($setarea eq "yes") { - print "$datname.draw AREA\n"; - $setarea=""; - } else { - print "$datname.draw STACK\n"; - } - } - - print "max_connections.label Max. connections\n"; - print "max_connections.info Max. connections\n"; - print "max_connections.type GAUGE\n"; - - print "warning $warning\n"; - print "critical $critical\n"; - exit 0; - } -} - - -# select datname, count(*) from pg_stat_activity group by datname -my $sql_max = "SHOW max_connections;"; -my $sth_max = $dbh->prepare($sql_max); -$sth_max->execute(); -my ($max_connections) = $sth_max->fetchrow(); - -#my $sql = "SELECT COUNT (*) FROM pg_stat_activity;"; -my $sql = "select datname, count(*) from pg_stat_activity group by datname"; -my $sth = $dbh->prepare($sql); -$sth->execute(); -while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) { - print "$datname.value $curr_conn\n"; -} -print "max_connections.value $max_connections\n"; diff --git a/files/plugins/pg__locks b/files/plugins/pg__locks deleted file mode 100755 index 33a9a8a..0000000 --- a/files/plugins/pg__locks +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/perl -w -# Plugin for monitor postgres connections. -# -# Licenced under GPL v2. -# -# Usage: -# -# Symlink into /etc/munin/plugins/ and add the monitored -# database to the filename. e.g.: -# -# ln -s /usr/share/munin/plugins/pg__locks \ -# /etc/munin/plugins/pg__locks -# This should, however, be given through autoconf and suggest. -# -# If required, give username, password and/or Postgresql server -# host through environment variables. -# -# You must also activate Postgresql statistics. See -# http://www.postgresql.org/docs/8.1/interactive/monitoring-locks.html -# for how to enable this. Specifically, the following lines must -# exist in your postgresql.conf: -# -# stats_start_collector = true -# stats_block_level = true -# -# -# Parameters: -# -# config (required) -# -# Config variables: -# -# dbhost - Which database server to use. Defaults to -# 'localhost'. -# dbname - Which database to use. Defaults to template1 -# dbuser - A Postgresql user account with read permission to -# the given database. Defaults to -# 'postgres'. Anyway, Munin must be told which user -# this plugin should be run as. -# dbpass - The corresponding password, if -# applicable. Default to undef. Remember that -# pg_hba.conf must be configured accordingly. -# -# Magic markers -#%# family=auto -#%# capabilities=autoconf - -use strict; -use DBI; - -my $dbhost = $ENV{'dbhost'} || '127.0.0.1'; -my $dbname = $ENV{'dbname'} || 'template1'; -my $dbuser = $ENV{'dbuser'} || 'postgres'; -my $dbport = $ENV{'dbport'} || '5432'; -my $dbpass = $ENV{'dbpass'} || ''; - -# Check for DBD::Pg -if (! eval "require DBD::Pg;") { - exit 1; -} - -my $dsn = "DBI:Pg:dbname=$dbname;host=$dbhost;port=$dbport"; -#print "$dsn\n"; -my $dbh = DBI->connect ($dsn, $dbuser, - $dbpass, - {RaiseError =>1}) || die ""; - - - -if (exists $ARGV[0]) { - if ($ARGV[0] eq 'autoconf') { - # Check for DBD::Pg - if (! eval "require DBD::Pg;") { - print "no (DBD::Pg not found)"; - exit 1; - } - if ($dbh) { - print "yes\n"; - exit 0; - } else { - print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; - exit 1; - } - } - - if ($ARGV[0] eq "config") { - print "graph_title PostgresSQL locks\n"; - print "graph_args --base 1000\n"; - print "graph_vlabel Locks\n"; - print "graph_category Postgresql\n"; - print "graph_info Shows Postgresql locks\n"; - print "locks.label Locks\n"; - print "locks.info Locks (more info here, please... :)\n"; - print "locks.type GAUGE\n"; - print "locks.warning 5\n"; - print "locks.critical 10\n"; - print "exlocks.label Exclusive locks\n"; - print "exlocks.info Exclusive locks (here too, please... :)\n"; - print "exlocks.type GAUGE\n"; - print "exlocks.warning 5\n"; - print "exlocks.critical 10\n"; - exit 0; - } -} - -my $sql="SELECT mode,COUNT(mode) FROM pg_locks GROUP BY mode ORDER BY mode;"; -my $sth = $dbh->prepare ($sql); -$sth->execute (); -my $locks = 0; -my $exlocks = 0; -while (my ($mode, $count) = $sth->fetchrow ()) { - if ($mode =~ /exclusive/i) { - $exlocks = $exlocks + $count; - } - $locks = $locks+$count; -} -print "locks.value $locks\n"; -print "exlocks.value $exlocks\n"; - diff --git a/files/plugins/pg_conn b/files/plugins/pg_conn deleted file mode 100755 index aa2ebb7..0000000 --- a/files/plugins/pg_conn +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# -# Plugin to monitor PostgreSQL connections. -# -# Parameters: -# -# config (required) -# autoconf (optional - only used by munin-config) -# Based on netstat plugin -# $Log$ -# eric@ohmforce.com -# -# -# Magic markers (optional - used by munin-config and some installation -# scripts): -#%# family=auto -#%# capabilities=autoconf - - - -if [ "$1" = "autoconf" ]; then - if ( netstat -s 2>/dev/null >/dev/null ); then - echo yes - exit 0 - else - if [ $? -eq 127 ] - then - echo "no (netstat program not found)" - exit 1 - else - echo no - exit 1 - fi - fi -fi - -if [ "$1" = "config" ]; then - - echo 'graph_title PostgreSQL' - echo 'graph_args -l 0 ' - echo 'graph_vlabel Number of PostgreSQL connections' - echo 'graph_category postgresql' - echo 'graph_period second' - echo 'graph_info This graph shows the number of opened connections on PostgreSQL.' - echo 'established.label established' - echo 'established.type GAUGE' - echo 'established.max 500' - echo 'established.info The number of currently open connections.' - exit 0 -fi -netstat -a | awk '{ print $4 }'| grep postgres | wc -l | xargs echo established.value -- cgit v1.2.3 From b4b44f82ead03b0cb26816e19e3975e8ada6b229 Mon Sep 17 00:00:00 2001 From: duritong Date: Wed, 6 Aug 2008 21:14:30 +0200 Subject: CentOS don't know yet of tls --- files/config/host/munin.conf.header.CentOS | 3 --- 1 file changed, 3 deletions(-) (limited to 'files') diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS index e252048..dcadd6b 100644 --- a/files/config/host/munin.conf.header.CentOS +++ b/files/config/host/munin.conf.header.CentOS @@ -29,9 +29,6 @@ contacts me contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root contact.me.always_send warning critical -# disable tls as we don't yet have configured it -tls disable - # a simple host tree #[localhost] # address 127.0.0.1 -- cgit v1.2.3 From 14c511f7f6791f56952bc312e5ff8cf4826bb14e Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 1 Oct 2008 19:54:20 +0000 Subject: tried to make munin-node installable and runable on openbsd --- files/openbsd/package/munin_openbsd.tar.gz | Bin 0 -> 97459 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 files/openbsd/package/munin_openbsd.tar.gz (limited to 'files') diff --git a/files/openbsd/package/munin_openbsd.tar.gz b/files/openbsd/package/munin_openbsd.tar.gz new file mode 100644 index 0000000..76ae644 Binary files /dev/null and b/files/openbsd/package/munin_openbsd.tar.gz differ -- cgit v1.2.3 From 9e11da55d499b9b01fd1776a969aeef21e6def87 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 1 Oct 2008 21:02:55 +0000 Subject: merged with puzzle --- files/plugins/pg__connections | 142 ------------------------------------------ files/plugins/pg__locks | 119 ----------------------------------- files/plugins/pg_conn | 51 --------------- 3 files changed, 312 deletions(-) delete mode 100755 files/plugins/pg__connections delete mode 100755 files/plugins/pg__locks delete mode 100755 files/plugins/pg_conn (limited to 'files') diff --git a/files/plugins/pg__connections b/files/plugins/pg__connections deleted file mode 100755 index ca95f56..0000000 --- a/files/plugins/pg__connections +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/perl -w -# Plugin for monitor postgres connections. -# -# Licenced under GPL v2. -# -# Usage: -# -# Symlink into /etc/munin/plugins/ and add the monitored -# database to the filename. e.g.: -# -# ln -s /usr/share/munin/plugins/pg__connections \ -# /etc/munin/plugins/pg__connections -# This should, however, be given through autoconf and suggest. -# -# If required, give username, password and/or Postgresql server -# host through environment variables. -# -# You must also activate Postgresql statistics. See -# http://www.postgresql.org/docs/7.4/interactive/monitoring-stats.html -# for how to enable this. Specifically, the following lines must -# exist in your postgresql.conf: -# -# stats_start_collector = true -# stats_block_level = true -# -# -# Parameters: -# -# config (required) -# -# Config variables: -# -# dbhost - Which database server to use. Defaults to -# 'localhost'. -# dbname - Which database to use. Defaults to template1 -# dbuser - A Postgresql user account with read permission to -# the given database. Defaults to -# 'postgres'. Anyway, Munin must be told which user -# this plugin should be run as. -# dbpass - The corresponding password, if -# applicable. Default to undef. Remember that -# pg_hba.conf must be configured accordingly. -# -# Magic markers -#%# family=auto -#%# capabilities=autoconf - -use strict; -use DBI; - -my $dbhost = $ENV{'dbhost'} || '127.0.0.1'; -my $dbname = $ENV{'dbname'} || 'template1'; -my $dbuser = $ENV{'dbuser'} || 'postgres'; -my $dbuserx = $ENV{'dbuserx'} || ''; -my $dbport = $ENV{'dbport'} || '5432'; -my $dbpass = $ENV{'dbpass'} || ''; - -# Check for DBD::Pg -if (! eval "require DBD::Pg;") { - print "requires DBD::Pg\n"; - exit 1; -} - -my $dsn = "DBI:Pg:dbname=$dbname;host=$dbhost;port=$dbport"; -#print "$dsn\n"; -my $dbh = DBI->connect ($dsn, $dbuser, - $dbpass, - {RaiseError =>1}) || die ""; - - - -if (exists $ARGV[0]) { - if ($ARGV[0] eq 'autoconf') { - # Check for DBD::Pg - if (! eval "require DBD::Pg;") { - print "no (DBD::Pg not found)"; - exit 1; - } - if ($dbh) { - print "yes\n"; - exit 0; - } else { - print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; - exit 1; - } - } - - if ($ARGV[0] eq "config") { - my $sql_max = "SHOW max_connections;"; - my $sth_max = $dbh->prepare($sql_max); - $sth_max->execute(); - my ($max_connections) = $sth_max->fetchrow(); - my $warning = int ($max_connections * 0.7); - my $critical = int ($max_connections * 0.8); - print "graph_title PostgresSQL active connections\n"; - print "graph_args -l 0 --base 1000\n"; - print "graph_vlabel Connections\n"; - print "graph_category Postgresql\n"; - print "graph_info Shows active Postgresql connections from $dbname\n"; - - - my $sql = "select datname, count(*) from pg_stat_activity group by datname"; - my $sth = $dbh->prepare($sql); - $sth->execute(); - my $setarea = "yes"; - while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) { - print "$datname.label $datname active connections\n"; - print "$datname.info $datname active connections\n"; - print "$datname.type GAUGE\n"; - if ($setarea eq "yes") { - print "$datname.draw AREA\n"; - $setarea=""; - } else { - print "$datname.draw STACK\n"; - } - } - - print "max_connections.label Max. connections\n"; - print "max_connections.info Max. connections\n"; - print "max_connections.type GAUGE\n"; - - print "warning $warning\n"; - print "critical $critical\n"; - exit 0; - } -} - - -# select datname, count(*) from pg_stat_activity group by datname -my $sql_max = "SHOW max_connections;"; -my $sth_max = $dbh->prepare($sql_max); -$sth_max->execute(); -my ($max_connections) = $sth_max->fetchrow(); - -#my $sql = "SELECT COUNT (*) FROM pg_stat_activity;"; -my $sql = "select datname, count(*) from pg_stat_activity group by datname"; -my $sth = $dbh->prepare($sql); -$sth->execute(); -while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) { - print "$datname.value $curr_conn\n"; -} -print "max_connections.value $max_connections\n"; diff --git a/files/plugins/pg__locks b/files/plugins/pg__locks deleted file mode 100755 index 33a9a8a..0000000 --- a/files/plugins/pg__locks +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/perl -w -# Plugin for monitor postgres connections. -# -# Licenced under GPL v2. -# -# Usage: -# -# Symlink into /etc/munin/plugins/ and add the monitored -# database to the filename. e.g.: -# -# ln -s /usr/share/munin/plugins/pg__locks \ -# /etc/munin/plugins/pg__locks -# This should, however, be given through autoconf and suggest. -# -# If required, give username, password and/or Postgresql server -# host through environment variables. -# -# You must also activate Postgresql statistics. See -# http://www.postgresql.org/docs/8.1/interactive/monitoring-locks.html -# for how to enable this. Specifically, the following lines must -# exist in your postgresql.conf: -# -# stats_start_collector = true -# stats_block_level = true -# -# -# Parameters: -# -# config (required) -# -# Config variables: -# -# dbhost - Which database server to use. Defaults to -# 'localhost'. -# dbname - Which database to use. Defaults to template1 -# dbuser - A Postgresql user account with read permission to -# the given database. Defaults to -# 'postgres'. Anyway, Munin must be told which user -# this plugin should be run as. -# dbpass - The corresponding password, if -# applicable. Default to undef. Remember that -# pg_hba.conf must be configured accordingly. -# -# Magic markers -#%# family=auto -#%# capabilities=autoconf - -use strict; -use DBI; - -my $dbhost = $ENV{'dbhost'} || '127.0.0.1'; -my $dbname = $ENV{'dbname'} || 'template1'; -my $dbuser = $ENV{'dbuser'} || 'postgres'; -my $dbport = $ENV{'dbport'} || '5432'; -my $dbpass = $ENV{'dbpass'} || ''; - -# Check for DBD::Pg -if (! eval "require DBD::Pg;") { - exit 1; -} - -my $dsn = "DBI:Pg:dbname=$dbname;host=$dbhost;port=$dbport"; -#print "$dsn\n"; -my $dbh = DBI->connect ($dsn, $dbuser, - $dbpass, - {RaiseError =>1}) || die ""; - - - -if (exists $ARGV[0]) { - if ($ARGV[0] eq 'autoconf') { - # Check for DBD::Pg - if (! eval "require DBD::Pg;") { - print "no (DBD::Pg not found)"; - exit 1; - } - if ($dbh) { - print "yes\n"; - exit 0; - } else { - print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; - exit 1; - } - } - - if ($ARGV[0] eq "config") { - print "graph_title PostgresSQL locks\n"; - print "graph_args --base 1000\n"; - print "graph_vlabel Locks\n"; - print "graph_category Postgresql\n"; - print "graph_info Shows Postgresql locks\n"; - print "locks.label Locks\n"; - print "locks.info Locks (more info here, please... :)\n"; - print "locks.type GAUGE\n"; - print "locks.warning 5\n"; - print "locks.critical 10\n"; - print "exlocks.label Exclusive locks\n"; - print "exlocks.info Exclusive locks (here too, please... :)\n"; - print "exlocks.type GAUGE\n"; - print "exlocks.warning 5\n"; - print "exlocks.critical 10\n"; - exit 0; - } -} - -my $sql="SELECT mode,COUNT(mode) FROM pg_locks GROUP BY mode ORDER BY mode;"; -my $sth = $dbh->prepare ($sql); -$sth->execute (); -my $locks = 0; -my $exlocks = 0; -while (my ($mode, $count) = $sth->fetchrow ()) { - if ($mode =~ /exclusive/i) { - $exlocks = $exlocks + $count; - } - $locks = $locks+$count; -} -print "locks.value $locks\n"; -print "exlocks.value $exlocks\n"; - diff --git a/files/plugins/pg_conn b/files/plugins/pg_conn deleted file mode 100755 index aa2ebb7..0000000 --- a/files/plugins/pg_conn +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# -# Plugin to monitor PostgreSQL connections. -# -# Parameters: -# -# config (required) -# autoconf (optional - only used by munin-config) -# Based on netstat plugin -# $Log$ -# eric@ohmforce.com -# -# -# Magic markers (optional - used by munin-config and some installation -# scripts): -#%# family=auto -#%# capabilities=autoconf - - - -if [ "$1" = "autoconf" ]; then - if ( netstat -s 2>/dev/null >/dev/null ); then - echo yes - exit 0 - else - if [ $? -eq 127 ] - then - echo "no (netstat program not found)" - exit 1 - else - echo no - exit 1 - fi - fi -fi - -if [ "$1" = "config" ]; then - - echo 'graph_title PostgreSQL' - echo 'graph_args -l 0 ' - echo 'graph_vlabel Number of PostgreSQL connections' - echo 'graph_category postgresql' - echo 'graph_period second' - echo 'graph_info This graph shows the number of opened connections on PostgreSQL.' - echo 'established.label established' - echo 'established.type GAUGE' - echo 'established.max 500' - echo 'established.info The number of currently open connections.' - exit 0 -fi -netstat -a | awk '{ print $4 }'| grep postgres | wc -l | xargs echo established.value -- cgit v1.2.3 From 59963536c57f646f1b5cc66855451632dcf39b85 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 1 Nov 2008 19:25:00 +0000 Subject: updated users plugin --- files/openbsd/package/munin_openbsd.tar.gz | Bin 97459 -> 116174 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'files') diff --git a/files/openbsd/package/munin_openbsd.tar.gz b/files/openbsd/package/munin_openbsd.tar.gz index 76ae644..17ace1d 100644 Binary files a/files/openbsd/package/munin_openbsd.tar.gz and b/files/openbsd/package/munin_openbsd.tar.gz differ -- cgit v1.2.3 From cf52fd778bbd7c30ad445c4ff4b1014796b0804e Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 5 Apr 2009 12:32:53 +0000 Subject: disabling contacting so far --- files/config/host/munin.conf.header.CentOS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'files') diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS index dcadd6b..30cf437 100644 --- a/files/config/host/munin.conf.header.CentOS +++ b/files/config/host/munin.conf.header.CentOS @@ -25,9 +25,9 @@ graph_strategy cgi # the services must be defined in the Nagios server as well. #contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg -contacts me -contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root -contact.me.always_send warning critical +#contacts me +#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root +#contact.me.always_send warning critical # a simple host tree #[localhost] -- cgit v1.2.3 From 60e94ded2bb418c532a25b9fc3a8d05aaf424b40 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 30 May 2009 20:20:54 +0200 Subject: improved enforced munin plugin --- files/plugins/selinuxenforced | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'files') diff --git a/files/plugins/selinuxenforced b/files/plugins/selinuxenforced index 16a3f66..e157e3d 100755 --- a/files/plugins/selinuxenforced +++ b/files/plugins/selinuxenforced @@ -23,5 +23,8 @@ if [ "$1" = "config" ]; then exit 0 fi -echo -n "enforced.value " && cat /selinux/enforce - +if [ -r /selinux/enforce ]; then + echo -n "enforced.value " && cat /selinux/enforce +else + echo "enforced.value 0" +fi -- cgit v1.2.3 From 2ac60fb5804ba23d61e12f3bbd5454e82ead5ac3 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 3 Oct 2009 14:46:38 +0200 Subject: add some xen munin plugins --- files/plugins/xen_mem | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ files/plugins/xen_vm | 67 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 files/plugins/xen_mem create mode 100644 files/plugins/xen_vm (limited to 'files') diff --git a/files/plugins/xen_mem b/files/plugins/xen_mem new file mode 100644 index 0000000..5e985a5 --- /dev/null +++ b/files/plugins/xen_mem @@ -0,0 +1,77 @@ +#!/bin/sh +# +# Copyright (C) 2006 Rodolphe Quiedeville +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2 dated June, +# 1991. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# +# Script to monitor affected memory by domain +# +# $Log$ +# Revision 1.0 2006/09/08 19:20:19 rodo +# Created by Rodolphe Quiedeville +# +# Need to be run as root, add the following lines ... +# +# [xen*] +# user root +# +# to /etc/munin/plugin-conf.d/munin-node +# +# +# Parameters understood: +# +# config (required) +# autoconf (optional - used by munin-config) +# +# +# Magic markers (optional - used by munin-config and installation +# scripts): +# +#%# family=auto +#%# capabilities=autoconf + +XM="/usr/sbin/xm" + +if [ "$1" = "autoconf" ]; then + echo yes + exit 0 +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title Xen affected memory' + echo 'graph_args --base 1024 --upper-limit 1024 -l 0' + echo 'graph_vlabel Memory' + echo 'graph_category xen' + echo 'graph_total Total' + echo 'graph_info This graph shows affected memory for each domain.' + echo 'Domain_0.label Domain-0' + echo 'Domain_0.draw AREA' +$XM list | grep -v 'Mem' | 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 }' + echo "$name.draw STACK" +done + + exit 0 +fi + +$XM list | grep -v 'Mem' | while read i; do + name=`echo $i | awk '{ print $1 }' | sed 's/[\/.-]/_/g'` + echo -n "$name.value " + echo $i | awk '{ print $3 * 1024 * 1024 }' +done diff --git a/files/plugins/xen_vm b/files/plugins/xen_vm new file mode 100644 index 0000000..a0dc0b7 --- /dev/null +++ b/files/plugins/xen_vm @@ -0,0 +1,67 @@ +#!/bin/sh +# +# Copyright (C) 2006 Rodolphe Quiedeville +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2 dated June, +# 1991. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# +# Monitor number of vm running on a xen dom0. +# +# $Log$ +# Revision 1.0 2006/09/08 19:20:19 rodo +# Created by Rodolphe Quiedeville +# +# Need to be run as root, add the following lines ... +# +# [xen*] +# user root +# +# to /etc/munin/plugin-conf.d/munin-node +# +# +# Parameters understood: +# +# config (required) +# autoconf (optional - used by munin-config) +# +# +# Magic markers (optional - used by munin-config and installation +# scripts): +# +#%# family=auto +#%# capabilities=autoconf + +XM="/usr/sbin/xm" + +if [ "$1" = "autoconf" ]; then + echo yes + exit 0 +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title Xen Virtual Machines' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel vm' + echo 'graph_category xen' + echo 'graph_info This graph shows how many virtual machines runs on dom0.' + echo 'domains.label vm' + exit 0 +fi + +domains=`$XM list | wc -l` + +echo -n "domains.value " +echo $(($domains-2)) -- cgit v1.2.3 From 76352415fec5c2ab6975e3a8843dd4983f7cae6a Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Wed, 9 Dec 2009 17:48:41 -0500 Subject: modify nagios plugin to work with nagios2 and nagios3 --- files/plugins/nagios_hosts | 6 +++--- files/plugins/nagios_perf_ | 4 ++-- files/plugins/nagios_svc | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'files') diff --git a/files/plugins/nagios_hosts b/files/plugins/nagios_hosts index 04fe8ed..842ef43 100755 --- a/files/plugins/nagios_hosts +++ b/files/plugins/nagios_hosts @@ -20,9 +20,9 @@ if [ "$1" = "config" ]; then fi echo -n 'up.value ' -nagios2stats --mrtg --data NUMHSTUP +nagiostats --mrtg --data NUMHSTUP echo -n 'down.value ' -nagios2stats --mrtg --data NUMHSTDOWN +nagiostats --mrtg --data NUMHSTDOWN echo -n 'unr.value ' -nagios2stats --mrtg --data NUMHSTUNR +nagiostats --mrtg --data NUMHSTUNR diff --git a/files/plugins/nagios_perf_ b/files/plugins/nagios_perf_ index f819def..4d292c7 100755 --- a/files/plugins/nagios_perf_ +++ b/files/plugins/nagios_perf_ @@ -30,6 +30,6 @@ if [ "$1" = "config" ]; then exit 0 fi -echo "act_lat_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}LAT) -echo "act_ext_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}EXT) +echo "act_lat_$TYPE_ABBR.value " $(nagiostats --mrtg --data AVGACT${TYPE_ABBR}LAT) +echo "act_ext_$TYPE_ABBR.value " $(nagiostats --mrtg --data AVGACT${TYPE_ABBR}EXT) diff --git a/files/plugins/nagios_svc b/files/plugins/nagios_svc index 3938999..86fcabf 100755 --- a/files/plugins/nagios_svc +++ b/files/plugins/nagios_svc @@ -23,11 +23,11 @@ if [ "$1" = "config" ]; then fi echo -n 'ok.value ' -nagios2stats --mrtg --data NUMSVCOK +nagiostats --mrtg --data NUMSVCOK echo -n 'warn.value ' -nagios2stats --mrtg --data NUMSVCWARN +nagiostats --mrtg --data NUMSVCWARN echo -n 'crit.value ' -nagios2stats --mrtg --data NUMSVCCRIT +nagiostats --mrtg --data NUMSVCCRIT echo -n 'unkn.value ' -nagios2stats --mrtg --data NUMSVCUNKN +nagiostats --mrtg --data NUMSVCUNKN -- cgit v1.2.3