forked from mobiletulip/munin-kannel-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kannel_sms_throughput
executable file
·40 lines (32 loc) · 1006 Bytes
/
kannel_sms_throughput
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
#!/usr/bin/env python
import urllib2
from xml.etree.ElementTree import XML
import sys
import os
import kannel_util
def make_names(id, admin_id):
return (admin_id or id,
"%s / %s" % (id, admin_id) if admin_id and admin_id != id else id)
def print_config():
print "graph_order in out"
print "graph_title Kannel SMS throughput (total)"
print "graph_vlabel messages received (-) / sent (+) per ${graph_period}"
print "graph_category kannel"
print "graph_info This graph shows inbound and outbound SMS throughput"
print "in.label SMS rate (in)"
print "in.type DERIVE"
print "in.graph no"
print "in.min 0"
print "out.label SMS rate"
print "out.type DERIVE"
print "out.negative in"
print "out.min 0"
def print_data():
status = kannel_util.get_status()
print "in.value " + str(status['sms']['received']['total'])
print "out.value " + str(status['sms']['sent']['total'])
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "config":
print_config()
else:
print_data()