-
Notifications
You must be signed in to change notification settings - Fork 0
/
civicboom_members
executable file
·65 lines (45 loc) · 1.24 KB
/
civicboom_members
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
"""
=head1 NAME
civicboom_members - Plugin to monitor civicboom
=head1 CONFIGURATION
No configuration
=head1 NOTES
=head1 AUTHOR
Shish <shish@civicboom.com>
=head1 LICENSE
BSD
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
"""
import urllib2
import sys
import json
if len(sys.argv) > 1 and sys.argv[1] == "autoconf":
if urllib2.urlopen("https://www.civicboom.com/misc/stats.json").read():
print("yes")
else:
print("no")
sys.exit(0)
if len(sys.argv) > 1 and sys.argv[1] == "config":
print('graph_title Civicboom Members')
#print('graph_args --base 1000 -l 0')
print('graph_vlabel Members')
print('graph_category civicboom')
print('users.label Users')
print('users.type GAUGE')
print('groups.label Groups')
print('groups.type GAUGE')
print('pending.label Pending')
print('pending.type GAUGE')
sys.exit(0)
data = urllib2.urlopen("https://www.civicboom.com/misc/stats.json").read()
d = json.loads(data)
if d['status'] == "ok":
print("users.value %d" % (d['data']['users'],))
print("groups.value %d" % (d['data']['groups'], ))
print("pending.value %d" % (d['data']['pending'], ))
else:
print("Error")
print(d['message'])