#!/bin/sh # -*- coding: utf-8 -*- # Copyright (C) 2009 Michel Blockelet # This file 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 2 of the License, or # (at your option) any later version. # # This file 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, write to the Free Software # Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. ### Plugin munin de comptabilisation des connexions ## Configuration if [ "$1" = "config" ]; then echo 'host_name news.crans.org' echo 'graph_title Connexions par minute' echo "graph_args --base 1000 --lower-limit 0" echo "graph_vlabel connexions" echo "graph_period minute" echo "graph_category News" echo "graph_info Affiche le nombre de connexions par minute à InnD." echo "connects.label Total" echo "connects.type DERIVE" echo "crans.label crans" echo "crans.type DERIVE" echo "crans.draw AREA" echo "ext.label exterieur" echo "ext.type DERIVE" echo "ext.draw STACK" exit 0 fi TMPFILE=/tmp/munin_innd_connects_grep ## Sortie # Bon, ça fera une valeur négative (ramenée à 0 par le --lower-limit) # à chaque rotation des logs, mais bon ... egrep "connect$" /var/log/news/news.notice > $TMPFILE echo -n "connects.value " cat $TMPFILE | wc -l echo -n "crans.value " cat $TMPFILE | egrep '\.crans\.org \(138\.231.*\) connect$' | wc -l echo -n "ext.value " cat $TMPFILE | egrep -v '\.crans\.org \(138\.231.*\) connect$' | wc -l rm -f $TMPFILE &> /dev/null