Lade till ett par nya servrar
This commit is contained in:
59
fail2ban
Executable file
59
fail2ban
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/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 } }'
|
||||||
|
$(which fail2ban-client) status | sed s/-//g | awk '/Jail list:/ { for (i=4; i<=NF; i++) { sub(/,$/,"",$i); jail=$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 "
|
||||||
|
echo -n "fail2ban_${JAIL//-/}.value "
|
||||||
|
$(which fail2ban-client) status $JAIL | sed s/-//g | awk '/Currently banned:/ { print $NF }'
|
||||||
|
done
|
||||||
|
|
||||||
105
ircd
Executable file
105
ircd
Executable file
@@ -0,0 +1,105 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
#
|
||||||
|
# IRCd Monitoring for Munin
|
||||||
|
#
|
||||||
|
# by Martin Weinelt
|
||||||
|
#
|
||||||
|
# $Log$
|
||||||
|
# Revision 1.0 2009/09/16 05:03:31 UTC hexa-
|
||||||
|
# Initial Release featuring
|
||||||
|
# autoconf-support,
|
||||||
|
# reading user/channels/operators count
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
|
$_nick = "munin-ircd";
|
||||||
|
$_pass = "apa";
|
||||||
|
$_host = "tcp://88.80.5.73";
|
||||||
|
#// change to ssl:// or tls:// for ssl-tunneled-connection, tcp:// for tcp-socket
|
||||||
|
$_port = 6667;
|
||||||
|
|
||||||
|
if (isset($argv['1']) && $argv['1'] == "config") {
|
||||||
|
|
||||||
|
print "host_name ".php_uname('n')."\n";
|
||||||
|
|
||||||
|
print "graph_title IRCd Status\n";
|
||||||
|
print "graph_category Services\n";
|
||||||
|
print "graph_order clients channels operators\n";
|
||||||
|
print "graph_args --base 1000 -l 0\n";
|
||||||
|
|
||||||
|
print "clients.label Clients\n";
|
||||||
|
print "clients.draw LINE2\n";
|
||||||
|
|
||||||
|
print "channels.label Channels\n";
|
||||||
|
print "channels.draw LINE2\n";
|
||||||
|
|
||||||
|
print "operators.label Operators\n";
|
||||||
|
print "operators.draw LINE2\n";
|
||||||
|
|
||||||
|
exit;
|
||||||
|
|
||||||
|
} elseif (isset($argv['1']) && $argv['1'] == "autoconf") {
|
||||||
|
|
||||||
|
$sock = fsockopen($_host, $_port);
|
||||||
|
|
||||||
|
if (!$sock) echo "no\n";
|
||||||
|
else echo "yes\n";
|
||||||
|
|
||||||
|
fclose($sock);
|
||||||
|
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sock = fsockopen($_host, $_port);
|
||||||
|
|
||||||
|
if ($sock) {
|
||||||
|
fputs($sock, "PASS ".$_pass."\n");
|
||||||
|
fputs($sock, "NICK ".$_nick."\n");
|
||||||
|
fputs($sock, "USER munin munin localhost :munin-ircd\n");
|
||||||
|
|
||||||
|
while ($buffer = @fgets($sock, 1024)) {
|
||||||
|
|
||||||
|
$bits = explode(" ", trim($buffer));
|
||||||
|
|
||||||
|
if ($bits['0'] == "PING") { fputs($sock, "PONG ".$bits['1']."\n"); }
|
||||||
|
|
||||||
|
if (isset($argv['1']) && $argv['1'] == "debug") echo $buffer."\n";
|
||||||
|
|
||||||
|
// RAW
|
||||||
|
// End of MOTD / MOTD missing
|
||||||
|
if ($bits['1'] == "422" || $bits['1'] == "376") {
|
||||||
|
|
||||||
|
fputs($sock, "LUSERS\n");
|
||||||
|
|
||||||
|
} elseif ($bits['1'] == "252") {
|
||||||
|
|
||||||
|
// :irc.linuxlounge.net 252 munin-ircd 1 :operator(s) online
|
||||||
|
print "operators.value ".$bits['3']."\n";
|
||||||
|
|
||||||
|
} elseif ($bits['1'] == "254") {
|
||||||
|
|
||||||
|
// :irc.linuxlounge.net 252 munin-ircd 2 :channels formed
|
||||||
|
print "channels.value ".$bits['3']."\n";
|
||||||
|
|
||||||
|
} elseif ($bits['1'] == "255") {
|
||||||
|
|
||||||
|
// :irc.linuxlounge.net 252 munin-ircd :Current Global Users: 4 Max: 8
|
||||||
|
print "clients.value ".$bits['5']."\n";
|
||||||
|
|
||||||
|
// and disconnect
|
||||||
|
fputs($sock, "QUIT :munin-ircd-monitoring\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($sock);
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user