diff --git a/plugins/other/slapd_bdb_cache_ b/plugins/other/slapd_bdb_cache_ new file mode 100755 index 00000000..f96d8d92 --- /dev/null +++ b/plugins/other/slapd_bdb_cache_ @@ -0,0 +1,140 @@ +#!/usr/bin/perl -w + +# Plugin copyright Bjorn Ruberg 20052006 +# +# Licensed under GPLv2. Be nice. +# +# Environment variables: +# +# - dbstat The full path to a db_stat binary able to +# communicate with the LDAP backend BDB +# database files. +# - dbdir The full path to the directory where +# the LDAP backend BDB database files are. +# - title (Optional) The plugin's title. Useful if you +# have more than one DIT installed. +# - warning (Optional) A threshold integer value. Triggers +# plugin to send warnings if cache percentage +# drops below the given value. +# +# Limitations: +# +# - The plugin only checks _one_ database directory. To work +# around that, i.e. if you have more than one DIT in your +# OpenLDAP, create symlinked files and corresponding entries +# in the Munin environment file(s). +# +# Magic markers +#%# family=auto +#%# capabilities=autoconf suggest + + +use strict; +use vars qw ( $measure $config $dbdir $dbstat $warning); +my $arg = shift (@ARGV); + +# Finding dbN.N_stat should be done here +$dbstat = ($ENV{'dbstat'} || "/usr/bin/db4.2_stat"); +die ("Can't execute db_stat file '$dbstat'") unless -x $dbstat; + +# Also the LDAP database files +$dbdir = ($ENV{'dbdir'} || "/var/lib/ldap"); +die ("Can't open database directory '$dbdir'") unless (-d $dbdir && -r $dbdir); + +# And the graph title +my $title = ($ENV{'title'} || ''); + +# Die if no valid file ending, unless suggest/autoconf. +if ($0 !~ /_(pages|percent)$/) { + unless ($arg && $arg =~ /^(suggest|autoconf)$/) { + die ("Plugin must be suffixed with 'percent' or 'pages'. Try running 'munin-node-configure suggest'"); + } +} + +# Check file name +if ($0 =~ /_pages$/) { + $measure = "pages"; +} elsif ($0 =~ /_percent$/) { + $measure = "percent"; +} + +# Parse command line arguments +if ($arg && $arg eq "config") { + $config = 1; +} elsif ($arg && $arg eq "autoconf") { + print "yes\n"; + exit 0; +} elsif ($arg && $arg eq "suggest") { + print "pages\n"; + print "percent\n"; + exit 0; +} + + +if ($config) { + print <