mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 18:07:20 +00:00
added tinychat plugin
This commit is contained in:
parent
c9ab85cccf
commit
c6e8f02928
1 changed files with 49 additions and 0 deletions
49
plugins/chat/tinychat_users_
Executable file
49
plugins/chat/tinychat_users_
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh
|
||||
#########################
|
||||
# tinychat_users_
|
||||
#########################
|
||||
# Munin Plugin to monitor the number of users a tinychat room gets.
|
||||
# Author Phil Wray ( http://www.infjs.com )
|
||||
#
|
||||
# Usage:
|
||||
# ln -s /usr/share/munin/plugins/tinychat_users_ /etc/munin/plugins/tinychat_users_your-room
|
||||
#
|
||||
# Get the Tinychat Room by parsing this scripts filename.
|
||||
room=${0##*tinychat_users_}
|
||||
|
||||
##
|
||||
# autoconf
|
||||
##
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
# Check that curl is installed
|
||||
if hash curl &>/dev/null; then
|
||||
echo "yes"
|
||||
else
|
||||
echo "no (no curl installed)"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
##
|
||||
# config
|
||||
##
|
||||
if [ "$1" = "config" ]; then
|
||||
echo "graph_title Tinychat Users for $room"
|
||||
echo 'graph_vlabel Room Users'
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_vlabel Room Users'
|
||||
echo 'graph_category misc'
|
||||
echo 'total_count.label Room Users'
|
||||
echo 'total_count.draw AREA'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
##
|
||||
# Main
|
||||
##
|
||||
# Get current Room Users.
|
||||
tinychat_users=$(curl -s http://api.tinychat.com/${room}.json | grep -Eo 'total_count":[0-9]+' | cut -d':' -f2)
|
||||
|
||||
# Output Room Users.
|
||||
echo "total_count.value $tinychat_users"
|
Loading…
Add table
Add a link
Reference in a new issue