Skip to content

Instantly share code, notes, and snippets.

@schwindp
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schwindp/eee031da86bcb065df35 to your computer and use it in GitHub Desktop.
Save schwindp/eee031da86bcb065df35 to your computer and use it in GitHub Desktop.
munin-plugin for (maybe) some useful ejabberd statistics
#!/bin/sh
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title jabber.ccc.de'
echo 'graph_args -l 0'
echo 'graph_vlabel Users'
echo 'graph_category jabber'
# echo 'r.draw AREA'
# echo 'r.colour 00ff00'
echo 'r.label Registrierte Accounts'
echo 'o.label Online'
echo 'a.label Aktiv in den letzten 24 Stunden'
# echo 'a.colour ff0000'
echo 'a30.label Aktiv in den letzten 30 Tagen'
# echo 'a30.colour 999900'
echo 'old.label Inaktiv seit mehr als einem Jahr'
echo 'old.draw LINE2'
echo 'old.colour ff0000'
exit 0
fi
echo -n "r.value " ; mysql -B -u -e 'select count(*) from users'|tail -1
echo -n "o.value " ; /usr/sbin/ejabberdctl stats onlineusers
echo -n "a.value " ; mysql -B -u -e 'select count(*) from last where seconds > UNIX_TIMESTAMP(DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY) )'|tail -1
echo -n "a30.value " ; mysql -B -u -e 'select count(*) from last where seconds > UNIX_TIMESTAMP(DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY ) )'|tail -1
echo -n "old.value " ; mysql -B -u -e 'select count(*) from last where seconds < UNIX_TIMESTAMP(DATE_SUB(CURRENT_DATE(), INTERVAL 365 DAY ) )'|tail -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment