Projet

Général

Profil

Révision c6e8f029

IDc6e8f02928bc26eaf6fbe6a9d117ac5ee8fb954e
Parent c9ab85cc
Enfant 74ee8b7b

Ajouté par Deathjam il y a environ 12 ans

added tinychat plugin

Voir les différences:

plugins/chat/tinychat_users_
1
#!/bin/sh
2
#########################
3
# tinychat_users_
4
#########################
5
# Munin Plugin to monitor the number of users a tinychat room gets.
6
# Author Phil Wray ( http://www.infjs.com )
7
#
8
# Usage:
9
# 	ln -s /usr/share/munin/plugins/tinychat_users_ /etc/munin/plugins/tinychat_users_your-room
10
#
11
# Get the Tinychat Room by parsing this scripts filename.
12
room=${0##*tinychat_users_}
13

  
14
##
15
# autoconf
16
##
17
if [ "$1" = "autoconf" ]; then
18
    # Check that curl is installed
19
    if hash curl &>/dev/null; then
20
echo "yes"
21
    else
22
echo "no (no curl installed)"
23
    fi
24
exit 0
25
fi
26

  
27
##
28
# config
29
##
30
if [ "$1" = "config" ]; then
31
echo "graph_title Tinychat Users for $room"
32
    echo 'graph_vlabel Room Users'
33
    echo 'graph_args --base 1000'
34
    echo 'graph_scale no'
35
    echo 'graph_vlabel Room Users'
36
    echo 'graph_category misc'
37
    echo 'total_count.label Room Users'
38
    echo 'total_count.draw AREA'
39
    exit 0
40
fi
41

  
42
##
43
# Main
44
##
45
# Get current Room Users.
46
tinychat_users=$(curl -s http://api.tinychat.com/${room}.json | grep -Eo 'total_count":[0-9]+' | cut -d':' -f2)
47

  
48
# Output Room Users.
49
echo "total_count.value $tinychat_users"

Formats disponibles : Unified diff