1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Reduce plugin categories

This commit is contained in:
dipohl 2017-02-24 04:26:39 +01:00
parent d216113740
commit 349edaf819
12 changed files with 12 additions and 12 deletions

25
plugins/ftp/proftpd Executable file
View file

@ -0,0 +1,25 @@
#! /bin/sh
# configuration :
#
# env.LOGFILE /var/log/proftpd/proftpd.log
if [ "$1" = 'config' ]; then
echo "graph_args --base 1000 -l 0"
echo "graph_title Serveur FTP"
echo "graph_category network"
echo "graph_vlabel Stats Proftpd"
echo "succes.label Login succes"
echo "succes.draw AREA"
echo "failed.label Login failed"
echo "failed.draw AREA"
fi
LOGFILE=${LOGFILE:-"/var/log/proftpd/proftpd.log"}
succes=$(grep -c "successful" "$LOGFILE" )
failed=$(grep -c "Login failed" "$LOGFILE" )
echo "succes.value $succes"
echo "failed.value $failed"
exit 0

64
plugins/ftp/proftpd_bytes Executable file
View file

@ -0,0 +1,64 @@
#!/bin/bash
#
# Plugin to monitor FTP bytes.
# based on previous work by jintxo
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
MAXLABEL=20
mktempfile () {
mktemp -t $1
}
LOGFILE=${logfile:-/var/log/proftpd/xferlog}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/xferlog-bytes.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${LOGFILE}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title FTP Server Bytes'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel FTP Server Bytes'
echo 'graph_category network'
echo 'ftp_get.label Bytes GET'
echo 'ftp_put.label Bytes PUT'
exit 0
fi
ftp_get=U
ftp_put=U
TEMP_FILE=`mktempfile munin-xferlog-bytes.XXXXXX`
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
$LOGTAIL ${LOGFILE} $STATEFILE | grep "[[:space:]][oi][[:space:]]" > ${TEMP_FILE}
ftp_get=`grep "[[:space:]]o[[:space:]]" ${TEMP_FILE} | awk '{s += $8} END { if ( s ) print s ; else print "0" }'`
ftp_put=`grep "[[:space:]]i[[:space:]]" ${TEMP_FILE} | awk '{s += $8} END { if ( s ) print s ; else print "0" }'`
/bin/rm -f $TEMP_FILE
fi
echo "ftp_get.value ${ftp_get}"
echo "ftp_put.value ${ftp_put}"

64
plugins/ftp/proftpd_count Executable file
View file

@ -0,0 +1,64 @@
#!/bin/bash
#
# Plugin to monitor FTP files.
# based on previous work by jintxo
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
MAXLABEL=20
mktempfile () {
mktemp -t $1
}
LOGFILE=${logfile:-/var/log/proftpd/xferlog}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/xferlog-count.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${LOGFILE}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title FTP Server Transfers'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel FTP Server Transfers'
echo 'graph_category network'
echo 'ftp_get.label Files GET'
echo 'ftp_put.label Files PUT'
exit 0
fi
ftp_get=U
ftp_put=U
TEMP_FILE=`mktempfile munin-xferlog-count.XXXXXX`
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
$LOGTAIL ${LOGFILE} $STATEFILE | grep "[[:space:]][oi][[:space:]]" > ${TEMP_FILE}
ftp_get=`grep "[[:space:]]o[[:space:]]" ${TEMP_FILE} | wc -l`
ftp_put=`grep "[[:space:]]i[[:space:]]" ${TEMP_FILE} | wc -l`
/bin/rm -f $TEMP_FILE
fi
echo "ftp_get.value ${ftp_get}"
echo "ftp_put.value ${ftp_put}"

77
plugins/ftp/pure-ftpd Executable file
View file

