mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
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
This commit is contained in:
parent
a2b340a791
commit
4b2fcbf8b9
@ -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`}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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 = (
|
||||
|
@ -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 = (
|
||||
|
@ -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 = (
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
exit 0
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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=();
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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:
|
||||
|
@ -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 = (
|
||||
|
@ -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 = (
|
||||
|
@ -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 = (
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
# ------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user