2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Leftover from migration

This commit is contained in:
Various 2011-12-18 15:11:52 +01:00 committed by Steve Schnepp
parent b6fb15597c
commit 51ee702d81
10 changed files with 635 additions and 41 deletions

70
plugins/other/acpi-battery Executable file
View File

@ -0,0 +1,70 @@
#!/bin/sh
#
# Plugin to graph battery capacity.
#
# Parameters:
#
# acpi - Override path to acpi program
#
#
# $Log$
# Revision 1.1 2007/03/14 19:52:10 anarcat
# ACPI-Battery plugin, framework copied from acpi plugin
#
#
# Expected content of /proc/acpi/battery/BAT0/info:
# present: yes
# design capacity: 47520 mWh
# last full capacity: 37650 mWh
# battery technology: rechargeable
# design voltage: 10800 mV
# design capacity warning: 2376 mWh
# design capacity low: 475 mWh
# capacity granularity 1: 1 mWh
# capacity granularity 2: 1 mWh
# model number: IBM-08K8039
# serial number: 155
# battery type: LION
# OEM info: Panasonic
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if grep -q 'present.*yes' /proc/acpi/battery/*/info > /dev/null 2>&1; then
echo yes
exit 0
else
echo "no (battery not detected)"
exit 1
fi
fi
cd /proc/acpi/battery
if [ "$1" = "config" ]; then
echo 'graph_title Battery power'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel power in' `awk '/remaining capacity:/ { print $NF }' /proc/acpi/battery/*/state`
echo 'graph_category sensors'
echo 'graph_info This graph shows battery power based on output from ACPI.'
i=0
for battery in *
do
echo $battery.label $battery
echo $battery.info Battery $i
i=$(($i+1))
# design capacity warning: 2376 mWh
# design capacity low: 475 mWh
echo $battery.warning `awk '/design capacity warning:/ { print $4 }' $battery/info`
echo $battery.critical `awk '/design capacity low:/ { print $4 }' $battery/info`
echo ${battery}_full.label $battery capacity
echo ${battery}_full.info last full capacity \(design capacity: `awk '/design capacity:/ { print $3 " " $4 }' $battery/info`\)
done
exit 0
fi
for battery in *
do
echo $battery.value `awk '/remaining capacity:/ { print $3 }' $battery/state`
echo ${battery}_full.value `awk '/last full capacity:/ { print $4 }' $battery/info`
done

View File

@ -1,11 +1,11 @@
#!/bin/bash
# Written by Lars Falk-Petersen, cleware@falk-petersen.no
# Version 0.2. To be used with http://www.vanheusden.com/clewarecontrol/
# Version 0.3. To be used with http://www.vanheusden.com/clewarecontrol/
# Clewarecontrol device serial must be set in config file:
# #Put the following lines in /etc/munin/plugin-conf.d/cleware
# [cleware]
# [cleware*]
# #device serial. find it by running: clewarecontrol -l
# env.serial 7778
# #path of clewarecontrol
@ -32,11 +32,11 @@ if [ ! $serial ]; then
exit 1
fi
$bin -ag > /dev/null 2>&1
$bin -c 1 -ag > /dev/null 2>&1
echo -n "temp.value "
$bin -d $serial -b -rt
$bin -d $serial -b -c 1 -rt
echo -n "hum.value "
$bin -d $serial -b -rh
$bin -d $serial -b -c 1 -rh

View File

@ -0,0 +1,57 @@
#!/bin/bash
#
# munin plugin to monitor bans on Fail2ban jails
#
# Origional Author: Thomas Leveil
# Contributors: none
# Version: 1.1
#
###############################################
# You have to specify a different user in the munin-node config file as follow:
#
# [fail2ban_all_jails]
# user root
###############################################
#
# HISTORY
# v1.1 : better autoconf
#
#%# family=contrib
#%# capabilities=autoconf
case $1 in
autoconf)
if [ -z $(which fail2ban-client) ]; then
echo no
exit 1
fi
if [ $(whoami) != "root" ]; then
echo "no (fail2ban-client found but must run as root)"
exit 1
fi
if [ -x $(which fail2ban-client) ]; then
echo yes
exit 0
else
echo "no (fail2ban-client found but not executable)"
exit 1
fi
;;
config)
echo "graph_title Fail2ban"
echo 'graph_vlabel active bans'
echo 'graph_category Network'
echo 'graph_info number of jailled ip'
echo 'graph_info This graph shows the amount of bans caught by Fail2ban'
$(which fail2ban-client) status | awk '/Jail list:/ { for (i=4; i<=NF; i++) { sub(/,$/,"",$i); jail=$i; sub(/-/,"_",$i); print "fail2ban_"$i".label "jail } }'
exit 0
;;
esac
$(which fail2ban-client) status | awk '/Jail list:/ { for (i=4; i<=NF; i++) { sub(/,$/,"",$i); print $i } }' | \
while read JAIL; do
echo -n "fail2ban_${JAIL//-/_}.value "
$(which fail2ban-client) status $JAIL | awk '/Currently banned:/ { print $NF }'
done

74
plugins/other/ip_forward_ Executable file
View File

@ -0,0 +1,74 @@
#!/bin/sh
#
# Wildcard-plugin to monitor forward traffic for network inretfaces through iptables. To monitor an
# interface, link if_forward_<interface> to this file. E.g.
#
# ln -s /usr/share/node/node/plugins-auto/if_forward_ /etc/munin/node.d/if_forward_eth0
#
# ...will monitor forwarded traffic trough eth0.
#
# Aditionally, you need these iptables rules as the first rules (they don't do anything, just make packet counts)
#
# iptables -A FORWARD -i eth0
# iptables -A FORWARD -o eth0
#
# Furthermore, this plugin needs to be run as root for iptables to work
#
# This plugin is based on the if_ and ip_ plugin.
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf suggest
IF=`basename $0 | sed 's/^if_forward_//g'`
if [ "$1" = "autoconf" ]; then
if [ -r /proc/net/dev ]; then
iptables-save -c >/dev/null 2>/dev/null
if [ $? -gt 0 ]; then
echo "no (could not run iptables-save as user `whoami`)"
exit 1
else
echo yes
exit 0
fi
else
echo "no (/proc/net/dev not found)"
exit 1
fi
fi
if [ "$1" = "suggest" ]; then
if [ -r /proc/net/dev ]; then
egrep '^ *(eth|wlan|ath|ra)[0-9]+:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'
exit 0
else
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo "graph_order out in"
echo "graph_title $IF forwarded traffic"
echo 'graph_args --base 1000'
echo 'graph_vlabel bits per ${graph_period}'
echo 'graph_category network'
echo "graph_info This graph shows only FORWARD traffic that pass trough the interface."
echo 'out.label sent'
echo 'out.type DERIVE'
echo 'out.min 0'
echo 'out.cdef out,8,*'
echo 'in.label received'
echo 'in.type DERIVE'
echo 'in.min 0'
echo 'in.cdef in,8,*'
exit 0
fi;
iptables-save -c | grep $IF | grep i | cut -f2 -d':' | cut -f1 -d']' | awk "{ print \"in.value \" \$0 }"
iptables-save -c | grep $IF | grep o | cut -f2 -d':' | cut -f1 -d']' | awk "{ print \"out.value \" \$0 }"

137
plugins/other/load_extended Executable file
View File

@ -0,0 +1,137 @@
#!/bin/sh
#
# Plugin to monitor the load average on a system.
#
# Usage: Link or copy into /etc/munin/node.d/
#
# $Log$
# Revision 1.5 2004/05/20 19:02:37 jimmyo
# Set categories on a bunch of plugins
#
# Revision 1.4 2004/05/20 13:57:12 jimmyo
# Set categories to some of the plugins.
#
# Revision 1.3 2004/05/16 12:41:04 jimmyo
# Changed load plot from lastminute to last 5 minutes.
#
# Revision 1.2 2004/05/16 12:34:26 jimmyo
# Added "info"-fields to linux/cpu and linux/load plugins, to demonstrate how it works.
#
# Revision 1.1 2004/01/02 18:50:01 jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.4 2003/11/15 11:10:28 jimmyo
# Various fixes
#
# Revision 1.3 2003/11/07 17:43:16 jimmyo
# Cleanups and log entries
#
#
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on wether we
# should be run on this system or not. This is optinal, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
# If run with the "config"-parameter, give out information on how the
# graphs should look.
if [ "$1" = "config" ]; then
# The host name this plugin is for. (Can be overridden to have
# one machine answer for several)
# The title of the graph
echo 'graph_title Load average'
# Arguments to "rrdtool graph". In this case, tell it that the
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
echo 'graph_args --base 1000 -l 0'
# The Y-axis label
echo 'graph_vlabel load'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
echo 'graph_scale no'
# Graph category. Defaults to 'other'
echo 'graph_category system'
# The fields. "label" is used in the legend. "label" is the only
# required subfield.
echo 'load1.label load 1 min avg'
echo 'load1.draw AREA'
echo 'load5.label load 5 min avg'
echo 'load5.draw AREA'
echo 'load15.label load 15 min avg'
echo 'load15.draw AREA'
# These 6 are optional. They are only used if you have
# configured your munin to tell a Nagios-server about any
# problems
echo 'load1.warning 10'
echo 'load1.critical 120'
echo 'load5.warning 10'
echo 'load5.critical 120'
echo 'load15.warning 10'
echo 'load15.critical 120'
# This one is purely to add an explanation to the web page. The first
# one is for the graph itself, while the second one is for the field
# "load".
echo 'graph_info The load average of the machine describes how many processes are in the run-queue (scheduled to run "immediately").'
echo 'load1.info Average load for 1 minute avg.'
echo 'load5.info Average load for 5 minutes avg.'
echo 'load15.info Average load for 15 minutes avg.'
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
echo -n "load1.value "
cut -f1 -d' ' < /proc/loadavg
echo -n "load5.value "
cut -f2 -d' ' < /proc/loadavg
echo -n "load15.value "
cut -f3 -d' ' < /proc/loadavg
# How could this plugin have been written in its simplest form?
# Something like this:
#
# ---------------------
# #!/bin/sh
#
# if [ "$1" = "config" ]; then
# echo "graph_title Load average"
# echo 'graph_args --base 1000 -l 0'
# echo 'graph_vlabel load'
# echo "load.label load"
# exit 0
# fi
# echo -n "load.value "
# cut -f1 -d' ' < /proc/loadavg
# ---------------------
#
# Except for the Nagios-warnings (which most people don't have any need
# for) and things used by installation scripts and munin-config (which
# you don't need if you don't plan on submitting your plugin to the
# pacakge), and the scaling (no milliload numbers) the two versions will
# work identically.

153
plugins/other/oracle__connections Executable file
View File

@ -0,0 +1,153 @@
#!/usr/bin/perl -w
# Plugin for monitor oracle connections.
#
# Licenced under GPL v2.
#
# Usage:
#
# Symlink into /etc/munin/plugins/ and add the monitored
# database to the filename. e.g.:
#
# ln -s /usr/share/munin/plugins/oracle__connections \
# /etc/munin/plugins/oracle_<databasename>_connections
# This should, however, be given through autoconf and suggest.
#
# If required, give username, password and/or oracle server
# host through environment variables.
#
#
# Parameters:
# autoconf
# config (required)
#
# Config variables:
#
# dbhost - Which database server to use. Defaults to
# 'localhost'.
# dbname - Which database to use. Defaults to orcl
# dbuser - A oracle user account with read permission to
# the v$session view. Defaults to
# 'oracle'. Anyway, Munin must be told which user
# this plugin should be run as.
# dbpass - The corresponding password, if
# applicable. Default to undef.
#
# showusers - If set to 1 show usernames and num. of connections.
# Default is not show users (0).
# Magic markers
#%# family=auto
#%# capabilities=autoconf
use strict;
use DBI;
my $dbhost = $ENV{'dbhost'} || '127.0.0.1';
my $dbname = $ENV{'dbname'} || 'orcl';
my $dbuser = $ENV{'dbuser'} || 'oracle';
my $dbport = $ENV{'dbport'} || '1521';
my $dbpass = $ENV{'dbpass'} || '';
my $showusers = $ENV{'showusers'} || '0';
# Check for DBD::Oracle
if (! eval "require DBD::Oracle;") {
exit 1;
}
my $dsn = "DBI:Oracle:dbname=$dbname;host=$dbhost;port=$dbport;sid=$dbname";
#print "$dsn\n";
my $dbh = DBI->connect ($dsn, $dbuser,
$dbpass,
{RaiseError =>1}) || die "";
if (exists $ARGV[0]) {
if ($ARGV[0] eq 'autoconf') {
# Check for DBD::Oracle
if (! eval "require DBD::Oracle;") {
print "no (DBD::Oracle not found)";
exit 1;
}
if ($dbh) {
print "yes\n";
exit 0;
} else {
print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr;
exit 1;
}
}
if ($ARGV[0] eq "config") {
my $sql_max = "select value from v\$parameter where name = 'sessions'";
my $sth_max = $dbh->prepare($sql_max);
$sth_max->execute();
my ($max_connections) = $sth_max->fetchrow();
my $warning = int ($max_connections * 0.7);
my $critical = int ($max_connections * 0.8);
print "graph_title Oracle active connections from $dbname\n";
print "graph_args -l 0 --base 1000\n";
print "graph_vlabel Connections\n";
print "graph_category oracle\n";
print "graph_info Shows active oracle connections from $dbname\n";
print "graph_scale no\n";
if ( $showusers ) {
my $sql = "select username, count(username) from v\$session where username is not null group by username";
my $sth = $dbh->prepare($sql);
$sth->execute();
my $setarea = "yes";
while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) {
print "$datname.label $datname active connections\n";
print "$datname.info $datname active connections\n";
print "$datname.type GAUGE\n";
if ($setarea eq "yes") {
print "$datname.draw AREA\n";
$setarea="";
} else {
print "$datname.draw STACK\n";
}
}
} else {
print "connections.label active connections\n";
print "connections.info active connections\n";
print "connections.type GAUGE\n";
print "connections.warning $warning\n";
print "connections.critical $critical\n";
}
print "total.label active connections\n";
print "total.info active connections\n";
print "total.type GAUGE\n";
print "total.warning $warning\n";
print "total.critical $critical\n";
print "max_connections.label Max. connections\n";
print "max_connections.info Max. connections\n";
print "max_connections.type GAUGE\n";
exit 0;
}
}
my $sql_max = "select value from v\$parameter where name = 'sessions'";
my $sth_max = $dbh->prepare($sql_max);
$sth_max->execute();
my ($max_connections) = $sth_max->fetchrow();
if ( $showusers ) {
my $sql = "select username, count(username) from v\$session where username is not null group by username";
my $sth = $dbh->prepare($sql);
$sth->execute();
my $total = 0;
while ( my ($datname,$curr_conn) = $sth->fetchrow_array ) {
print "$datname.value $curr_conn\n";
$total = $total+$curr_conn;
}
print "total.value $total\n";
} else {
my $sql = "select count(username) from v\$session where username is not null";
my $sth = $dbh->prepare($sql);
$sth->execute();
my ($curr_conn) = $sth->fetchrow_array;
print "connections.value $curr_conn\n";
}
print "max_connections.value $max_connections\n";

BIN
plugins/other/php_apc_ Executable file

Binary file not shown.

106
plugins/other/tinydns Executable file
View File

@ -0,0 +1,106 @@
#!/bin/sh
#
# Shows DNS query statistics as gathered by tinystats by Luca Morettoni.
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -f "/var/service/tinydns/log/main/tinystats.out" ]; then
echo yes;
else
echo no;
fi
exit 0;
fi
if [ "$1" = "config" ]; then
cat - <<EOF
graph_title tinydns queries
graph_args --base 1000 -l 0
graph_vlabel queries/sec
graph_category network
graph_info This graph shows the number of queries that tinydns processed.
graph_total Total
a.label A
a.info The number of A queries.
a.type DERIVE
a.min 0
a.draw AREA
ns.label NS
ns.info The number of NS queries.
ns.type DERIVE
ns.min 0
ns.draw STACK
cname.label CNAME
cname.info The number of CNAME queries.
cname.type DERIVE
cname.min 0
cname.draw STACK
soa.label SOA
soa.info The number of SOA queries.
soa.type DERIVE
soa.min 0
soa.draw STACK
ptr.label PTR
ptr.info The number of PTR queries.
ptr.type DERIVE
ptr.min 0
ptr.draw STACK
hinfo.label HINFO
hinfo.info The number of HINFO queries.
hinfo.type DERIVE
hinfo.min 0
hinfo.draw STACK
mx.label MX
mx.info The number of MX queries.
mx.type DERIVE
mx.min 0
mx.draw STACK
txt.label TXT
txt.info The number of TXT queries.
txt.type DERIVE
txt.min 0
txt.draw STACK
rp.label RP
rp.info The number of RP queries.
rp.type DERIVE
rp.min 0
rp.draw STACK
sig.label SIG
sig.info The number of SIG queries.
sig.type DERIVE
sig.min 0
sig.draw STACK
key.label KEY
key.info The number of KEY queries.
key.type DERIVE
key.min 0
key.draw STACK
aaaa.label AAAA
aaaa.info The number of AAAA queries.
aaaa.type DERIVE
aaaa.min 0
aaaa.draw STACK
axfr.label AXFR
axfr.info The number of AXFR queries.
axfr.type DERIVE
axfr.min 0
axfr.draw STACK
any.label ANY
any.info The number of ANY queries.
any.type DERIVE
any.min 0
any.draw STACK
EOF
exit 0
fi
cat /var/service/tinydns/log/main/tinystats.out | head -n 1 | awk -F: '{ printf "a.value %d\nns.value %d\ncname.value %d\nsoa.value %d\nptr.value %d\nhinfo.value %d\nmx.value %d\ntxt.value %d\nrp.value %d\nsig.value %d\nkey.value %d\naaaa.value %d\naxfr.value %d\nany.value %d\n", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14 }'

View File

@ -71,6 +71,10 @@ sub get_value
sub get_l7vsadm
{
my @l7vsadm_output = `$L7VSADM`;
if ( $? ) {
exit 1;
}
my @lines = map { s{ \s* -> \s* }{}xms; $_ } grep /->/, @l7vsadm_output;
my $header = shift @lines;
my @header_columns = split /\s+/, $header;

View File

@ -2,7 +2,8 @@
# wordpress-munin plugin
#
# Author Andre Darafarin
# Version 0.1 05 Oct 2010
# Improvements by Chris Bair
# Version 0.2 15 Feb 2011
#
#
: <<=cut
@ -45,56 +46,48 @@ Add file plugin-conf.d/wordpress and fill like this
=head1 VERSION
0.1, Oct 05 2010
0.2 15 Feb 2011
=head1 AUTHOR
Andre Darafarin, happypork.com
=cut
case $1 in
config)
cat <<'EOM'
graph_title Wordpress average
graph_order posts comments pingbacks users
graph_vlabel Wordpress
graph_info Some Statistics of Wordpress
posts.label Posts
posts.draw LINE3
comments.label Comments
pingbacks.label Pingbacks
users.label Users
EOM
exit 0;;
esac
if [ "$1" = "config" ]; then
echo 'graph_title Wordpress average'
echo 'graph_order posts comments pingbacks users'
echo 'graph_vlabel Wordpress'
echo 'graph_info Some Statistics of Wordpress'
echo 'posts.label Posts'
echo 'posts.draw LINE3'
echo 'comments.label Comments'
echo 'pingbacks.label Pingbacks'
echo 'users.label Users'
exit 0
fi
POSTS=0
COMMENTS=0
PINGBACKS=0
USERS=0
# DBNAME=${logfile:-/var/log/syslog}
POSTS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --execute="SELECT COUNT(*) FROM wp_posts WHERE post_status = 'publish' AND post_password = '' AND post_type = 'post';"`
SHORTPOSTS="${POSTS:9}"
POSTS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --column-names=0 -s --execute="SELECT COUNT(*) FROM wp_posts WHERE post_status = 'publish' AND post_password = '' AND post_type = 'post';"`
COMMENTS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --execute="SELECT COUNT(*) FROM wp_comments WHERE comment_approved = '1' AND comment_type = '';"`
SHORTCOMMENTS="${COMMENTS:9}"
COMMENTS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --column-names=0 -s --execute="SELECT COUNT(*) FROM wp_comments WHERE comment_approved = '1' AND comment_type = '';"`
PINGBACKS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --execute="SELECT COUNT(*) FROM wp_comments WHERE comment_approved = '1' AND comment_type = 'pingback';"`
SHORTPINGBACKS="${PINGBACKS:9}"
PINGBACKS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --column-names=0 -s --execute="SELECT COUNT(*) FROM wp_comments WHERE comment_approved = '1' AND comment_type = 'pingback';"`
USERS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --execute="SELECT COUNT(*) FROM wp_users ;"`
SHORTUSERS="${USERS:9}"
USERS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --column-names=0 -s --execute="SELECT COUNT(*) FROM wp_users ;"`
#AUSGABE BEREICH
echo -n "posts.value $SHORTPOSTS
"
echo -n "comments.value $SHORTCOMMENTS
"
echo -n "pingbacks.value $SHORTPINGBACKS
"
echo -n "users.value $SHORTUSERS
"
echo "posts.value $POSTS"
echo "comments.value $COMMENTS"
echo "pingbacks.value $PINGBACKS"
echo "users.value $USERS"