Commit 909d374f authored by Daniel Stan's avatar Daniel Stan

[munin/wifi_auth] on centralise sur thot

Comme ça on a les contenus de gordon et eap en même temps.
NB: j'ai déplacé le plugin hors du repo wifi_new
parent 4ae7ea0e
......@@ -73,13 +73,12 @@ hosts_plugins = {
"bind9_rndc": "/usr/share/munin/plugins/bind9_rndc",
},
"gordon": {
"wifi_clients": "/usr/scripts/wifi_new/munin.py",
"ap_states": "/usr/scripts/wifi_new/munin.py",
"wifi_auth": "/usr/scripts/wifi_new/munin_auth",
"bind9_rndc": "/usr/share/munin/plugins/bind9_rndc"
},
"eap": {
"wifi_auth": "/usr/scripts/wifi_new/munin_auth",
"thot": {
"wifi_auth": "wifi_auth",
},
"xmpp": {
"jabber": "jabber",
......
#!/bin/sh
# -*- sh -*-
mktempfile () {
#cmd=`echo $MUNIN_MKTEMP | sed s/\\$1/$1/`
#$cmd
touch /tmp/$1
echo /tmp/$1
}
FREERADIUS_LOG=${freeradiuslog:-/var/log/wifi_auth.log}
LOGTAIL=${logtail:-/usr/sbin/logtail}
MUNIN_PLUGSTATE=${MUNIN_PLUGSTATE:-/var/lib/munin/plugin-state/}
STATEFILE=$MUNIN_PLUGSTATE/wifi_auth.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${FREERADIUS_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 0
fi
fi
# Try tailing a random file to check how arguments are passed
ARGS=0
`$LOGTAIL /etc/hosts 2>/dev/null >/dev/null`
if [ $? = 66 ]; then
if [ ! -n "$logtail" ]; then
ARGS=1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Authentifications WiFi'
echo 'graph_vlabel Auth'
echo 'graph_category wifi'
echo 'failures.label Échecs'
echo 'failures.draw AREASTACK'
echo 'failures.colour FF0000'
echo 'success.label Succès'
echo 'success.draw AREASTACK'
echo 'success.colour 00FF00'
exit 0
fi
success=U
failures=U
TEMP_FILE=$(mktempfile munin-radius-wifi.XXXXXX)
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
if [ $ARGS != 0 ]; then
$LOGTAIL -f ${FREERADIUS_LOG} -o ${STATEFILE} | grep 'freeradius\[.*\]:' > ${TEMP_FILE}
else
$LOGTAIL ${FREERADIUS_LOG} ${STATEFILE} | grep 'freeradius\[.*\]:' > ${TEMP_FILE}
fi
success=$(grep -c 'Login OK' ${TEMP_FILE})
failures=$(grep -c 'Login incorrect' ${TEMP_FILE})
/bin/rm -f $TEMP_FILE
fi
echo "success.value ${success}"
echo "failures.value ${failures}"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment