Révision c4b2d9a8
Category Tree: reduce number of categories
| plugins/2wire/2wire | ||
|---|---|---|
| 208 | 208 |
graph_title 2wire DSL bandwidth usage (daily) |
| 209 | 209 |
graph_args --base 1024 -l 0 -M |
| 210 | 210 |
graph_vlabel Bytes |
| 211 |
graph_category 2wire
|
|
| 211 |
graph_category network
|
|
| 212 | 212 |
|
| 213 | 213 |
down.label Down |
| 214 | 214 |
up.label Up |
| plugins/asterisk/asterisk | ||
|---|---|---|
| 156 | 156 |
graph_title Asterisk active channels |
| 157 | 157 |
graph_args --base 1000 -l 0 |
| 158 | 158 |
graph_vlabel channels |
| 159 |
graph_category asterisk
|
|
| 159 |
graph_category voip
|
|
| 160 | 160 |
total.label channels |
| 161 | 161 |
END |
| 162 | 162 |
|
| ... | ... | |
| 173 | 173 |
graph_title Asterisk voicemail messages |
| 174 | 174 |
graph_args --base 1000 -l 0 |
| 175 | 175 |
graph_vlabel messages |
| 176 |
graph_category asterisk
|
|
| 176 |
graph_category voip
|
|
| 177 | 177 |
total.label Total messages |
| 178 | 178 |
END |
| 179 | 179 |
|
| ... | ... | |
| 182 | 182 |
multigraph asterisk_meetme |
| 183 | 183 |
graph_title Asterisk meetme statistics |
| 184 | 184 |
graph_args --base 1000 -l 0 |
| 185 |
graph_category asterisk
|
|
| 185 |
graph_category voip
|
|
| 186 | 186 |
users.label Connected users |
| 187 | 187 |
conferences.label Active conferences |
| 188 | 188 |
END |
| ... | ... | |
| 193 | 193 |
graphs_title Asterisk channels per codec |
| 194 | 194 |
graph_args --base 1000 -l 0 |
| 195 | 195 |
graph_vlabel channels |
| 196 |
graph_category asterisk
|
|
| 196 |
graph_category voip
|
|
| 197 | 197 |
END |
| 198 | 198 |
|
| 199 | 199 |
foreach my $codec (@CODECS) {
|
| plugins/asterisk/asterisk_channels | ||
|---|---|---|
| 22 | 22 |
echo "graph_title Asterisk Channels" |
| 23 | 23 |
echo "graph_args --base 1000 -l 0" |
| 24 | 24 |
echo "graph_vlabel Channels" |
| 25 |
echo "graph_category asterisk"
|
|
| 25 |
echo "graph_category voip"
|
|
| 26 | 26 |
echo "channels.label Channels" |
| 27 | 27 |
exit 0 |
| 28 | 28 |
fi |
| plugins/asterisk/asterisk_inuse | ||
|---|---|---|
| 28 | 28 |
echo 'graph_vlabel line use and connected users states' |
| 29 | 29 |
echo 'graph_noscale true' |
| 30 | 30 |
echo 'graph_info will be info' |
| 31 |
echo 'graph_category asterisk'
|
|
| 31 |
echo 'graph_category voip'
|
|
| 32 | 32 |
echo 'inuse.label inuse' |
| 33 | 33 |
echo 'inuse.type GAUGE' |
| 34 | 34 |
echo 'inuse.info sip show inuse' |
| plugins/bitcoin/bitcoind_ | ||
|---|---|---|
| 70 | 70 |
return |
| 71 | 71 |
|
| 72 | 72 |
if command == 'config': |
| 73 |
print 'graph_category bitcoin'
|
|
| 73 |
print 'graph_category htc'
|
|
| 74 | 74 |
print 'graph_title Bitcoin %s' % labels[0] |
| 75 | 75 |
print 'graph_vlabel %s' % labels[1] |
| 76 | 76 |
for label in line_labels: |
| plugins/dovecot/dovecot | ||
|---|---|---|
| 1 |
#!/usr/bin/perl |
|
| 2 |
|
|
| 1 |
#! /bin/bash |
|
| 2 |
# |
|
| 3 |
# Munin Plugin |
|
| 4 |
# to count logins to your dovecot mailserver |
|
| 5 |
# |
|
| 6 |
# Created by Dominik Schulz <lkml@ds.gauner.org> |
|
| 7 |
# http://developer.gauner.org/munin/ |
|
| 8 |
# Contributions by: |
|
| 9 |
# - Stephane Enten <tuf@delyth.net> |
|
| 10 |
# - Steve Schnepp <steve.schnepp@pwkf.org> |
|
| 11 |
# |
|
| 12 |
# Parameters understood: |
|
| 13 |
# |
|
| 14 |
# config (required) |
|
| 15 |
# autoconf (optional - used by munin-config) |
|
| 16 |
# |
|
| 17 |
# Config variables: |
|
| 18 |
# |
|
| 19 |
# logfile - Where to find the syslog file |
|
| 20 |
# |
|
| 21 |
# Add the following line to a file in /etc/munin/plugin-conf.d: |
|
| 22 |
# env.logfile /var/log/your/logfile.log |
|
| 23 |
# |
|
| 24 |
# Magic markers (optional - used by munin-config and installation scripts): |
|
| 25 |
# |
|
| 3 | 26 |
#%# family=auto |
| 4 | 27 |
#%# capabilities=autoconf |
| 5 | 28 |
|
| 6 |
use Munin::Plugin; |
|
| 7 |
|
|
| 8 |
$pos = undef; |
|
| 9 |
$connected = 0; |
|
| 10 |
$connectedimap = 0; |
|
| 11 |
$connectedpop3 = 0; |
|
| 12 |
$connections = 0; |
|
| 13 |
$connectionsimap = 0; |
|
| 14 |
$connectionspop3 = 0; |
|
| 15 |
$login = 0; |
|
| 16 |
$pop3login = 0; |
|
| 17 |
$imaplogin = 0; |
|
| 18 |
$tls = 0; |
|
| 19 |
$ssl = 0; |
|
| 20 |
$aborted = 0; |
|
| 21 |
|
|
| 22 |
($dirname = $0) =~ s/[^\/]+$//; |
|
| 23 |
|
|
| 24 |
$dovelogfile = 0 ; |
|
| 25 |
|
|
| 26 |
$logfile = $ENV{'LOGFILE'} || '/var/log/mail.log';
|
|
| 27 |
|
|
| 28 |
if ( $logfile =~ /dovecot/ ) {
|
|
| 29 |
$dovelogfile = 1 ; |
|
| 30 |
} |
|
| 31 |
|
|
| 32 |
# Use an overrided $PATH for all external programs if needed |
|
| 33 |
$DOVEADM = "doveadm"; |
|
| 34 |
|
|
| 35 |
if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) {
|
|
| 36 |
|
|
| 37 |
if (! -x $DOVEADM) {
|
|
| 38 |
print "no (no doveadm)\n"; |
|
| 39 |
exit(1); |
|
| 40 |
} |
|
| 41 |
|
|
| 42 |
if (! -f $logfile) {
|
|
| 43 |
print "no (logfile $logfile does not exist)\n"; |
|
| 44 |
exit(1); |
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
if (-r "$logfile") {
|
|
| 48 |
print "yes\n"; |
|
| 49 |
exit 0; |
|
| 50 |
} else {
|
|
| 51 |
print "no (logfile not readable)\n"; |
|
| 52 |
} |
|
| 53 |
exit 1; |
|
| 54 |
} |
|
| 55 |
|
|
| 56 |
if (-f "$logfile.0") {
|
|
| 57 |
$rotlogfile = $logfile . ".0"; |
|
| 58 |
} elsif (-f "$logfile.1") {
|
|
| 59 |
$rotlogfile = $logfile . ".1"; |
|
| 60 |
} elsif (-f "$logfile.01") {
|
|
| 61 |
$rotlogfile = $logfile . ".01"; |
|
| 62 |
} else {
|
|
| 63 |
$rotlogfile = $logfile . ".0"; |
|
| 64 |
} |
|
| 65 |
|
|
| 66 |
if ( $ARGV[0] and $ARGV[0] eq "config" ) {
|
|
| 67 |
print "multigraph dovecot_connections\n"; |
|
| 68 |
print "graph_title Dovecot connections\n"; |
|
| 69 |
print "graph_args --base 1000 -l 0 --no-gridfit --slope-mode\n"; |
|
| 70 |
print "graph_vlabel connections\n"; |
|
| 71 |
print "graph_category mail\n"; |
|
| 72 |
print "connections.label Connections open\n"; |
|
| 73 |
print "connections.type GAUGE\n"; |
|
| 74 |
print "connections.draw LINE1\n"; |
|
| 75 |
print "connections.min 0\n"; |
|
| 76 |
print "connectionsimap.label IMAP\n"; |
|
| 77 |
print "connectionsimap.type GAUGE\n"; |
|
| 78 |
print "connectionsimap.draw AREA\n"; |
|
| 79 |
print "connectionsimap.min 0\n"; |
|
| 80 |
print "connectionspop3.label POP3\n"; |
|
| 81 |
print "connectionspop3.type GAUGE\n"; |
|
| 82 |
print "connectionspop3.draw STACK\n"; |
|
| 83 |
print "connectionspop3.min 0\n"; |
|
| 84 |
|
|
| 85 |
print "multigraph dovecot_connected\n"; |
|
| 86 |
print "graph_title Dovecot connected users\n"; |
|
| 87 |
print "graph_args --base 1000 -l 0 --no-gridfit --slope-mode\n"; |
|
| 88 |
print "graph_vlabel connections\n"; |
|
| 89 |
print "graph_category mail\n"; |
|
| 90 |
print "connected.label Connected users\n"; |
|
| 91 |
print "connected.type GAUGE\n"; |
|
| 92 |
print "connected.draw LINE1\n"; |
|
| 93 |
print "connected.min 0\n"; |
|
| 94 |
print "connectedimap.label IMAP\n"; |
|
| 95 |
print "connectedimap.type GAUGE\n"; |
|
| 96 |
print "connectedimap.draw AREA\n"; |
|
| 97 |
print "connectedimap.min 0\n"; |
|
| 98 |
print "connectedpop3.label POP3\n"; |
|
| 99 |
print "connectedpop3.type GAUGE\n"; |
|
| 100 |
print "connectedpop3.draw STACK\n"; |
|
| 101 |
print "connectedpop3.min 0\n"; |
|
| 102 |
|
|
| 103 |
print "multigraph dovecot_logins\n"; |
|
| 104 |
print "graph_title Dovecot logins\n"; |
|
| 105 |
print "graph_args --base 1000 -l 0 --no-gridfit --slope-mode\n"; |
|
| 106 |
print "graph_vlabel logins/5 minute\n"; |
|
| 107 |
print "graph_category mail\n"; |
|
| 108 |
print "login.label Logins\n"; |
|
| 109 |
print "login.type GAUGE\n"; |
|
| 110 |
print "login.draw LINE1\n"; |
|
| 111 |
print "login.min 0\n"; |
|
| 112 |
print "imaplogin.label IMAP logins\n"; |
|
| 113 |
print "imaplogin.type GAUGE\n"; |
|
| 114 |
print "imaplogin.draw LINE1\n"; |
|
| 115 |
print "imaplogin.min 0\n"; |
|
| 116 |
print "pop3login.label POP3 logins\n"; |
|
| 117 |
print "pop3login.type GAUGE\n"; |
|
| 118 |
print "pop3login.draw LINE1\n"; |
|
| 119 |
print "pop3login.min 0\n"; |
|
| 120 |
print "tls.label TLS\n"; |
|
| 121 |
print "tls.type GAUGE\n"; |
|
| 122 |
print "tls.draw LINE1\n"; |
|
| 123 |
print "tls.min 0\n"; |
|
| 124 |
print "ssl.label SSL\n"; |
|
| 125 |
print "ssl.type GAUGE\n"; |
|
| 126 |
print "ssl.draw LINE1\n"; |
|
| 127 |
print "ssl.min 0\n"; |
|
| 128 |
print "aborted.label Aborted logins\n"; |
|
| 129 |
print "aborted.type GAUGE\n"; |
|
| 130 |
print "aborted.draw LINE1\n"; |
|
| 131 |
print "aborted.min 0\n"; |
|
| 132 |
exit 0; |
|
| 133 |
} |
|
| 134 |
|
|
| 135 |
if (! -f $logfile and ! -f $rotlogfile) {
|
|
| 136 |
print "multigraph dovecot_connections\n"; |
|
| 137 |
print "connections.value U"; |
|
| 138 |
print "connectionsimap.value U"; |
|
| 139 |
print "connectionspop3.value U"; |
|
| 140 |
print "multigraph dovecot_connected\n"; |
|
| 141 |
print "connected.value U\n"; |
|
| 142 |
print "connectedimap.value U\n"; |
|
| 143 |
print "connectedpop3.value U\n"; |
|
| 144 |
print "multigraph dovecot_logins\n"; |
|
| 145 |
print "login.value U\n"; |
|
| 146 |
print "pop3login.value U\n"; |
|
| 147 |
print "imaplogin.value U\n"; |
|
| 148 |
print "tls.value U\n"; |
|
| 149 |
print "ssl.value U\n"; |
|
| 150 |
print "aborted.value U\n"; |
|
| 151 |
|
|
| 152 |
exit 0; |
|
| 153 |
} |
|
| 154 |
|
|
| 155 |
# dit kan beter maar twee calls zijn toch nodig als we niet zelf aggegreren |
|
| 156 |
# suggestie: doveadm who -1 | awk '{print $1" "$2" "$4}' | sort | uniq -c
|
|
| 157 |
$connectedimap = `$DOVEADM -f flow who | grep imap | wc -l`; |
|
| 158 |
$connectedpop3 = `$DOVEADM -f flow who | grep pop3 | wc -l`; |
|
| 159 |
$connectionsimap = `$DOVEADM -f flow who -1 | grep imap | wc -l`; |
|
| 160 |
$connectionspop3 = `$DOVEADM -f flow who -1 | grep pop3 | wc -l`; |
|
| 161 |
|
|
| 162 |
#trim |
|
| 163 |
$connectedimap =~ s/\s+$//; |
|
| 164 |
$connectedpop3 =~ s/\s+$//; |
|
| 165 |
$connectionsimap =~ s/\s+$//; |
|
| 166 |
$connectionspop3 =~ s/\s+$//; |
|
| 167 |
|
|
| 168 |
$connected = $connectedimap + $connectedpop3; |
|
| 169 |
$connections = $connectionsimap + $connectionspop3; |
|
| 170 |
|
|
| 171 |
my ($pos) = restore_state(); |
|
| 172 |
|
|
| 173 |
$startsize = (stat $logfile)[7]; |
|
| 174 |
|
|
| 175 |
if (!defined $pos) {
|
|
| 176 |
# Initial run. |
|
| 177 |
$pos = $startsize; |
|
| 178 |
} |
|
| 179 |
|
|
| 180 |
if ($startsize < $pos) {
|
|
| 181 |
# Log rotated |
|
| 182 |
parseDovecotfile ($rotlogfile, $pos, (stat $rotlogfile)[7]); |
|
| 183 |
$pos = 0; |
|
| 184 |
} |
|
| 185 |
|
|
| 186 |
parseDovecotfile ($logfile, $pos, $startsize); |
|
| 187 |
$pos = $startsize; |
|
| 188 |
|
|
| 189 |
save_state($pos); |
|
| 190 |
|
|
| 191 |
print "multigraph dovecot_connections\n"; |
|
| 192 |
print "connections.value $connections\n"; |
|
| 193 |
print "connectionsimap.value $connectionsimap\n"; |
|
| 194 |
print "connectionspop3.value $connectionspop3\n"; |
|
| 195 |
print "multigraph dovecot_connected\n"; |
|
| 196 |
print "connected.value $connected\n"; |
|
| 197 |
print "connectedimap.value $connectedimap\n"; |
|
| 198 |
print "connectedpop3.value $connectedpop3\n"; |
|
| 199 |
print "multigraph dovecot_logins\n"; |
|
| 200 |
print "login.value $login\n"; |
|
| 201 |
print "pop3login.value $pop3login\n"; |
|
| 202 |
print "imaplogin.value $imaplogin\n"; |
|
| 203 |
print "tls.value $tls\n"; |
|
| 204 |
print "ssl.value $ssl\n"; |
|
| 205 |
print "aborted.value $aborted\n"; |
|
| 206 |
|
|
| 207 |
|
|
| 208 |
sub parseDovecotfile {
|
|
| 209 |
my ($fname, $start, $stop) = @_; |
|
| 210 |
open (logf, $fname) or exit 3; |
|
| 211 |
seek (logf, $start, 0) or exit 2; |
|
| 212 |
|
|
| 213 |
while (tell (logf) < $stop) {
|
|
| 214 |
my $line =<logf>; |
|
| 215 |
chomp ($line); |
|
| 216 |
|
|
| 217 |
if ( $dovelogfile == 0 and $line !~ m/dovecot/) { next; }
|
|
| 218 |
else {
|
|
| 219 |
if ($line =~ m/Aborted/) {
|
|
| 220 |
$aborted++; |
|
| 221 |
|
|
| 222 |
} elsif ($line =~ m/Login:/) {
|
|
| 223 |
$login++; |
|
| 224 |
|
|
| 225 |
if ( $line =~ m/TLS/) {
|
|
| 226 |
$tls++; |
|
| 227 |
} elsif ($line =~ m/SSL/) {
|
|
| 228 |
$ssl++; |
|
| 229 |
} |
|
| 230 |
|
|
| 231 |
if ( $line =~ m/pop3-login:/) {
|
|
| 232 |
$pop3login++; |
|
| 233 |
} elsif ($line =~ m/imap-login:/) {
|
|
| 234 |
$imaplogin++; |
|
| 235 |
} |
|
| 236 |
} |
|
| 237 |
} |
|
| 238 |
} |
|
| 239 |
close(logf); |
|
| 240 |
} |
|
| 241 |
|
|
| 242 |
# vim:syntax=perl |
|
| 29 |
###################### |
|
| 30 |
# Configuration |
|
| 31 |
###################### |
|
| 32 |
EXPR_BIN=/usr/bin/expr |
|
| 33 |
LOGFILE=${logfile:-/var/log/mail.log}
|
|
| 34 |
###################### |
|
| 35 |
|
|
| 36 |
if [ "$1" = "autoconf" ]; then |
|
| 37 |
echo yes |
|
| 38 |
exit 0 |
|
| 39 |
fi |
|
| 40 |
|
|
| 41 |
if [ "$1" = "config" ]; then |
|
| 42 |
echo 'graph_title Dovecot Logins' |
|
| 43 |
echo 'graph_category mail' |
|
| 44 |
echo 'graph_args --base 1000 -l 0' |
|
| 45 |
echo 'graph_vlabel Login Counters' |
|
| 46 |
|
|
| 47 |
for t in Total TLS SSL IMAP POP3 |
|
| 48 |
do |
|
| 49 |
field=$(echo $t | tr '[:upper:]' '[:lower:]') |
|
| 50 |
echo "login_$field.label $t Logins" |
|
| 51 |
echo "login_$field.type DERIVE" |
|
| 52 |
echo "login_$field.min 0" |
|
| 53 |
done |
|
| 54 |
|
|
| 55 |
echo 'connected.label Connected Users' |
|
| 56 |
|
|
| 57 |
exit 0 |
|
| 58 |
fi |
|
| 59 |
|
|
| 60 |
###################### |
|
| 61 |
# Total Logins |
|
| 62 |
###################### |
|
| 63 |
echo -en "login_total.value " |
|
| 64 |
VALUE=$(egrep -c '[dovecot]?.*Login' $LOGFILE) |
|
| 65 |
if [ ! -z "$VALUE" ]; then |
|
| 66 |
echo "$VALUE" |
|
| 67 |
else |
|
| 68 |
echo "0" |
|
| 69 |
fi |
|
| 70 |
echo -n |
|
| 71 |
###################### |
|
| 72 |
# Connected Users |
|
| 73 |
###################### |
|
| 74 |
DISCONNECTS=$(egrep -c '[dovecot]?.*Disconnected' $LOGFILE) |
|
| 75 |
CONNECTS=$(egrep -c '[dovecot]?.*Login' $LOGFILE) |
|
| 76 |
VALUE=$($EXPR_BIN $CONNECTS - $DISCONNECTS) |
|
| 77 |
if [ -z "$VALUE" ] || [ "$VALUE" -lt 0 ]; then |
|
| 78 |
VALUE=0 |
|
| 79 |
fi |
|
| 80 |
echo -en "connected.value " |
|
| 81 |
echo $VALUE |
|
| 82 |
echo -n |
|
| 83 |
###################### |
|
| 84 |
# TLS Logins |
|
| 85 |
###################### |
|
| 86 |
echo -en "login_tls.value " |
|
| 87 |
VALUE=$(egrep -c '[dovecot]?.*Login.*TLS' $LOGFILE) |
|
| 88 |
if [ ! -z "$VALUE" ]; then |
|
| 89 |
echo "$VALUE" |
|
| 90 |
else |
|
| 91 |
echo "0" |
|
| 92 |
fi |
|
| 93 |
echo -n |
|
| 94 |
###################### |
|
| 95 |
# SSL Logins |
|
| 96 |
###################### |
|
| 97 |
echo -en "login_ssl.value " |
|
| 98 |
VALUE=$(egrep -c '[dovecot]?.*Login.*SSL' $LOGFILE) |
|
| 99 |
if [ ! -z "$VALUE" ]; then |
|
| 100 |
echo "$VALUE" |
|
| 101 |
else |
|
| 102 |
echo "0" |
|
| 103 |
fi |
|
| 104 |
echo -n |
|
| 105 |
###################### |
|
| 106 |
# IMAP Logins |
|
| 107 |
###################### |
|
| 108 |
echo -en "login_imap.value " |
|
| 109 |
VALUE=$(egrep -c '[dovecot]?.*imap.*Login' $LOGFILE) |
|
| 110 |
if [ ! -z "$VALUE" ]; then |
|
| 111 |
echo "$VALUE" |
|
| 112 |
else |
|
| 113 |
echo "0" |
|
| 114 |
fi |
|
| 115 |
echo -n |
|
| 116 |
###################### |
|
| 117 |
# POP3 Logins |
|
| 118 |
###################### |
|
| 119 |
echo -en "login_pop3.value " |
|
| 120 |
VALUE=$(egrep -c '[dovecot]?.*pop3.*Login' $LOGFILE) |
|
| 121 |
if [ ! -z "$VALUE" ]; then |
|
| 122 |
echo "$VALUE" |
|
| 123 |
else |
|
| 124 |
echo "0" |
|
| 125 |
fi |
|
| 126 |
echo -n |
|
| plugins/dovecot/dovecot1 | ||
|---|---|---|
| 1 |
#!/usr/bin/perl |
|
| 2 |
|
|
| 3 |
#%# family=auto |
|
| 4 |
#%# capabilities=autoconf |
|
| 5 |
|
|
| 6 |
use Munin::Plugin; |
|
| 7 |
|
|
| 8 |
$pos = undef; |
|
| 9 |
$connected = 0; |
|
| 10 |
$connectedimap = 0; |
|
| 11 |
$connectedpop3 = 0; |
|
| 12 |
$connections = 0; |
|
| 13 |
$connectionsimap = 0; |
|
| 14 |
$connectionspop3 = 0; |
|
| 15 |
$login = 0; |
|
| 16 |
$pop3login = 0; |
|
| 17 |
$imaplogin = 0; |
|
| 18 |
$tls = 0; |
|
| 19 |
$ssl = 0; |
|
| 20 |
$aborted = 0; |
|
| 21 |
|
|
| 22 |
($dirname = $0) =~ s/[^\/]+$//; |
|
| 23 |
|
|
| 24 |
$dovelogfile = 0 ; |
|
| 25 |
|
|
| 26 |
$logfile = $ENV{'LOGFILE'} || '/var/log/mail.log';
|
|
| 27 |
|
|
| 28 |
if ( $logfile =~ /dovecot/ ) {
|
|
| 29 |
$dovelogfile = 1 ; |
|
| 30 |
} |
|
| 31 |
|
|
| 32 |
# Use an overrided $PATH for all external programs if needed |
|
| 33 |
$DOVEADM = "doveadm"; |
|
| 34 |
|
|
| 35 |
if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) {
|
|
| 36 |
|
|
| 37 |
if (! -x $DOVEADM) {
|
|
| 38 |
print "no (no doveadm)\n"; |
|
| 39 |
exit(1); |
|
| 40 |
} |
|
| 41 |
|
|
| 42 |
if (! -f $logfile) {
|
|
| 43 |
print "no (logfile $logfile does not exist)\n"; |
|
| 44 |
exit(1); |
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
if (-r "$logfile") {
|
|
| 48 |
print "yes\n"; |
|
| 49 |
exit 0; |
|
| 50 |
} else {
|
|
| 51 |
print "no (logfile not readable)\n"; |
|
| 52 |
} |
|
| 53 |
exit 1; |
|
| 54 |
} |
|
| 55 |
|
|
| 56 |
if (-f "$logfile.0") {
|
|
| 57 |
$rotlogfile = $logfile . ".0"; |
|
| 58 |
} elsif (-f "$logfile.1") {
|
|
| 59 |
$rotlogfile = $logfile . ".1"; |
|
| 60 |
} elsif (-f "$logfile.01") {
|
|
| 61 |
$rotlogfile = $logfile . ".01"; |
|
| 62 |
} else {
|
|
| 63 |
$rotlogfile = $logfile . ".0"; |
|
| 64 |
} |
|
| 65 |
|
|
| 66 |
if ( $ARGV[0] and $ARGV[0] eq "config" ) {
|
|
| 67 |
print "multigraph dovecot_connections\n"; |
|
| 68 |
print "graph_title Dovecot connections\n"; |
|
| 69 |
print "graph_args --base 1000 -l 0 --no-gridfit --slope-mode\n"; |
|
| 70 |
print "graph_vlabel connections\n"; |
|
| 71 |
print "graph_category mail\n"; |
|
| 72 |
print "connections.label Connections open\n"; |
|
| 73 |
print "connections.type GAUGE\n"; |
|
| 74 |
print "connections.draw LINE1\n"; |
|
| 75 |
print "connections.min 0\n"; |
|
| 76 |
print "connectionsimap.label IMAP\n"; |
|
| 77 |
print "connectionsimap.type GAUGE\n"; |
|
| 78 |
print "connectionsimap.draw AREA\n"; |
|
| 79 |
print "connectionsimap.min 0\n"; |
|
| 80 |
print "connectionspop3.label POP3\n"; |
|
| 81 |
print "connectionspop3.type GAUGE\n"; |
|
| 82 |
print "connectionspop3.draw STACK\n"; |
|
| 83 |
print "connectionspop3.min 0\n"; |
|
| 84 |
|
|
| 85 |
print "multigraph dovecot_connected\n"; |
|
| 86 |
print "graph_title Dovecot connected users\n"; |
|
| 87 |
print "graph_args --base 1000 -l 0 --no-gridfit --slope-mode\n"; |
|
| 88 |
print "graph_vlabel connections\n"; |
|
| 89 |
print "graph_category mail\n"; |
|
| 90 |
print "connected.label Connected users\n"; |
|
| 91 |
print "connected.type GAUGE\n"; |
|
| 92 |
print "connected.draw LINE1\n"; |
|
| 93 |
print "connected.min 0\n"; |
|
| 94 |
print "connectedimap.label IMAP\n"; |
|
| 95 |
print "connectedimap.type GAUGE\n"; |
|
| 96 |
print "connectedimap.draw AREA\n"; |
|
| 97 |
print "connectedimap.min 0\n"; |
|
| 98 |
print "connectedpop3.label POP3\n"; |
|
| 99 |
print "connectedpop3.type GAUGE\n"; |
|
| 100 |
print "connectedpop3.draw STACK\n"; |
|
| 101 |
print "connectedpop3.min 0\n"; |
|
| 102 |
|
|
| 103 |
print "multigraph dovecot_logins\n"; |
|
| 104 |
print "graph_title Dovecot logins\n"; |
|
| 105 |
print "graph_args --base 1000 -l 0 --no-gridfit --slope-mode\n"; |
|
| 106 |
print "graph_vlabel logins/5 minute\n"; |
|
| 107 |
print "graph_category mail\n"; |
|
| 108 |
print "login.label Logins\n"; |
|
| 109 |
print "login.type GAUGE\n"; |
|
| 110 |
print "login.draw LINE1\n"; |
|
| 111 |
print "login.min 0\n"; |
|
| 112 |
print "imaplogin.label IMAP logins\n"; |
|
| 113 |
print "imaplogin.type GAUGE\n"; |
|
| 114 |
print "imaplogin.draw LINE1\n"; |
|
| 115 |
print "imaplogin.min 0\n"; |
|
| 116 |
print "pop3login.label POP3 logins\n"; |
|
| 117 |
print "pop3login.type GAUGE\n"; |
|
| 118 |
print "pop3login.draw LINE1\n"; |
|
| 119 |
print "pop3login.min 0\n"; |
|
| 120 |
print "tls.label TLS\n"; |
|
| 121 |
print "tls.type GAUGE\n"; |
|
| 122 |
print "tls.draw LINE1\n"; |
|
| 123 |
print "tls.min 0\n"; |
|
| 124 |
print "ssl.label SSL\n"; |
|
| 125 |
print "ssl.type GAUGE\n"; |
|
| 126 |
print "ssl.draw LINE1\n"; |
|
| 127 |
print "ssl.min 0\n"; |
|
| 128 |
print "aborted.label Aborted logins\n"; |
|
| 129 |
print "aborted.type GAUGE\n"; |
|
| 130 |
print "aborted.draw LINE1\n"; |
|
| 131 |
print "aborted.min 0\n"; |
|
| 132 |
exit 0; |
|
| 133 |
} |
|
| 134 |
|
|
| 135 |
if (! -f $logfile and ! -f $rotlogfile) {
|
|
| 136 |
print "multigraph dovecot_connections\n"; |
|
| 137 |
print "connections.value U"; |
|
| 138 |
print "connectionsimap.value U"; |
|
| 139 |
print "connectionspop3.value U"; |
|
| 140 |
print "multigraph dovecot_connected\n"; |
|
| 141 |
print "connected.value U\n"; |
|
| 142 |
print "connectedimap.value U\n"; |
|
| 143 |
print "connectedpop3.value U\n"; |
|
| 144 |
print "multigraph dovecot_logins\n"; |
|
| 145 |
print "login.value U\n"; |
|
| 146 |
print "pop3login.value U\n"; |
|
| 147 |
print "imaplogin.value U\n"; |
|
| 148 |
print "tls.value U\n"; |
|
| 149 |
print "ssl.value U\n"; |
|
| 150 |
print "aborted.value U\n"; |
|
| 151 |
|
|
| 152 |
exit 0; |
|
| 153 |
} |
|
| 154 |
|
|
| 155 |
# dit kan beter maar twee calls zijn toch nodig als we niet zelf aggegreren |
|
| 156 |
# suggestie: doveadm who -1 | awk '{print $1" "$2" "$4}' | sort | uniq -c
|
|
| 157 |
$connectedimap = `$DOVEADM -f flow who | grep imap | wc -l`; |
|
| 158 |
$connectedpop3 = `$DOVEADM -f flow who | grep pop3 | wc -l`; |
|
| 159 |
$connectionsimap = `$DOVEADM -f flow who -1 | grep imap | wc -l`; |
|
| 160 |
$connectionspop3 = `$DOVEADM -f flow who -1 | grep pop3 | wc -l`; |
|
| 161 |
|
|
| 162 |
#trim |
|
| 163 |
$connectedimap =~ s/\s+$//; |
|
| 164 |
$connectedpop3 =~ s/\s+$//; |
|
| 165 |
$connectionsimap =~ s/\s+$//; |
|
| 166 |
$connectionspop3 =~ s/\s+$//; |
|
| 167 |
|
|
| 168 |
$connected = $connectedimap + $connectedpop3; |
|
| 169 |
$connections = $connectionsimap + $connectionspop3; |
|
| 170 |
|
|
| 171 |
my ($pos) = restore_state(); |
|
| 172 |
|
|
| 173 |
$startsize = (stat $logfile)[7]; |
|
| 174 |
|
|
| 175 |
if (!defined $pos) {
|
|
| 176 |
# Initial run. |
|
| 177 |
$pos = $startsize; |
|
| 178 |
} |
|
| 179 |
|
|
| 180 |
if ($startsize < $pos) {
|
|
| 181 |
# Log rotated |
|
| 182 |
parseDovecotfile ($rotlogfile, $pos, (stat $rotlogfile)[7]); |
|
| 183 |
$pos = 0; |
|
| 184 |
} |
|
| 185 |
|
|
| 186 |
parseDovecotfile ($logfile, $pos, $startsize); |
|
| 187 |
$pos = $startsize; |
|
| 188 |
|
|
| 189 |
save_state($pos); |
|
| 190 |
|
|
| 191 |
print "multigraph dovecot_connections\n"; |
|
| 192 |
print "connections.value $connections\n"; |
|
| 193 |
print "connectionsimap.value $connectionsimap\n"; |
|
| 194 |
print "connectionspop3.value $connectionspop3\n"; |
|
| 195 |
print "multigraph dovecot_connected\n"; |
|
| 196 |
print "connected.value $connected\n"; |
|
| 197 |
print "connectedimap.value $connectedimap\n"; |
|
| 198 |
print "connectedpop3.value $connectedpop3\n"; |
|
| 199 |
print "multigraph dovecot_logins\n"; |
|
| 200 |
print "login.value $login\n"; |
|
| 201 |
print "pop3login.value $pop3login\n"; |
|
| 202 |
print "imaplogin.value $imaplogin\n"; |
|
| 203 |
print "tls.value $tls\n"; |
|
| 204 |
print "ssl.value $ssl\n"; |
|
| 205 |
print "aborted.value $aborted\n"; |
|
| 206 |
|
|
| 207 |
|
|
| 208 |
sub parseDovecotfile {
|
|
| 209 |
my ($fname, $start, $stop) = @_; |
|
| 210 |
open (logf, $fname) or exit 3; |
|
| 211 |
seek (logf, $start, 0) or exit 2; |
|
| 212 |
|
|
| 213 |
while (tell (logf) < $stop) {
|
|
| 214 |
my $line =<logf>; |
|
| 215 |
chomp ($line); |
|
| 216 |
|
|
| 217 |
if ( $dovelogfile == 0 and $line !~ m/dovecot/) { next; }
|
|
| 218 |
else {
|
|
| 219 |
if ($line =~ m/Aborted/) {
|
|
| 220 |
$aborted++; |
|
| 221 |
|
|
| 222 |
} elsif ($line =~ m/Login:/) {
|
|
| 223 |
$login++; |
|
| 224 |
|
|
| 225 |
if ( $line =~ m/TLS/) {
|
|
| 226 |
$tls++; |
|
| 227 |
} elsif ($line =~ m/SSL/) {
|
|
| 228 |
$ssl++; |
|
| 229 |
} |
|
| 230 |
|
|
| 231 |
if ( $line =~ m/pop3-login:/) {
|
|
| 232 |
$pop3login++; |
|
| 233 |
} elsif ($line =~ m/imap-login:/) {
|
|
| 234 |
$imaplogin++; |
|
| 235 |
} |
|
| 236 |
} |
|
| 237 |
} |
|
| 238 |
} |
|
| 239 |
close(logf); |
|
| 240 |
} |
|
| 241 |
|
|
| 242 |
# vim:syntax=perl |
|
| plugins/hhvm/hhvm_ | ||
|---|---|---|
| 89 | 89 |
multigraph hhvm_${graphName}_threads
|
| 90 | 90 |
graph_title HHVM Threads ${name}
|
| 91 | 91 |
graph_args --base 1000 |
| 92 |
graph_category hhvm
|
|
| 92 |
graph_category php
|
|
| 93 | 93 |
threads.label Threads |
| 94 | 94 |
load.label Active Workers |
| 95 | 95 |
queued.label Queued Jobs |
| ... | ... | |
| 97 | 97 |
multigraph hhvm_${graphName}_sizes
|
| 98 | 98 |
graph_title HHVM Sizes ${name}
|
| 99 | 99 |
graph_args --base 1024 |
| 100 |
graph_category hhvm
|
|
| 100 |
graph_category php
|
|
| 101 | 101 |
hhbc-roarena-capac.label HHBC Arena Capacity |
| 102 | 102 |
tc-hotsize.label TC Hot Size |
| 103 | 103 |
tc-hotsize.info Translation Cache Hot Size |
| plugins/http/http_responsetime | ||
|---|---|---|
| 64 | 64 |
print "graph_title HTTP response time\n"; |
| 65 | 65 |
} |
| 66 | 66 |
print "graph_vlabel ms\n"; |
| 67 |
print "graph_category HTTP\n";
|
|
| 67 |
print "graph_category webserver\n";
|
|
| 68 | 68 |
print "graph_info This graph shows the response time in milliseconds, to load a web page\n"; |
| 69 | 69 |
print "timespent.label timespent\n"; |
| 70 | 70 |
print "timespent.type GAUGE\n"; |
| plugins/http/multi_http_responsetime | ||
|---|---|---|
| 92 | 92 |
} |
| 93 | 93 |
print "graph_scale no\n"; |
| 94 | 94 |
print "graph_vlabel ms\n"; |
| 95 |
print "graph_category HTTP\n";
|
|
| 95 |
print "graph_category webserver\n";
|
|
| 96 | 96 |
print "graph_info This graph shows the response time in milliseconds, to load a web page\n"; |
| 97 | 97 |
for ($i=0; $i <= $max_index; ++$i) {
|
| 98 | 98 |
$vhost = $url_array[$i]; |
| plugins/http/vhost_requests_ | ||
|---|---|---|
| 64 | 64 |
|
| 65 | 65 |
case $1 in |
| 66 | 66 |
config) |
| 67 |
echo graph_category http
|
|
| 67 |
echo graph_category webserver
|
|
| 68 | 68 |
echo graph_title Requests by Status Code $file_name |
| 69 | 69 |
echo graph_vlabel Nr of Requests |
| 70 | 70 |
echo S200.label 200 OK |
| plugins/http/wget_page | ||
|---|---|---|
| 143 | 143 |
echo "graph_args --base 1000 -l 0" |
| 144 | 144 |
echo "graph_scale no" |
| 145 | 145 |
echo "graph_vlabel Load time in seconds" |
| 146 |
echo "graph_category http"
|
|
| 146 |
echo "graph_category webserver"
|
|
| 147 | 147 |
echo "graph_info This graph shows load time in seconds of one or more urls" |
| 148 | 148 |
I=1 |
| 149 | 149 |
for name in ${names}; do
|
| plugins/kamailio/kamailio_memory | ||
|---|---|---|
| 72 | 72 |
print("graph_args --base 1024 --lower-limit 0\n");
|
| 73 | 73 |
print("graph_vlabel MB\n");
|
| 74 | 74 |
print("graph_scale no\n");
|
| 75 |
print("graph_category kamailio\n");
|
|
| 75 |
print("graph_category voip\n");
|
|
| 76 | 76 |
print("graph_info The graph describes the usage of memory in Voxtrot Sip Server.\n");
|
| 77 | 77 |
print("ram_total.label total (kam+fs+rtp)\n");
|
| 78 | 78 |
print("ram_freeswitch.label freeswitch\n");
|
| plugins/kamailio/kamailio_mysql_shared_memory | ||
|---|---|---|
| 143 | 143 |
print("graph_args --base 1024 --lower-limit 0\n");
|
| 144 | 144 |
print("graph_vlabel MB\n");
|
| 145 | 145 |
print("graph_scale no\n");
|
| 146 |
print("graph_category kamailio\n");
|
|
| 146 |
print("graph_category voip\n");
|
|
| 147 | 147 |
print("graph_info The graph describes the usage of shared memory.\n");
|
| 148 | 148 |
print("shmem_total.label total\n");
|
| 149 | 149 |
print("shmem_used.label used\n");
|
| plugins/kamailio/kamailio_transactions_users | ||
|---|---|---|
| 141 | 141 |
print("graph_args --base 1000 --lower-limit 0\n");
|
| 142 | 142 |
print("graph_vlabel user/transaction\n");
|
| 143 | 143 |
print("graph_scale no\n");
|
| 144 |
print("graph_category kamailio\n");
|
|
| 144 |
print("graph_category voip\n");
|
|
| 145 | 145 |
print("graph_info The graph describes the number of users/transaction on kamailio.\n");
|
| 146 | 146 |
|
| 147 | 147 |
print("users.label users\n");
|
| plugins/mail/dovecot | ||
|---|---|---|
| 1 |
#! /bin/bash |
|
| 2 |
# |
|
| 3 |
# Munin Plugin |
|
| 4 |
# to count logins to your dovecot mailserver |
|
| 5 |
# |
|
| 6 |
# Created by Dominik Schulz <lkml@ds.gauner.org> |
|
| 7 |
# http://developer.gauner.org/munin/ |
|
| 8 |
# Contributions by: |
|
| 9 |
# - Stephane Enten <tuf@delyth.net> |
|
| 10 |
# - Steve Schnepp <steve.schnepp@pwkf.org> |
|
| 11 |
# |
|
| 12 |
# Parameters understood: |
|
| 13 |
# |
|
| 14 |
# config (required) |
|
| 15 |
# autoconf (optional - used by munin-config) |
|
| 16 |
# |
|
| 17 |
# Config variables: |
|
| 18 |
# |
|
| 19 |
# logfile - Where to find the syslog file |
|
| 20 |
# |
|
| 21 |
# Add the following line to a file in /etc/munin/plugin-conf.d: |
|
| 22 |
# env.logfile /var/log/your/logfile.log |
|
| 23 |
# |
|
| 24 |
# Magic markers (optional - used by munin-config and installation scripts): |
|
| 25 |
# |
|
| 26 |
#%# family=auto |
|
| 27 |
#%# capabilities=autoconf |
|
| 28 |
|
|
| 29 |
###################### |
|
| 30 |
# Configuration |
|
| 31 |
###################### |
|
| 32 |
EXPR_BIN=/usr/bin/expr |
|
| 33 |
LOGFILE=${logfile:-/var/log/mail.log}
|
|
| 34 |
###################### |
|
| 35 |
|
|
| 36 |
if [ "$1" = "autoconf" ]; then |
|
| 37 |
echo yes |
|
| 38 |
exit 0 |
|
| 39 |
fi |
|
| 40 |
|
|
| 41 |
if [ "$1" = "config" ]; then |
|
| 42 |
echo 'graph_title Dovecot Logins' |
|
| 43 |
echo 'graph_category Mail' |
|
| 44 |
echo 'graph_args --base 1000 -l 0' |
|
| 45 |
echo 'graph_vlabel Login Counters' |
|
| 46 |
|
|
| 47 |
for t in Total TLS SSL IMAP POP3 |
|
| 48 |
do |
|
| 49 |
field=$(echo $t | tr '[:upper:]' '[:lower:]') |
|
| 50 |
echo "login_$field.label $t Logins" |
|
| 51 |
echo "login_$field.type DERIVE" |
|
| 52 |
echo "login_$field.min 0" |
|
| 53 |
done |
|
| 54 |
|
|
| 55 |
echo 'connected.label Connected Users' |
|
| 56 |
|
|
| 57 |
exit 0 |
|
| 58 |
fi |
|
| 59 |
|
|
| 60 |
###################### |
|
| 61 |
# Total Logins |
|
| 62 |
###################### |
|
| 63 |
echo -en "login_total.value " |
|
| 64 |
VALUE=$(egrep -c '[dovecot]?.*Login' $LOGFILE) |
|
| 65 |
if [ ! -z "$VALUE" ]; then |
|
| 66 |
echo "$VALUE" |
|
| 67 |
else |
|
| 68 |
echo "0" |
|
| 69 |
fi |
|
| 70 |
echo -n |
|
| 71 |
###################### |
|
| 72 |
# Connected Users |
|
| 73 |
###################### |
|
| 74 |
DISCONNECTS=$(egrep -c '[dovecot]?.*Disconnected' $LOGFILE) |
|
| 75 |
CONNECTS=$(egrep -c '[dovecot]?.*Login' $LOGFILE) |
|
| 76 |
VALUE=$($EXPR_BIN $CONNECTS - $DISCONNECTS) |
|
| 77 |
if [ -z "$VALUE" ] || [ "$VALUE" -lt 0 ]; then |
|
| 78 |
VALUE=0 |
|
| 79 |
fi |
|
| 80 |
echo -en "connected.value " |
|
| 81 |
echo $VALUE |
|
| 82 |
echo -n |
|
| 83 |
###################### |
|
| 84 |
# TLS Logins |
|
| 85 |
###################### |
|
| 86 |
echo -en "login_tls.value " |
|
| 87 |
VALUE=$(egrep -c '[dovecot]?.*Login.*TLS' $LOGFILE) |
|
| 88 |
if [ ! -z "$VALUE" ]; then |
|
| 89 |
echo "$VALUE" |
|
| 90 |
else |
|
| 91 |
echo "0" |
|
| 92 |
fi |
|
| 93 |
echo -n |
|
| 94 |
###################### |
|
| 95 |
# SSL Logins |
|
| 96 |
###################### |
|
| 97 |
echo -en "login_ssl.value " |
|
| 98 |
VALUE=$(egrep -c '[dovecot]?.*Login.*SSL' $LOGFILE) |
|
| 99 |
if [ ! -z "$VALUE" ]; then |
|
| 100 |
echo "$VALUE" |
|
| 101 |
else |
|
| 102 |
echo "0" |
|
| 103 |
fi |
|
| 104 |
echo -n |
|
| 105 |
###################### |
|
| 106 |
# IMAP Logins |
|
| 107 |
###################### |
|
| 108 |
echo -en "login_imap.value " |
|
| 109 |
VALUE=$(egrep -c '[dovecot]?.*imap.*Login' $LOGFILE) |
|
| 110 |
if [ ! -z "$VALUE" ]; then |
|
| 111 |
echo "$VALUE" |
|
| 112 |
else |
|
| 113 |
echo "0" |
|
| 114 |
fi |
|
| 115 |
echo -n |
|
| 116 |
###################### |
|
| 117 |
# POP3 Logins |
|
| 118 |
###################### |
|
| 119 |
echo -en "login_pop3.value " |
|
| 120 |
VALUE=$(egrep -c '[dovecot]?.*pop3.*Login' $LOGFILE) |
|
| 121 |
if [ ! -z "$VALUE" ]; then |
|
| 122 |
echo "$VALUE" |
|
| 123 |
else |
|
| 124 |
echo "0" |
|
| 125 |
fi |
|
| 126 |
echo -n |
|
| plugins/network/speedport_300 | ||
|---|---|---|
| 29 | 29 |
echo 'graph_args --base 1000 -l 0' |
| 30 | 30 |
echo 'graph_scale no' |
| 31 | 31 |
echo 'graph_vlabel Up- / Downstream in kBit/s' |
| 32 |
echo 'graph_category Http'
|
|
| 32 |
echo 'graph_category network'
|
|
| 33 | 33 |
echo 'download.label Downstream' |
| 34 | 34 |
echo 'upload.label Upstream' |
| 35 | 35 |
echo 'graph_info Information from the top_status.htm of the Speedport 300' |
Formats disponibles : Unified diff