@ -0,0 +1,77 @@
#!/bin/sh
#
# Plugin to monitor pure-ftpd status
#
# (c) Julien Danjou <julien@danjou.info>
#
# GPLv2 licensed
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Config variables:
#
# spooldir - Override what exim says
# exim - Where's exim?
# queuewarn - When to warn
# queuecrit - When to crit
#
# Configuration:
# Maybe need to add following lines to plugins config file
# (e.g. /etc/munin/plugin-conf.d/pure-ftpd) to run pure-ftpwho
# as user with apropirate privilegs then restart munin-node.
#
# [pure-ftpd]
# user root
#
# 2008/02/01 - TMS
# - Little Configuration documentation
# - Added monitoring IDLE connections
#
# 2007/05/07 - jd
# First release
#
# Magic markers (optional - used by installation scripts and
# munin-config):
#
#%# family=contrib
#%# capabilities=autoconf
PW=`which pure-ftpwho 2>/dev/null`
GRAPHTITLE='FTP connections'
test -n "$pw" && PW=$pw
test -n "$graphtitle" && GRAPHTITLE=$graphtitle
if [ "$1" = "autoconf" ]; then
if test -x $PW; then
echo yes
exit 0
else
echo "no (pure-ftpwho not found)"
exit 0
fi
fi
if [ "$1" = "config" ]; then
echo "graph_title $GRAPHTITLE"
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel connections'
echo 'graph_category network'
echo 'upload.label Upload'
echo 'download.label Download'
echo 'idle.label Idle'
echo 'upload.draw AREA'
echo 'download.draw STACK'
echo 'idle.draw STACK'
exit 0
fi
printf "download.value "
$PW -n -s | grep -c ' DL '
printf "upload.value "
$PW -n -s | grep -c ' UL '
printf "idle.value "
$PW -n -s | grep -c 'IDLE'

80
plugins/ftp/pure-ftpd-bw Executable file
View file

@ -0,0 +1,80 @@
#!/bin/bash
#
#
# pure-ftpd-bw plugin
# show the bandwidth used by pure-ftpd, counts the bytes sent and received
# made by Dju
# v1.2
#
# commands needed: logtail - grep
#
#
# Configuration:
# Maybe need to add following lines to plugins config file
# (e.g. /etc/munin/plugin-conf.d/pure-ftpd) to run pure-ftpwho
# as user with apropirate privilegs then restart munin-node.
#
# [pure-ftpd-bw]
# user root
#
#
# Parameters
#
# config (required)
# autoconf (optional - used by munin-config)
#
#
# Magic markers (optional - used by munin-config and installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
LOGFILE=/var/log/pure-ftpd/transfer.log
LOGTAIL=$(which logtail)
OFFSET_FILE=/var/lib/munin/plugin-state/pure-ftpd-bw.offset
if [ "$1" = "autoconf" ]; then
if [ -f $LOGFILE ]; then
if [ ! -z "$LOGTAIL" -a -f $LOGTAIL -a -x $LOGTAIL ]; then
echo yes
exit 0
else
echo "no (logtail not found)"
exit 1
fi
else
echo "no (logfile $LOGFILE does not exist)"
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Pure Ftpd Bandwidth'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Datas sent / received'
echo 'graph_category network'
echo 'dl.label Bytes downloaded'
echo 'ul.label Bytes uploaded'
exit 0
fi
TMP1=`mktemp`
if [ -f $TMP1 ]; then
$LOGTAIL -o $OFFSET_FILE -f $LOGFILE | grep 'GET \|PUT ' > $TMP1
dls=$(awk '/GET / {print $9}' $TMP1)
dl=0
for d in $dls; do dl=$(expr $dl + $d); done
echo "dl.value ${dl}"
uls=$(awk '/PUT / {print $9}' $TMP1)
ul=0
for u in $uls; do ul=$(expr $ul + $u); done
echo "ul.value ${ul}"
rm $TMP1
else
echo "cant write temp file"
exit 1
fi

83
plugins/ftp/pure-ftpd-logs Executable file
View file

