From 4b2fcbf8b9d8f995499353e0ab4195e724209a67 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Tue, 18 Apr 2017 23:32:55 +0200 Subject: [PATCH] replace hard-coded paths (e.g. '/var/lib/munin/plugin-state') with '$MUNIN_PLUGSTATE' see http://guide.munin-monitoring.org/en/latest/plugin/env.html --- plugins/amavis/amavis-debian | 3 +-- plugins/amavis/amavis_awk | 2 +- plugins/apache/apache_byprojects/README.md | 3 +-- plugins/apache/apache_byprojects/byprojects_access | 2 +- plugins/apache/apache_byprojects/byprojects_bandwidth | 2 +- .../apache/apache_byprojects/byprojects_inout_bandwidth | 2 +- plugins/apache/apache_users | 2 +- plugins/bigbrother/b3error_ | 4 ++-- plugins/dkim/dkimproxy_mails | 2 +- plugins/ftp/proftpd_bytes | 2 +- plugins/ftp/proftpd_count | 2 +- plugins/ftp/pure-ftpd-bw | 2 +- plugins/ftp/pure-ftpd-logs | 2 +- plugins/ftp/vsftpd-rel | 7 +++---- plugins/games/game | 2 +- plugins/http/http_load_ | 2 +- plugins/jvm/jvm_sun_minorgcs | 2 +- plugins/libvirt/libvirt | 2 +- plugins/mail/procmail_ | 2 +- plugins/network/bandwidth_ | 2 +- plugins/network/dansguardian | 2 +- plugins/nginx/nginx_byprojects/README.md | 3 +-- plugins/nginx/nginx_byprojects/byprojects_access | 2 +- plugins/nginx/nginx_byprojects/byprojects_bandwidth | 2 +- plugins/nginx/nginx_byprojects/byprojects_inout_bandwidth | 2 +- plugins/nginx/nginx_vhost_traffic | 2 +- plugins/ntp/ntp_peers | 2 +- plugins/ntp/ntp_peers_ipv6 | 2 +- plugins/pdns/pdns_rel | 2 +- plugins/postfix/policyd-spf-python | 2 +- plugins/postfix/postfix_filtered | 2 +- plugins/postfix/postfix_filtered_awk | 2 +- plugins/postfix/postfix_mailfiltered | 2 +- plugins/postfix/postgrey | 2 +- plugins/postfix/postgrey-new | 2 +- plugins/power5/consumed_cpu_cycles | 3 +-- plugins/qmail/spamdyke | 2 +- plugins/router/freeboxuptime | 2 +- plugins/rsync/rsyncd_bytes | 2 +- plugins/rsync/rsyncd_count | 2 +- plugins/ssh/hostdenied | 3 +-- plugins/xen/xen | 2 +- 42 files changed, 45 insertions(+), 51 deletions(-) diff --git a/plugins/amavis/amavis-debian b/plugins/amavis/amavis-debian index 62fa352f..ef73e689 100755 --- a/plugins/amavis/amavis-debian +++ b/plugins/amavis/amavis-debian @@ -18,7 +18,6 @@ # # Config variables: # AMAVIS_LOG - file where amavis logs are written -# STATEFILE - file which is needed to keep track of AMAVIS_LOG # LOGTAIL - location of logtail # BC - location of bc # @@ -27,7 +26,7 @@ # AMAVIS_LOG=${logfile:-/var/log/mail.log} -STATEFILE=/var/lib/munin/plugin-state/amavis.offset +STATEFILE=$MUNIN_PLUGSTATE/amavis.offset LOGTAIL=${logtail:-`which logtail`} BC=${bc:-`which bc`} diff --git a/plugins/amavis/amavis_awk b/plugins/amavis/amavis_awk index 04a7a942..154a8d7c 100755 --- a/plugins/amavis/amavis_awk +++ b/plugins/amavis/amavis_awk @@ -18,7 +18,7 @@ LOGDIR=${logdir:-/var/log/amavis} MAIL_LOG=$LOGDIR/${logfile:-amavisd.log} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/amavis.offset +STATEFILE=$MUNIN_PLUGSTATE/amavis.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/apache/apache_byprojects/README.md b/plugins/apache/apache_byprojects/README.md index 45fb8218..40ff2f29 100644 --- a/plugins/apache/apache_byprojects/README.md +++ b/plugins/apache/apache_byprojects/README.md @@ -16,9 +16,8 @@ Counts the in/out bandwidth used by each projects/vhost. [Logtail] (https://www. ## Installation The setup is pretty straight forward. First you need to configure the plugin: -Define the file which will be used by logtail to identify it's position in the log and the path to logtail: +Define the path to logtail: - $statepath = '/usr/local/var/munin/plugin-state'; # directory where logtail will save the state $logtail = '/usr/local/bin/logtail'; Multiple logs can be used for the same project/vhost and a regular expression (regex) can be used as a filter: diff --git a/plugins/apache/apache_byprojects/byprojects_access b/plugins/apache/apache_byprojects/byprojects_access index 12862b9e..a6dc444b 100644 --- a/plugins/apache/apache_byprojects/byprojects_access +++ b/plugins/apache/apache_byprojects/byprojects_access @@ -26,7 +26,7 @@ use strict; my $server = 'Apache'; -my $statepath = '/usr/local/var/munin/plugin-state'; +my $statepath = $ENV{MUNIN_PLUGSTATE}; my $logtail = '/usr/local/bin/logtail'; my %logs = ( diff --git a/plugins/apache/apache_byprojects/byprojects_bandwidth b/plugins/apache/apache_byprojects/byprojects_bandwidth index 65443d6f..5f6c5372 100644 --- a/plugins/apache/apache_byprojects/byprojects_bandwidth +++ b/plugins/apache/apache_byprojects/byprojects_bandwidth @@ -31,7 +31,7 @@ use strict; my $server = 'Apache'; -my $statepath = '/usr/local/var/munin/plugin-state'; +my $statepath = $ENV{MUNIN_PLUGSTATE}; my $logtail = '/usr/local/bin/logtail'; my %logs = ( diff --git a/plugins/apache/apache_byprojects/byprojects_inout_bandwidth b/plugins/apache/apache_byprojects/byprojects_inout_bandwidth index 55e6e3ad..5722ce52 100644 --- a/plugins/apache/apache_byprojects/byprojects_inout_bandwidth +++ b/plugins/apache/apache_byprojects/byprojects_inout_bandwidth @@ -31,7 +31,7 @@ use strict; my $server = 'Apache'; -my $statepath = '/usr/local/var/munin/plugin-state'; +my $statepath = $ENV{MUNIN_PLUGSTATE}; my $logtail = '/usr/local/bin/logtail'; my %logs = ( diff --git a/plugins/apache/apache_users b/plugins/apache/apache_users index fbf30414..4193a1af 100755 --- a/plugins/apache/apache_users +++ b/plugins/apache/apache_users @@ -12,7 +12,7 @@ # ####################################################################################### CONFIG -DIRECTORY=${MUNIN_PLUGINSTATE:-/var/lib/munin/plugin-state/apache_users} +DIRECTORY=$MUNIN_PLUGSTATE/apache_users TIMESTAMP=$DIRECTORY/.apache_users ACCESSLOG=/var/log/apache2/access_log diff --git a/plugins/bigbrother/b3error_ b/plugins/bigbrother/b3error_ index b2af28f6..23741fe2 100755 --- a/plugins/bigbrother/b3error_ +++ b/plugins/bigbrother/b3error_ @@ -19,7 +19,7 @@ B3NAME=${0##*/b3error_} LOGTAIL=${logtail:-`which logtail`} #logfile from env -STATEFILE=/var/lib/munin/plugin-state/${B3NAME}.offset +STATEFILE=$MUNIN_PLUGSTATE/${B3NAME}.offset mktempfile () { mktemp -t $1 @@ -92,4 +92,4 @@ echo "eventqueue.value ${eventqueue}" echo "parseline.value ${parseline}" echo "other.value ${other}" -exit 0 \ No newline at end of file +exit 0 diff --git a/plugins/dkim/dkimproxy_mails b/plugins/dkim/dkimproxy_mails index e1f2a5b1..8fe7cfe6 100755 --- a/plugins/dkim/dkimproxy_mails +++ b/plugins/dkim/dkimproxy_mails @@ -32,7 +32,7 @@ mktemp -t MAIL_LOG=${logfile:-/var/log/mail.log} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/dkimproxy_mails.offset +STATEFILE=$MUNIN_PLUGSTATE/dkimproxy_mails.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/ftp/proftpd_bytes b/plugins/ftp/proftpd_bytes index 0e538e08..b34f38f7 100755 --- a/plugins/ftp/proftpd_bytes +++ b/plugins/ftp/proftpd_bytes @@ -22,7 +22,7 @@ mktemp -t $1 LOGFILE=${logfile:-/var/log/proftpd/xferlog} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/xferlog-bytes.offset +STATEFILE=$MUNIN_PLUGSTATE/xferlog-bytes.offset if [ "$1" = "autoconf" ]; then if [ -f "${LOGFILE}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/ftp/proftpd_count b/plugins/ftp/proftpd_count index 7409f418..13f50eec 100755 --- a/plugins/ftp/proftpd_count +++ b/plugins/ftp/proftpd_count @@ -22,7 +22,7 @@ mktemp -t $1 LOGFILE=${logfile:-/var/log/proftpd/xferlog} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/xferlog-count.offset +STATEFILE=$MUNIN_PLUGSTATE/xferlog-count.offset if [ "$1" = "autoconf" ]; then if [ -f "${LOGFILE}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/ftp/pure-ftpd-bw b/plugins/ftp/pure-ftpd-bw index 4e2fcf8a..aa9112d2 100755 --- a/plugins/ftp/pure-ftpd-bw +++ b/plugins/ftp/pure-ftpd-bw @@ -32,7 +32,7 @@ LOGFILE=/var/log/pure-ftpd/transfer.log LOGTAIL=$(which logtail) -OFFSET_FILE=/var/lib/munin/plugin-state/pure-ftpd-bw.offset +OFFSET_FILE=$MUNIN_PLUGSTATE/pure-ftpd-bw.offset if [ "$1" = "autoconf" ]; then diff --git a/plugins/ftp/pure-ftpd-logs b/plugins/ftp/pure-ftpd-logs index 8fc5fb7e..2a0add13 100755 --- a/plugins/ftp/pure-ftpd-logs +++ b/plugins/ftp/pure-ftpd-logs @@ -22,7 +22,7 @@ LOGFILE=/var/log/syslog LOGTAIL=$(which logtail) -OFFSET_FILE=/var/lib/munin/plugin-state/pure-ftpd-conns.offset +OFFSET_FILE=$MUNIN_PLUGSTATE/pure-ftpd-conns.offset if [ "$1" = "autoconf" ]; then diff --git a/plugins/ftp/vsftpd-rel b/plugins/ftp/vsftpd-rel index 4d80d302..25ee99de 100755 --- a/plugins/ftp/vsftpd-rel +++ b/plugins/ftp/vsftpd-rel @@ -25,14 +25,13 @@ # env.logtail /usr/bin/logtail PROGNAME=vsftpd -STATEDIR=/var/lib/munin/plugin-state LOGFILE=${logfile:-/var/log/vsftpd.log} LOGTAIL=${logtail:-`which logtail`} -OFFSET=${STATEDIR}/${PROGNAME}.offset -STATE=${STATEDIR}/${PROGNAME}.state -PIVOT=${STATEDIR}/${PROGNAME}.pivot +OFFSET=${MUNIN_PLUGSTATE}/${PROGNAME}.offset +STATE=${MUNIN_PLUGSTATE}/${PROGNAME}.state +PIVOT=${MUNIN_PLUGSTATE}/${PROGNAME}.pivot install_ok() diff --git a/plugins/games/game b/plugins/games/game index 6f8a1a20..9cb182ad 100644 --- a/plugins/games/game +++ b/plugins/games/game @@ -30,7 +30,7 @@ $var = getenv('game_config_file'); $config = ($var) ? $var : "/etc/munin/munin-game.ini"; $var = getenv('game_state_file'); -$state = ($var) ? $var : "/var/lib/munin/plugin-state/game"; +$state = ($var) ? $var : (getenv('MUNIN_PLUGSTATE') . "/game"); function p($str) { // Quick function to print a string with an EOL on the end diff --git a/plugins/http/http_load_ b/plugins/http/http_load_ index fee63ae5..b7153887 100755 --- a/plugins/http/http_load_ +++ b/plugins/http/http_load_ @@ -87,7 +87,7 @@ use HTML::LinkExtor; use LWP::ConnCache; my $url_file="/etc/munin/http_load_urls.txt"; -my $cachedir="/var/lib/munin/plugin-state"; +my $cachedir=$ENV{MUNIN_PLUGSTATE}; my $debug=0; my $timeout=10; diff --git a/plugins/jvm/jvm_sun_minorgcs b/plugins/jvm/jvm_sun_minorgcs index 50b43aad..caa99a9a 100755 --- a/plugins/jvm/jvm_sun_minorgcs +++ b/plugins/jvm/jvm_sun_minorgcs @@ -39,7 +39,7 @@ my $logfile = $ENV{logfile} || "/var/log/app/jvm/gc.log"; my $grtitle = $ENV{graphtitle} || 'Sun Java'; my $grname = $ENV{graphtitle} || 'sun-jvm'; -my $statefile = "/var/lib/munin/plugin-state/plugin-java_sun_${grname}_minorgcs.state"; +my $statefile = "$ENV{MUNIN_PLUGSTATE}/plugin-java_sun_${grname}_minorgcs.state"; my $pos = 0; my $count = 0; my $seconds = 0; diff --git a/plugins/libvirt/libvirt b/plugins/libvirt/libvirt index 62ada22d..4b2bdcfd 100755 --- a/plugins/libvirt/libvirt +++ b/plugins/libvirt/libvirt @@ -70,7 +70,7 @@ use Time::localtime; my $address = $ENV{address} || "xen:///"; my $username = $ENV{username} || ""; my $password = $ENV{password} || ""; -my $tmpfile = $ENV{tmpfile} || "/var/lib/munin/plugin-state/libvirt"; +my $tmpfile = $ENV{tmpfile} || "$ENV{MUNIN_PLUGSTATE}/libvirt"; my $decimals=5; my %show=(); diff --git a/plugins/mail/procmail_ b/plugins/mail/procmail_ index a3af669d..1838c0b3 100755 --- a/plugins/mail/procmail_ +++ b/plugins/mail/procmail_ @@ -6,7 +6,7 @@ use YAML; my (%conf, $state, $have_read, $totlines); %conf = (logfile => $ENV{LOGFILE} || '/home/user/.procmail/log', - state => $ENV{STATEFILE} || '/var/lib/munin/plugin-state/munin-plugin-procmail.state'); + state => $ENV{STATEFILE} || "$ENV{MUNIN_PLUGSTATE}/munin-plugin-procmail.state"); $state = YAML::LoadFile($conf{state}); $have_read = 0; diff --git a/plugins/network/bandwidth_ b/plugins/network/bandwidth_ index a66d61f8..09b3410c 100755 --- a/plugins/network/bandwidth_ +++ b/plugins/network/bandwidth_ @@ -88,7 +88,7 @@ init(); sub autoconf { $0 =~ /bandwidth_(.+)*$/; $interface = $1; - $history = "/var/lib/munin/plugin-state/bandwidth_$interface.state"; + $history = "$ENV{MUNIN_PLUGSTATE}/bandwidth_$interface.state"; } sub bit32or64 { diff --git a/plugins/network/dansguardian b/plugins/network/dansguardian index 536d5473..e926a8e6 100755 --- a/plugins/network/dansguardian +++ b/plugins/network/dansguardian @@ -17,7 +17,7 @@ use strict; my $QUERYLOG = $ENV{logfile} || '/var/log/dansguardian/access.log'; my $STATEFILE = $ENV{statefile} - || '/var/lib/munin/plugin-state/dansguardian.state'; + || "$ENV{MUNIN_PLUGSTATE}/dansguardian.state"; my %IN; sub get_state { diff --git a/plugins/nginx/nginx_byprojects/README.md b/plugins/nginx/nginx_byprojects/README.md index 6dbb4840..d2b59505 100644 --- a/plugins/nginx/nginx_byprojects/README.md +++ b/plugins/nginx/nginx_byprojects/README.md @@ -16,9 +16,8 @@ Counts the in/out bandwidth used by each projects/vhost. [Logtail] (https://www. ## Installation The setup is pretty straight forward. First you need to configure the plugin: -Define the file which will be used by logtail to identify it's position in the log and the path to logtail: +Define the path to logtail: - $statepath = '/usr/local/var/munin/plugin-state'; # directory where logtail will save the state $logtail = '/usr/local/bin/logtail'; Multiple logs can be used for the same project/vhost and a regular expression (regex) can be used as a filter: diff --git a/plugins/nginx/nginx_byprojects/byprojects_access b/plugins/nginx/nginx_byprojects/byprojects_access index 15bb78a7..81d755dd 100644 --- a/plugins/nginx/nginx_byprojects/byprojects_access +++ b/plugins/nginx/nginx_byprojects/byprojects_access @@ -26,7 +26,7 @@ use strict; my $server = 'Nginx'; -my $statepath = '/usr/local/var/munin/plugin-state'; +my $statepath = $ENV{MUNIN_PLUGSTATE}; my $logtail = '/usr/local/bin/logtail'; my %logs = ( diff --git a/plugins/nginx/nginx_byprojects/byprojects_bandwidth b/plugins/nginx/nginx_byprojects/byprojects_bandwidth index 87643860..1ccce21a 100644 --- a/plugins/nginx/nginx_byprojects/byprojects_bandwidth +++ b/plugins/nginx/nginx_byprojects/byprojects_bandwidth @@ -32,7 +32,7 @@ use strict; my $server = 'Nginx'; -my $statepath = '/usr/local/var/munin/plugin-state'; +my $statepath = $ENV{MUNIN_PLUGSTATE}; my $logtail = '/usr/local/bin/logtail'; my %logs = ( diff --git a/plugins/nginx/nginx_byprojects/byprojects_inout_bandwidth b/plugins/nginx/nginx_byprojects/byprojects_inout_bandwidth index 8b2eadc9..8f02826b 100644 --- a/plugins/nginx/nginx_byprojects/byprojects_inout_bandwidth +++ b/plugins/nginx/nginx_byprojects/byprojects_inout_bandwidth @@ -32,7 +32,7 @@ use strict; my $server = 'Nginx'; -my $statepath = '/usr/local/var/munin/plugin-state'; +my $statepath = $ENV{MUNIN_PLUGSTATE}; my $logtail = '/usr/local/bin/logtail'; my %logs = ( diff --git a/plugins/nginx/nginx_vhost_traffic b/plugins/nginx/nginx_vhost_traffic index 95e500a3..a467d575 100755 --- a/plugins/nginx/nginx_vhost_traffic +++ b/plugins/nginx/nginx_vhost_traffic @@ -33,7 +33,7 @@ LOGDIR=${logdir:-/var/log/nginx} ACCESS_LOG=$LOGDIR/${logfile:-access.log} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/nginx_vhost_traffic.state +STATEFILE=$MUNIN_PLUGSTATE/nginx_vhost_traffic.state VHOSTS=${vhosts:-`hostname`} AGGREGATE=${aggregate:true} diff --git a/plugins/ntp/ntp_peers b/plugins/ntp/ntp_peers index 0350cf75..174a0c26 100755 --- a/plugins/ntp/ntp_peers +++ b/plugins/ntp/ntp_peers @@ -60,7 +60,7 @@ use Socket; my $NTPQ = $ENV{ntpq} || "ntpq"; my $COMMAND = "$NTPQ -np"; -my $statedir = $ENV{statedir} || '/var/lib/munin/plugin-state'; +my $statedir = $ENV{statedir} || $ENV{MUNIN_PLUGSTATE}; my $statefile = "$statedir/ntp_peers.state"; # autoconf diff --git a/plugins/ntp/ntp_peers_ipv6 b/plugins/ntp/ntp_peers_ipv6 index 803a8fc6..d98701e0 100755 --- a/plugins/ntp/ntp_peers_ipv6 +++ b/plugins/ntp/ntp_peers_ipv6 @@ -46,7 +46,7 @@ use strict; my $NTPQ = $ENV{ntpq} || "ntpq"; my $COMMAND = "$NTPQ -nc associations"; -my $statedir = $ENV{statedir} || '/usr/local/var/munin/plugin-state'; +my $statedir = $ENV{statedir} || $ENV{MUNIN_PLUGSTATE}; my $statefile = "$statedir/ntp_peers.state"; # autoconf diff --git a/plugins/pdns/pdns_rel b/plugins/pdns/pdns_rel index 15d8086f..eb660507 100755 --- a/plugins/pdns/pdns_rel +++ b/plugins/pdns/pdns_rel @@ -10,7 +10,7 @@ #%# capabilities=autoconf command="/etc/init.d/pdns show" -state_file=/var/lib/munin/plugin-state/pdns_rel.state +state_file=$MUNIN_PLUGSTATE/pdns_rel.state if [ "$1" = "autoconf" ]; then echo yes diff --git a/plugins/postfix/policyd-spf-python b/plugins/postfix/policyd-spf-python index bf13bd05..93c53b5e 100755 --- a/plugins/postfix/policyd-spf-python +++ b/plugins/postfix/policyd-spf-python @@ -25,7 +25,7 @@ # Configuration # -STAT_FILE=${STAT_FILE:-/var/lib/munin/plugin-state/plugin-plcyd-spf-python.state} +STAT_FILE=${STAT_FILE:-$MUNIN_PLUGSTATE/plugin-plcyd-spf-python.state} LOGFILE=${logfile:-/var/log/mail.log} if [ "$1" = "autoconf" ]; then diff --git a/plugins/postfix/postfix_filtered b/plugins/postfix/postfix_filtered index 1ae69fef..8cb70370 100755 --- a/plugins/postfix/postfix_filtered +++ b/plugins/postfix/postfix_filtered @@ -39,7 +39,7 @@ fi LOGDIR=${logdir:-/var/log/mail} MAIL_LOG=$LOGDIR/${logfile:-info} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/postfix_mailfiltered.offset +STATEFILE=$MUNIN_PLUGSTATE/postfix_mailfiltered.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/postfix/postfix_filtered_awk b/plugins/postfix/postfix_filtered_awk index c83c1c36..fde5dbc0 100755 --- a/plugins/postfix/postfix_filtered_awk +++ b/plugins/postfix/postfix_filtered_awk @@ -35,7 +35,7 @@ export POLICY LOGDIR=${logdir:-/var/log/mail} MAIL_LOG=$LOGDIR/${logfile:-info} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/postfix_mailfiltered_test.offset +STATEFILE=$MUNIN_PLUGSTATE/postfix_mailfiltered_test.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/postfix/postfix_mailfiltered b/plugins/postfix/postfix_mailfiltered index d11712b7..f96687df 100755 --- a/plugins/postfix/postfix_mailfiltered +++ b/plugins/postfix/postfix_mailfiltered @@ -15,7 +15,7 @@ mktemp -t MAIL_LOG=${logfile:-/var/log/mail.log} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/postfix_mailfiltered.offset +STATEFILE=$MUNIN_PLUGSTATE/postfix_mailfiltered.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/postfix/postgrey b/plugins/postfix/postgrey index 1c9f1eb9..e5c9ebc6 100755 --- a/plugins/postfix/postgrey +++ b/plugins/postfix/postgrey @@ -14,7 +14,7 @@ mktemp -t } MAIL_LOG=${logfile:-/var/log/mail.log} -STATEFILE=/var/lib/munin/plugin-state/postgrey.offset +STATEFILE=$MUNIN_PLUGSTATE/postgrey.offset LOGTAIL=${logtail:-`which logtail`} if [ "$1" = "autoconf" ]; then diff --git a/plugins/postfix/postgrey-new b/plugins/postfix/postgrey-new index 73912086..3a8944a1 100755 --- a/plugins/postfix/postgrey-new +++ b/plugins/postfix/postgrey-new @@ -29,7 +29,7 @@ use strict; use warnings; my $maillog= $ENV{'logfile'} || "/var/log/mail.log"; -my $statefile= $ENV{'statefile'} || "/var/lib/munin/plugin-state/postgrey-new.state"; +my $statefile= $ENV{'statefile'} || "$ENV{MUNIN_PLUGSTATE}/postgrey-new.state"; my $greylisted=0; my $greylisted_old=0; diff --git a/plugins/power5/consumed_cpu_cycles b/plugins/power5/consumed_cpu_cycles index 4f256661..950c31a6 100755 --- a/plugins/power5/consumed_cpu_cycles +++ b/plugins/power5/consumed_cpu_cycles @@ -29,8 +29,7 @@ LPARCFG=/proc/ppc64/lparcfg -# STATEFILE=/var/lib/munin/plugin-state/power5-consumed_cpu_cycles.state -STATEFILE=/tmp/power5-consumed_cpu_cycles.state +STATEFILE=$MUNIN_PLUGSTATE/power5-consumed_cpu_cycles.state # check input parameters if [ "$1" = "autoconf" ]; then echo yes diff --git a/plugins/qmail/spamdyke b/plugins/qmail/spamdyke index fd2dbb34..619ebd24 100755 --- a/plugins/qmail/spamdyke +++ b/plugins/qmail/spamdyke @@ -29,7 +29,7 @@ mktemp -t MAIL_LOG=${logfile:-/var/log/mail.info} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/spamdyke.offset +STATEFILE=$MUNIN_PLUGSTATE/spamdyke.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/router/freeboxuptime b/plugins/router/freeboxuptime index 35062672..c7dcb654 100755 --- a/plugins/router/freeboxuptime +++ b/plugins/router/freeboxuptime @@ -49,7 +49,7 @@ #%# family=manual #%# capabilities=autoconf -CACHE_FILE=/var/lib/munin/plugin-state/FreeboxUptime.cache +CACHE_FILE=$MUNIN_PLUGSTATE/FreeboxUptime.cache CACHE_HOURS=3 NMAP=$(which nmap) TCP_PORT=9100 diff --git a/plugins/rsync/rsyncd_bytes b/plugins/rsync/rsyncd_bytes index 947b365d..d290282b 100755 --- a/plugins/rsync/rsyncd_bytes +++ b/plugins/rsync/rsyncd_bytes @@ -16,7 +16,7 @@ mktemp -t $1 RSYNCD_LOG=${logfile:-/var/log/rsyncd.log} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/rsync-bytes.offset +STATEFILE=$MUNIN_PLUGSTATE/rsync-bytes.offset if [ "$1" = "autoconf" ]; then if [ -f "${RSYNCD_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/rsync/rsyncd_count b/plugins/rsync/rsyncd_count index e06de136..9b3a8afd 100755 --- a/plugins/rsync/rsyncd_count +++ b/plugins/rsync/rsyncd_count @@ -16,7 +16,7 @@ mktemp -t $1 RSYNCD_LOG=${logfile:-/var/log/rsyncd.log} LOGTAIL=${logtail:-`which logtail`} -STATEFILE=/var/lib/munin/plugin-state/rsync-count.offset +STATEFILE=$MUNIN_PLUGSTATE/rsync-count.offset if [ "$1" = "autoconf" ]; then if [ -f "${RSYNCD_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then diff --git a/plugins/ssh/hostdenied b/plugins/ssh/hostdenied index 93140355..9996f2d6 100755 --- a/plugins/ssh/hostdenied +++ b/plugins/ssh/hostdenied @@ -44,9 +44,8 @@ # ------------------------------------------------------------------------------------------------------ DENY="/etc/hosts.deny" -STATEDIR="/var/lib/munin/plugin-state" # directory where plugin can keep their working files NAME="$(basename $0)" # component of naming temporary files -STATEFILE="$STATEDIR/$NAME.state" +STATEFILE="$MUNIN_PLUGSTATE/$NAME.state" COLOUR=(FF0000 DA0024 B60048 91006D 6D0091 4800B6 2400DA 0000FF) # hot to cold colours # ------------------------------------------------------------------------------------------------------ diff --git a/plugins/xen/xen b/plugins/xen/xen index 32d702c1..b44f2692 100755 --- a/plugins/xen/xen +++ b/plugins/xen/xen @@ -15,7 +15,7 @@ #%# capabilities=autoconf # statefile: name of seen xen domains -statefile="/var/lib/munin/plugin-state/munin-plugin-xen.state" +statefile="$MUNIN_PLUGSTATE/munin-plugin-xen.state" if [ "$1" = "autoconf" ]; then if which xm > /dev/null ; then