1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-09-18 16:48:44 +00:00

More housecleaning.

Collapse some categories; remove duplicates; move plugins in where
they belong, remove files that are not really plugins at all.
This commit is contained in:
Diego Elio Pettenò 2012-08-06 21:55:44 -07:00
parent 4e3ef5b93e
commit 0a1524f27f
45 changed files with 0 additions and 1337 deletions

View file

@ -1,39 +0,0 @@
#!/bin/sh
# bgpd.sh
#
#
# Created by spleen.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title bgp pfxs'
echo 'graph_args -l 0'
echo 'graph_vlabel PfxRcvd'
echo 'graph_category System'
echo 'graph_scale no'
echo 'graph_info show ip bgp summary'
mfs=0
/usr/local/bin/vtysh -c "sh ip bgp su" | /usr/bin/awk '{ if (( $2 == "4" ) || ( $2 == "6")) print $1 }' | while read i; do
case $i in
*) name=`echo $i | /usr/bin/awk '{ gsub("[^a-zA-Z0-9_]", root_, $1); print $1 }'` ;;
esac
dn=`echo $i | sed 's/_/ /g'`
echo "$name.label $dn"
done
exit 0
fi
/usr/local/bin/vtysh -c "sh ip bgp su" | /usr/bin/awk '{ if (( $2 == "4" ) || ( $2 == "6")) print $1,$10 }' | while read i; do
case $i in
*) name=`echo $i | /usr/bin/awk '{ gsub("[^a-zA-Z0-9_]", root_, $1); print $1 }'` ;;
esac
dn=`echo $i | awk '{print $2}'`
echo "$name.value $dn"
done

View file

@ -1,44 +0,0 @@
#!/bin/bash
#
# Plugin to monitor the number of hosts in /etc/hosts.deny
# that are deined access to sshd
#
# Based on denyhosts plugin by tjansson (2009)
#
# Copyright (C) 2009 Kåre Hartvig Jensen (kaare.hartvig.jensen@gmail.com)
#
# 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, either version 3 of the License, or
# (at your option) any later version.
#
# 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, see <http://www.gnu.org/licenses/>.
#
if [ "$1" = "autoconf" ]; then
if [ -r "$LOG" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Hosts denied sshd access in /etc/hosts.deny'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Hosts denied '
echo 'graph_category system'
echo 'HostsDenied.label Hosts denied'
exit 0
fi
echo HostsDenied.value `cat /etc/hosts.deny | grep sshd | wc -l`

View file

@ -1,27 +0,0 @@
#!/bin/sh
if [ "$1" = "config" ]; then
echo 'graph_title quagga routes'
echo 'graph_args -l 0'
echo 'graph_vlabel routes'
echo 'graph_category System'
echo 'graph_scale no'
/usr/local/bin/vtysh -e "sh ip ro sum" | awk '
/connected/ {print $1 ".label " $1 "\n" $1 ".draw AREASTACK"}
/static/ {print $1 ".label " $1 "\n" $1 ".draw AREASTACK"}
/ebgp/ {print $1 ".label " $1 "\n" $1 ".draw AREASTACK"}
/ibgp/ {print $1 ".label " $1 "\n" $1 ".draw AREASTACK"}
/ospf/ {print $1 ".label " $1 "\n" $1 ".draw AREASTACK"}
/Totals/ {print $1 ".label " $1 "\n" $1 ".draw LINE1"}
'
exit 0
fi
/usr/local/bin/vtysh -e "sh ip ro sum" | awk '
/connected/ {print $1 ".value "$2}
/static/ {print $1 ".value "$2}
/ebgp/ {print $1 ".value "$2}
/ibgp/ {print $1 ".value "$2}
/ospf/ {print $1 ".value "$2}
/Totals/ {print $1 ".value "$2}
'

View file

@ -1,86 +0,0 @@
#!/usr/bin/php
<?php
# Plugin to monitor the number of invalid access to sshd per country
#
# Require read permitions for SYSLOG
# ref) ls -l /var/log/secure
# Require PEAR library Net_GeoIP
# ref) http://pear.php.net/package/Net_GeoIP/redirected
# Require GeoIP-database to find out the geolocation from ip or host
# ref) http://www.maxmind.com/app/geoip_country
#
# Parameters:
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log$
# Revision 1.0 2010/12/23 23:55:01 hirata yoshiyuki
# released.
#
# Magick markers (optional):
#%# family=auto
#%# capabilities=autoconf
#
# config example for /etc/munin/plugin-conf.d/munin-node
#[sshd_invalid_countries]
#user root
#group root
#env.logfile /var/log/secure
#env.geoip /home/you/GeoIP.dat
#env.peardir /usr/share/pear/
require (isset($_SERVER['peardir']) && $_SERVER['peardir'] != '' ? $_SERVER['peardir'] : '') . 'Net/GeoIP.php';
define('SYSLOG', isset($_SERVER['syslog']) && $_SERVER['syslog'] != '' ? $_SERVER['syslog'] : '/var/log/secure');
define('GEOIP_DB', isset($_SERVER['geoip']) && $_SERVER['geoip'] != '' ? $_SERVER['geoip'] : 'GeoIP.dat');
define('AWK_CMD', 'awk \'/sshd\[.*Did not receive identification string/{print $12} ' .
'/sshd\[.*Failed password for (root|ROOT)/{print $11} ' .
'/sshd\[.*Invalid user/{print $10}a\' < ' . SYSLOG);
if (isset($argv[1]) && $argv[1] == 'autoconf') {
$fh = @fopen(SYSLOG, 'r');
if ($fh) {
echo "yes\n";
fclose($fh);
exit(0);
} else {
echo "no\n";
exit(1);
}
}
if (isset($argv[1]) && $argv[1] == 'config') {
echo 'graph_title SSHD invalid countries from ' . SYSLOG . "\n";
echo 'graph_args --base 1000 -l 0' . "\n";
echo 'graph_vlabel number of invalid access per country' . "\n";
echo 'graph_category system' . "\n";
echo 'graph_info This graph shows the countries of invalid access to sshd.' . "\n";
foreach (get_sshd_invalid_countries() as $country => $cnt) {
echo $country . '.label ' . $country . "\n";
}
exit(0);
}
foreach (get_sshd_invalid_countries() as $country => $cnt) {
echo $country . '.value ' . $cnt . "\n";
}
function get_sshd_invalid_countries() {
$countries = array();
exec(AWK_CMD, $wholeips, $ret);
if ($ret != 0) return $countries;
$uniqueips = array_count_values($wholeips);
$GeoIP = Net_GeoIP::getInstance(GEOIP_DB);
foreach ($uniqueips as $ip => $cnt) {
try {
$country = $GeoIP->lookupCountryName($ip);
$countries[$country] = isset($countries[$country]) ? $countries[$country] + $cnt : $cnt;
} catch (Exception $e) {
$countries['Unknown'] = isset($countries['Unknown']) ? $countries['Unknown'] + $cnt : $cnt;
}
}
ksort($countries);
return $countries;
}

View file

@ -1,80 +0,0 @@
#!/usr/local/bin/ruby
# Plugin to monitor the number of invalid access to sshd per country
#
# Require read permitions for SYSLOG
# ref) ls -l /var/log/secure
# Require geoip rubygem
# ref) http://geoip.rubyforge.org/
# Require GeoIP-database for searching ip or host for the country
# ref) http://www.maxmind.com/app/geoip_country
#
# Parameters:
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log$
# Revision 1.0 2010/12/25 11:56:12 hirata yoshiyuki
# released.
#
# Magick markers (optional):
#%# family=auto
#%# capabilities=autoconf
#
# config example for /etc/munin/plugin-conf.d/munin-node
#[sshd_invalid_countries_ruby]
#user root
#group root
#env.logfile /var/log/secure
#env.geoip /home/you/GeoIP.dat
#env.loadpath /usr/local/lib/ruby/gems/1.9.1/gems/geoip-0.8.8/lib/
require (ENV['loadpath'] || '') + 'geoip'
SYSLOG = ENV['syslog'] || '/var/log/secure'
GEOIP_DB = ENV['geoip'] || '/var/www/conf/bbs/GeoIP.dat'
AWK_CMD = 'awk \'/sshd\[.*Did not receive identification string/{print $12} ' +
'/sshd\[.*Failed password for (root|ROOT)/{print $11} ' +
'/sshd\[.*Invalid user/{print $10}a\' < ' + SYSLOG
def getInvalids
c={}
wholeips = `#{AWK_CMD}`.split("\n")
uniqueips = wholeips.inject({}) do |hash, key|
hash.include?(key) ? hash[key] += 1 : hash[key] = 1;
hash
end
geoip = GeoIP.new(GEOIP_DB)
uniqueips.each do |ip,cnt|
begin
country = geoip.country(ip)[5]
c[country] = c[country] ? c[country] + cnt : cnt
rescue
c['Unknown'] = c['Unknown'] ? c['Unknown'] + cnt : cnt
end
end
c = c.to_a.sort {|a,b| a[0] <=> b[0]}
c
end
case ARGV[0]
when 'autoconf'
begin
fh = open(SYSLOG, 'r')
rescue
puts 'no'
exit 1
else
puts 'yes'
exit 0
end
when 'config'
puts 'graph_title SSHD invalid countries from ' + SYSLOG
puts 'graph_args --base 1000 -l 0'
puts 'graph_vlabel number of invalid access per country'
puts 'graph_category system'
puts 'graph_info This graph shows the countries of invalid access to sshd.'
getInvalids.each {|k,v| puts k + '.label ' + k}
exit 0
else
getInvalids.each {|k,v| puts k + '.value ' + v.to_s}
end