@ -0,0 +1,83 @@
#!/bin/bash
#
#
# pure-ftpd plugin
# show what the users did on your ftp server
# made by Dju
#
# commands needed: logtail - grep
#
#
# Parameters
#
# config (required)
# autoconf (optional - used by munin-config)
#
#
# Magic markers (optional - used by munin-config and installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
LOGFILE=/var/log/syslog
LOGTAIL=$(which logtail)
OFFSET_FILE=/var/lib/munin/plugin-state/pure-ftpd-conns.offset
if [ "$1" = "autoconf" ]; then
if [ -f $LOGFILE ]; then
if [ ! -z "$LOGTAIL" -a -f $LOGTAIL -a -x $LOGTAIL ]; then
echo yes
exit 0
else
echo "no (logtail not found)"
exit 1
fi
else
echo "no (logfile ${LOGFILE} does not exist)"
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Pure Ftpd Logs'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Connections number'
echo 'graph_category network'
echo 'nc.label new connection'
echo 'al.label anonymous logged'
echo 'ul.label auth user logged'
echo 'af.label auth failed'
echo 'to.label timeout'
echo 'dl.label download'
echo 'upl.label upload'
exit 0
fi
TMP1=`mktemp`
$LOGTAIL -o $OFFSET_FILE $LOGFILE | grep ' pure-ftpd: ' > $TMP1
echo -en "nc.value "
grep '\[INFO\] New connection from ' $TMP1 | wc -l
echo -en "al.value "
grep '\[INFO\] Anonymous user logged in' $TMP1 | wc -l
echo -en "ul.value "
grep '\[INFO\] .*is now logged in' $TMP1 | wc -l
echo -en "to.value "
grep ' Timeout ' $TMP1 | wc -l
echo -en "af.value "
grep '\[WARNING\] Authentication failed' $TMP1 | wc -l
echo -en "dl.value "
grep '\[NOTICE\].* downloaded ' $TMP1 | wc -l
echo -en "upl.value "
grep '\[NOTICE\].* uploaded ' $TMP1 | wc -l
rm $TMP1

46
plugins/ftp/pureftpd_count Executable file
View file

@ -0,0 +1,46 @@
#!/bin/bash
#
#
# Script to show pureftp counts.
# Logs are searched in /var/log/pure-ftpd/transfer.log by default.
# Logs must be in w3c format:
# pure-ftpd --altlog w3c:/var/log/pure-ftpd/transfer.log
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
MAXLABEL=20
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title FTP Server'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Daily FTP Operations'
echo 'graph_category network'
echo 'graph_period second'
echo 'ftp_put.type GAUGE'
echo 'ftp_get.type GAUGE'
echo 'ftp_put.label Files PUT'
echo 'ftp_get.label Files GET'
exit 0
fi
echo -en "ftp_put.value "
echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]created[[:space:]] | wc -l)
echo -n
echo -en "ftp_get.value "
echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]sent[[:space:]] | wc -l)

123
plugins/ftp/pureftpd_traffic Executable file
View file

