1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 02:18:08 +00:00

remove plugins existing in main munin repository

This commit is contained in:
Kenyon Ralph 2012-04-24 02:06:02 -07:00
parent ea6afd78e1
commit e005bb0ccb
5 changed files with 0 additions and 649 deletions

View file

@ -1,91 +0,0 @@
#!/usr/bin/python
#
# Plugin to monitor fail2ban blacklists.
# Parses iptables output. Must be run as a user that may do such. Probably root.
#
# Requires: python, probably 2.3 or so :)
#
# Written by Lasse Karstensen <lasse.karstensen@gmail.com> September 2007.
# Parameters understood:
# config (required)
# autoconf (optional)
#
#%# family=auto
#%# capabilities=autoconf
libdir="/usr/share/fail2ban"
iptablesbin="/sbin/iptables"
import sys, os, ConfigParser
def get_fail2ban_checks(configfile="/etc/fail2ban.conf"):
confReader = ConfigParser.ConfigParser()
confReader.read(configfile)
res = []
for section in confReader.sections():
# basic configuration, not essential for us so we skip it.
if section in ["MAIL"]:
continue
if confReader.has_option(section, "enabled"):
val = confReader.get(section, "enabled")
if val.lower() == "true":
res.append(section)
return res
def list_iptables(chain):
global iptablesbin
cmd = "%s -n -L fail2ban-%s" % (iptablesbin, chain)
num = 0
for line in os.popen(cmd):
line = line.strip()
if line.split()[0] == "DROP":
num = num + 1
return num
def print_config():
# noisy
print 'graph_title Fail2ban blacklist'
print 'graph_info This graph shows the number of host blocked by fail2ban.'
print 'graph_category network'
print 'graph_vlabel Count'
print 'graph_args --base 1000 -l 0'
print 'graph_total total'
for checkname in get_fail2ban_checks():
checkname_sane = checkname_sanitize(checkname)
print '%s.label Rules in chain %s' % (checkname_sane, checkname_sane)
print '%s.min 0' % checkname_sane
def checkname_sanitize(name):
new = ""
from string import digits, letters
for char in name:
if char not in letters+digits:
new += "_"
else:
new += char
return new
def main():
if len(sys.argv) > 1 and sys.argv[1] == "autoconf":
if os.path.isdir(libdir):
print "yes"
sys.exit(0)
else:
print "no"
sys.exit(1)
sys.path.append(libdir)
if len(sys.argv) > 1 and sys.argv[1] == "config":
print_config()
sys.exit(0)
for checkname in get_fail2ban_checks():
num = list_iptables(checkname)
print "%s.value %s" % (checkname_sanitize(checkname), num)
if __name__ == "__main__":
main()

View file

@ -1,40 +0,0 @@
#!/bin/sh
#
# Wildcard-plugin to monitor bans on Fail2ban jails. To monitor an jail, link
# fail2ban_<jail> to this file. E.g.
# ln -s /usr/share/node/node/plugins-auto/fail2ban_
# /etc/munin/node.d/fail2ban_ssh-iptables
# Magic markers (optional - used by munin-config and some installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
JAIL=${0##*/fail2ban_}
case $1 in
autoconf)
if [ -x $(which fail2ban-client) ]; then
echo yes
exit 0
else
echo no
exit 1
fi
;;
config)
echo "graph_title Fail2ban - $JAIL"
echo 'graph_vlabel active bans'
echo 'graph_category network'
echo 'graph_info This graph shows the amount of bans caught by Fail2ban'
echo "fail2ban.label $JAIL"
echo 'fail2ban.type GAUGE'
echo 'fail2ban.info The number of current bans.'
exit 0
;;
esac
echo -n "fail2ban.value "
$(which fail2ban-client) status $JAIL|awk '/Currently banned:/ { print $NF }'

View file

@ -1,57 +0,0 @@
#!/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