summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/daq/flumotion-rrd/flumotion-rrd.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/daq/flumotion-rrd/flumotion-rrd.py b/src/daq/flumotion-rrd/flumotion-rrd.py
index 7306074..54a0c97 100755
--- a/src/daq/flumotion-rrd/flumotion-rrd.py
+++ b/src/daq/flumotion-rrd/flumotion-rrd.py
@@ -36,6 +36,7 @@ from twisted.python import log
from socket import error as socket_error
import simplejson as json
import datetime
+import argparse
_MAX_PACKET_SIZE = 8192 # in bytes
@@ -116,7 +117,6 @@ class FlumotionRRD():
"duration-ms": duration * 1000,
"data": {
"client-count": client_count,
- "bytes-received": bytes_received,
"bytes-sent": bytes_sent
}
}
@@ -124,14 +124,27 @@ class FlumotionRRD():
+
if __name__ == '__main__':
- importer = FlumotionRRD({ 'socket': '/tmp/sfive.sock',
- 'hostname': 'localhost',
- 'content-id': 'av',
- 'format': 'webm',
- 'quality': 'high',
- 'tags': [ 'elevate', '2013' ],
- 'bytes-rrdfile': '/tmp/av-webm-high_bytes.rrd',
- 'clients-rrdfile': '/tmp/av-webm-high_clients.rrd',
- })
+ parser = argparse.ArgumentParser(description='SFive Flumotion RRD Importer')
+ parser.add_argument('--socket', '-s', dest='socket', required=True,
+ help='the path to the data socket of the local SFive hub')
+ parser.add_argument('--hostname', '-n', dest='hostname', required=True,
+ help='the hostname of the machine')
+ parser.add_argument('--content-id', '-c', dest='content-id', required=True,
+ help='the content-id (i.e. av)')
+ parser.add_argument('--format', '-f', dest='format', required=True,
+ help='the format (i.e. webm)')
+ parser.add_argument('--quality', '-q', dest='quality', required=True,
+ help='the quality (i.e. high)')
+ parser.add_argument('--tag', '-t', dest='tags', action='append',
+ help='tag to be added to the statistic data, can be invoked several times')
+ parser.add_argument('--bytes-rrdfile', '-b', dest='bytes-rrdfile', required=True,
+ help='path to the RRD File containing the bytes sent')
+ parser.add_argument('--clients-rrdfile', '-N', dest='clients-rrdfile', required=True,
+ help='path to the RRD File containing the number of clients')
+ args = vars(parser.parse_args())
+ if not args['tags']:
+ args['tags'] = []
+ importer = FlumotionRRD(args)
importer.run()