@ -0,0 +1,123 @@
#!/usr/bin/perl
use HTTP::Date;
use Date::Manip;
$logfile="/var/log/pure-ftpd/transfer.log";
$ts="/tmp/munin_pureftpd_traffic_plugin_ts";
if ($ARGV[0] eq "test") {
$handle = open LOG,"<$logfile";
if(!$handle) {
print "Can't open logfile!\n";
exit -1;
}
$handle = open TS,"<$ts";
if(!$handle) {
print "Can't open lockfile!\n";
exit -1;
}
print "OK\n";
exit 0;
}
if ($ARGV[0] eq "config") {
$out.="graph_title pureftpd traffic
graph_category network
graph_info This graph shows pureftpd traffic.
graph_vlabel Bytes
get.label Get
get.type COUNTER
get.draw LINE1
get.colour ff0000
put.label Put
put.type COUNTER
put.draw LINE1
put.colour 00ff00
mti.label MTI
mti.type COUNTER
mti.draw LINE1
mti.colour 0000ff
dsm.label DSM
dsm.type COUNTER
dsm.draw LINE1
dsm.colour 009999
";
print $out;
exit 0;
}
if (!(-e $logfile)) {
die "No transfer.log available!";
}
if (!(-e $ts)) {
open LOG, "<$logfile" or print "Can't open logfile!\n";
my $last_line;
while(<LOG>) {
$last_line = $_ if eof;
}
close LOG;
@em = split(/ /,$last_line);
$curr_ts = "$em[3] $em[4]";
$curr_ts =~ s/\[//g;
$curr_ts =~ s/\]//g;
open TS, ">$ts";
print TS $curr_ts;
close TS;
$last_ts=$curr_ts;
} else {
open TS, "<$ts";
@l=<TS>;
close TS;
$last_ts=$l[0];
}
my $get=0,
$put=0,
$mti=0,
$dsm=0;
open LOG, "<$logfile";
@log=<LOG>;
foreach $row (@log) {
@parts=split(/ /,$row);
$curr_ts = "$parts[3] $parts[4]";
$curr_ts =~ s/\[//g;
$curr_ts =~ s/\]//g;
if ( Date_Cmp($curr_ts,$last_ts) > 0 ) {
if ( $parts[5]=~ /GET/ ) {
$get+=int($parts[8]);
if ($parts[2] eq "mti") {
$mti+=int($parts[8]);
}
if ($parts[2] eq "dsm") {
$dsm+=int($parts[8]);
}
}
if ( $parts[5]=~ /PUT/ ) {
$put-=int($parts[8]);
if ($parts[2] eq "mti") {
$mti-=int($parts[8]);
}
if ($parts[2] eq "dsm") {
$dsm-=int($parts[8]);
}
}
}
}
open TS, ">$ts";
print TS $curr_ts;
close TS;
close LOG;
$out="get.value $get
put.value $put
mti.value $mti
dsm.value $dsm
";
print $out;
exit (0);
__END__

104
plugins/ftp/vsftpd Executable file
View file

