coova / coova-chilli

CoovaChilli is an open-source software access controller for captive portal hotspots.
Other
516 stars 258 forks source link

Collectd statistics #278

Open jobezic opened 8 years ago

jobezic commented 8 years ago

Add collectd statistics (to enable with an option in config) for users in pass, dnat in real time.

nzamps commented 7 years ago

Out of interest we have a collectd script that looks a bit like this:

#!/bin/sh

HOSTNAME="${COLLECTD_HOSTNAME:-`hostname`}"
INTERVAL="${COLLECTD_INTERVAL:-10}"

while sleep "$INTERVAL"
do

for f in /var/run/chilli.*.sock;
do 

    tap=$(chilli_query -s $f route | grep dev: | awk  '{print $4}')
    connected_clients=$(chilli_query -s $f list | wc -l)
    current_sessions=$(chilli_query -s $f list | grep pass | wc -l)

    echo "PUTVAL \"$HOSTNAME/coovachilli-$tap/current_connections\" interval=$INTERVAL N:$connected_clients"
    echo "PUTVAL \"$HOSTNAME/coovachilli-$tap/current_sessions\" interval=$INTERVAL N:$current_sessions"

done
done
alex-eri commented 7 years ago

snmpd plugin will be good for it