mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Reduce number of categories, move "other" plugins
This commit is contained in:
parent
99542938b1
commit
c0568802bf
16 changed files with 8 additions and 5 deletions
|
@ -1,71 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# vim:syntax=python
|
||||
#
|
||||
# Plugin to monitor the amount of packages in an approx cache.
|
||||
#
|
||||
# Usage: place in /etc/munin/plugins/ (or link it there using ln -s)
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# Magic markers - optional - used by installation scripts and
|
||||
# munin-config:
|
||||
#
|
||||
#%# family=manual
|
||||
#%# capabilities=autoconf
|
||||
#
|
||||
# Now for the real work...
|
||||
|
||||
from sys import argv, exit
|
||||
from os.path import walk, exists, isfile, join
|
||||
|
||||
def get_file_types():
|
||||
"""Returns an array of filetype => count."""
|
||||
|
||||
out = {}
|
||||
|
||||
def visitor(arg, dirname, names):
|
||||
for file in names:
|
||||
if not isfile(join(dirname, file)):
|
||||
continue
|
||||
ext = file.split(".")[-1]
|
||||
|
||||
out[ext] = out.get(ext, 0) + 1
|
||||
|
||||
walk('/var/cache/approx/', visitor, None)
|
||||
|
||||
return out
|
||||
|
||||
|
||||
# Autoconfiguration
|
||||
if len(argv) > 1:
|
||||
|
||||
if argv[1] == "autoconf":
|
||||
# Test if we can find a approx cache
|
||||
if exists('/var/cache/approx'):
|
||||
print "yes"
|
||||
else:
|
||||
print "no ('/var/cacne/approx' not found)"
|
||||
exit(1)
|
||||
exit()
|
||||
|
||||
elif argv[1] == "config":
|
||||
print "graph_title Approx cache";
|
||||
print "graph yes";
|
||||
#print "graph_category Other";
|
||||
#print "graph_total Total";
|
||||
print "graph_info Statistics from the Approx cache.";
|
||||
#print "debs.label DEBs";
|
||||
#print "pending.warning 0:0";
|
||||
#print "hold.label hold";
|
||||
for type in get_file_types().keys():
|
||||
print "%s.label %s" % (type.lower(), type)
|
||||
exit()
|
||||
|
||||
for type, count in get_file_types().iteritems():
|
||||
print "%s.value %d" % (type.lower(), count)
|
||||
|
||||
exit()
|
|
@ -1,66 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script to show number of logins, errors and failed logins in horde3
|
||||
#
|
||||
#
|
||||
# by Patrick Z.
|
||||
# Comments and improvements can be sent to (admin<AT>tournament'dot'DE)
|
||||
#
|
||||
# possible problems:
|
||||
# - horde3.log isn't readable by user munin (see
|
||||
# /var/log/munin/munin-node.log for errors)
|
||||
#
|
||||
# -to solve, copy this in /etc/munin/plugin-conf.d/munin-node
|
||||
# [horde3]
|
||||
# user root
|
||||
#
|
||||
#
|
||||
# formely known as postfix_mail_stats by:
|
||||
# Boudewijn Ector, for Boudewijn Ector IT.
|
||||
# Loosely based on http://munin.projects.linpro.no/attachment/wiki/PluginCat/postfix_messages_hourly.txt
|
||||
#
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and installation
|
||||
# scripts):
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
LOGFILE=/var/log/horde/horde3.log
|
||||
DATE=`date '+%b %d %H'`
|
||||
MAXLABEL=20
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title horde3'
|
||||
echo 'graph_info This graph shows Horde3 logins, logouts and errors.'
|
||||
echo 'graph_vlabel per hour'
|
||||
echo 'logins.label logins'
|
||||
echo 'failedlogins.label failed logins'
|
||||
echo 'allerrors.label errors'
|
||||
echo 'logouts.label logouts'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -en "logins.value "
|
||||
echo $(grep "Login success for" $LOGFILE | grep "$DATE" | wc -l)
|
||||
echo -n
|
||||
echo -en "failedlogins.value "
|
||||
echo $(grep "FAILED LOGIN" $LOGFILE | grep "$DATE" | wc -l)
|
||||
echo -en "allerrors.value "
|
||||
echo $(grep "error" $LOGFILE | grep "$DATE" | wc -l)
|
||||
echo -en "logouts.value "
|
||||
echo $(grep "Logout for" $LOGFILE | grep "$DATE" | wc -l)
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Version 0.1 alpha (a.k.a. it has been known to work at least once)
|
||||
# Get stats from your i2p server ( https://geti2p.net/en/ )
|
||||
# Create links to this plugin and name them
|
||||
# - i2p_bps
|
||||
# - i2p_uptime (not implemented yet)
|
||||
# Requires BeautifulSoup 4
|
||||
|
||||
# Should probably use I2PControl for this instead
|
||||
# https://geti2p.net/en/docs/api/i2pcontrol
|
||||
|
||||
import urllib2, re, os, sys
|
||||
from bs4 import BeautifulSoup
|
||||
from decimal import *
|
||||
|
||||
plugin_name=list(os.path.split(sys.argv[0]))[1]
|
||||
plugin_var=plugin_name.split('_', 1)[-1]
|
||||
|
||||
def autoconf():
|
||||
print('yes')
|
||||
sys.exit(0)
|
||||
|
||||
def config():
|
||||
if 'bps' == plugin_var:
|
||||
print('graph_title i2p bps')
|
||||
print('graph_vlabel bps')
|
||||
print('graph_info i2p sending and receiving bytes per second')
|
||||
print('graph_category network')
|
||||
print('receivebps.label Receive bps')
|
||||
print('sendbps.label Send bps')
|
||||
elif 'uptime' == plugin_var:
|
||||
print('graph_title i2p uptime')
|
||||
print('graph_scale no')
|
||||
print('graph_args --base 1000 -l 0')
|
||||
print('graph_vlabel uptime in whole hours')
|
||||
print('graph_category network')
|
||||
print('uptime.label i2p uptime')
|
||||
print('uptime.draw AREA')
|
||||
else:
|
||||
raise ValueError, "unknown parameter '%s'" % plugin_var
|
||||
sys.exit(0)
|
||||
|
||||
def fetch():
|
||||
html_doc = urllib2.urlopen('http://127.0.0.1:7657/stats').read()
|
||||
soup = BeautifulSoup(html_doc)
|
||||
if 'bps' == plugin_var:
|
||||
fetch_bps(soup)
|
||||
elif 'uptime' == plugin_var:
|
||||
fetch_uptime(soup)
|
||||
else:
|
||||
raise ValueError, "unknown parameter '%s'" % plugin_var
|
||||
|
||||
def fetch_bps(soup):
|
||||
anchor_bwreceiveBps = soup.find('a', attrs={"name": "bw.receiveBps"})
|
||||
b_5min_bwreceiveBps = anchor_bwreceiveBps.find_all_next('b', limit=2)[1]
|
||||
bwreceiveBps = Decimal(re.search('Average: ([0-9,\.]+?);', b_5min_bwreceiveBps.parent.get_text()).group(1).replace(',', ''))
|
||||
anchor_bwsendBps = soup.find('a', attrs={"name": "bw.sendBps"})
|
||||
b_5min_bwsendBps = anchor_bwsendBps.find_all_next('b', limit=2)[1]
|
||||
bwsendBps = Decimal(re.search('Average: ([0-9,\.]+?);', b_5min_bwsendBps.parent.get_text()).group(1).replace(',', ''))
|
||||
print('receivebps.value %s' % bwreceiveBps)
|
||||
print('sendbps.value %s' % bwsendBps)
|
||||
sys.exit(0)
|
||||
|
||||
def fetch_uptime(soup):
|
||||
# not implemented yet
|
||||
print('uptime.value U')
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv)>1 :
|
||||
if sys.argv[1]=="config" :
|
||||
config()
|
||||
elif sys.argv[1]=="autoconf" :
|
||||
autoconf()
|
||||
elif sys.argv[1]!="":
|
||||
raise ValueError, "unknown parameter '%s'" % sys.argv[1]
|
||||
fetch()
|
|
@ -116,3 +116,5 @@ run_() {
|
|||
# plugin entry point:
|
||||
run_$1
|
||||
|
||||
# for Munin Plugin Gallery
|
||||
# graph_category streaming
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor auth.log for sshd server events.
|
||||
#
|
||||
# Require read permitions for $LOG
|
||||
# (set in /etc/munin/plugin-conf.d/munin-node on debian)
|
||||
# On busy servers you can change value type to COUNTER and set min to 0 to avoid minus peaks at logrotate
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.2 2010/03/19 15:03:00 pmoranga
|
||||
# Revision 1.1 2009/04/26 23:28:00 ckujau
|
||||
# Revision 1.0 2009/04/22 22:00:00 zlati
|
||||
# Initial revision
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# Magick markers (optional):
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
# config example for /etc/munin/plugin-conf.d/munin-node
|
||||
#[sshd_log]
|
||||
#user root
|
||||
#group root
|
||||
#env.logfile /var/log/messages
|
||||
#env.category users
|
||||
#
|
||||
|
||||
LOG=${logfile:-/var/log/secure}
|
||||
CATEGORY=${category:-system}
|
||||
|
||||
|
||||
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 SSHD login stats from' $LOG
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel logins'
|
||||
echo 'graph_category' $CATEGORY
|
||||
|
||||
echo 'LogPass.label Successful password logins'
|
||||
echo 'LogPassPAM.label Successful login via PAM'
|
||||
echo 'LogKey.label Successful PublicKey logins'
|
||||
echo 'NoID.label No identification from user'
|
||||
echo 'rootAttempt.label Root login attempts'
|
||||
echo 'InvUsr.label Invalid user login attepmts'
|
||||
echo 'NoRDNS.label No reverse DNS for peer'
|
||||
echo 'Breakin.label Potential Breakin Attempts'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
awk 'BEGIN{c["LogPass"]=0;c["LogKey"]=0;c["NoID"]=0;c["rootAttempt"]=0;c["InvUsr"]=0;c["LogPassPAM"]=0;c["Breakin"]=0;c["NoRDNS"]=0; }
|
||||
/sshd\[.*Accepted password for/{c["LogPass"]++}
|
||||
/sshd\[.*Accepted publickey for/{c["LogKey"]++}
|
||||
/sshd\[.*Did not receive identification string/{c["NoID"]++}
|
||||
/sshd\[.*Failed password for root/{c["rootAttempt"]++}
|
||||
/sshd\[.*Invalid user/{c["InvUsr"]++}
|
||||
/sshd\[.*POSSIBLE BREAK-IN ATTEMPT!/{c["Breakin"]++}
|
||||
/sshd\[.*keyboard-interactive\/pam/{c["LogPassPAM"]++}
|
||||
/sshd\[.*reverse mapping checking getaddrinfo/{c["NoRDNS"]++}a
|
||||
END{for(i in c){print i".value " c[i]} }' < $LOG
|
Loading…
Add table
Add a link
Reference in a new issue