@ -0,0 +1,104 @@
#!/bin/bash
logfile=${logfile:-/var/log/vsftpd.log}
if [ "$1" = "autoconf" ]; then
if [ -f "${logfile}" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
cat <<EOF
graph_title vsftpd Server
graph_args --base 1000 -l 0
graph_vlabel Requests
graph_category network
ftp_c.label connections
ftp_c.type DERIVE
ftp_c.min 0
ftp_sl.label successful_logins
ftp_sl.type DERIVE
ftp_sl.min 0
ftp_fl.label failed_logins
ftp_fl.type DERIVE
ftp_fl.min 0
ftp_su.label successful_uploads
ftp_su.type DERIVE
ftp_su.min 0
ftp_fu.label failed_uploads
ftp_fu.type DERIVE
ftp_fu.min 0
ftp_sd.label successful_downloads
ftp_sd.type DERIVE
ftp_sd.min 0
ftp_fd.label failed_downloads
ftp_fd.type DERIVE
ftp_fd.min 0
ftp_sr.label successful_renames
ftp_sr.type DERIVE
ftp_sr.min 0
ftp_fr.label failed_renames
ftp_fr.type DERIVE
ftp_fr.min 0
ftp_sde.label successful_deletes
ftp_sde.type DERIVE
ftp_sde.min 0
ftp_fde.label failed_deletes
ftp_fde.type DERIVE
ftp_fde.min 0
EOF
exit 0
fi
if [ -f "${logfile}" ]; then
awk '
BEGIN {
counts["ftp_c"] = 0;
counts["ftp_sl"] = 0;
counts["ftp_fl"] = 0;
counts["ftp_su"] = 0;
counts["ftp_fu"] = 0;
counts["ftp_sd"] = 0;
counts["ftp_fd"] = 0;
counts["ftp_sr"] = 0;
counts["ftp_fr"] = 0;
counts["ftp_sde"] = 0;
counts["ftp_fde"] = 0;
}
/CONNECT/ { counts["ftp_c"]++; next; }
/OK LOGIN/ { counts["ftp_sl"]++; next; }
/FAIL LOGIN/ { counts["ftp_fl"]++; next; }
/OK UPLOAD/ { counts["ftp_su"]++; next; }
/FAIL UPLOAD/ { counts["ftp_fu"]++; next; }
/OK DOWNLOAD/ { counts["ftp_sd"]++; next; }
/FAIL DOWNLOAD/ { counts["ftp_fd"]++; next; }
/OK RENAME/ { counts["ftp_sr"]++; next; }
/FAIL RENAME/ { counts["ftp_fr"]++; next; }
/OK DELETE/ { counts["ftp_sde"]++; next; }
/FAIL DELETE/ { counts["ftp_fde"]++; next; }
END {
for (idx in counts) {
printf "%s.value %d\n", idx, counts[idx];
}
}
' "${logfile}"
else
cat <<EOF
ftp_c.value U
ftp_sl.value U
ftp_fl.value U
ftp_su.value U
ftp_fu.value U
ftp_sd.value U
ftp_fd.value U
ftp_sr.value U
ftp_fr.value U
ftp_sde.value U
ftp_fde.value U
EOF
fi

112
plugins/ftp/vsftpd-rel Executable file
View file

@ -0,0 +1,112 @@
#! /bin/bash
# Copyright (C) 2008 Joey Schulze <joey@infodrom.org>
#
# 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, USA.
# Source: http://www.infodrom.org/Infodrom/tools/munin.html
# Supported configuration:
#
# [vsftpd-rel]
# user root
# env.logfile /var/log/vsftpd.log
# 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
install_ok()
{
tempfile=$(which tempfile)
if [ ! -r ${LOGFILE} -o \
-z "${LOGTAIL}" -o ! -x "${LOGTAIL}" -o \
-z "${tempfile}" -o ! -x "${tempfile}" ]
then
return 1
fi
return 0
}
if [ "$1" = "autoconf" ]
then
tmpfile=`which tempfile`
if install_ok
then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]
then
echo 'system.type ABSOLUTE'
echo 'graph_title Very Secure FTP Server'
echo 'graph_vlabel Requests'
echo 'graph_category network'
echo 'ftp_conn.label connections'
echo 'ftp_loginok.label successful logins'
echo 'ftp_loginfail.label failed logins'
echo 'ftp_uploadok.label successful uploads'
echo 'ftp_uploadfail.label failed uploads'
echo 'ftp_downloadok.label successful downloads'
echo 'ftp_downloadfail.label failed downloads'
echo 'ftp_deleteok.label successful deletes'
echo 'ftp_deletefail.label failed deletes'
exit 0
fi
test install_ok || exit 1
touch -d now-5minutes+30seconds $PIVOT
TEMP=`tempfile`
trap "rm -f ${PIVOT} ${TEMP}" INT EXIT
test -n "$TEMP" -a -w "$TEMP" || exit 1
if [ ! -s ${OFFSET} ]
then
$LOGTAIL ${LOGFILE} ${OFFSET} > ${TEMP}
exit 0
fi
if [ $STATE -ot $PIVOT ]
then
$LOGTAIL ${LOGFILE} ${OFFSET} > ${TEMP}
echo -n > ${STATE}
echo "ftp_conn.value $(grep 'CONNECT' ${TEMP} | wc -l)" >> $STATE
echo "ftp_loginok.value $(grep 'OK LOGIN' ${TEMP} | wc -l)" >> $STATE
echo "ftp_loginfail.value $(grep 'FAIL LOGIN' ${TEMP} | wc -l)" >> $STATE
echo "ftp_uploadok.value $(grep 'OK UPLOAD' ${TEMP} | wc -l)" >> $STATE
echo "ftp_uploadfail.value $(grep 'FAIL UPLOAD' ${TEMP} | wc -l)" >> $STATE
echo "ftp_downloadok.value $(grep 'OK DOWNLOAD' ${TEMP} | wc -l)" >> $STATE
echo "ftp_downloadfail.value $(grep 'FAIL DOWNLOAD' ${TEMP} | wc -l)" >> $STATE
echo "ftp_deleteok.value $(grep 'OK DELETE' ${TEMP} | wc -l)" >> $STATE
echo "ftp_deletefail.value $(grep 'FAIL DELETE' ${TEMP} | wc -l)" >> $STATE
fi
cat $STATE