Browse Source

dashing: push status data

Helge Jung 9 years ago
parent
commit
d8d501c066
1 changed files with 16 additions and 2 deletions
  1. 16 2
      ffstatus/dashing.py

+ 16 - 2
ffstatus/dashing.py

@@ -1,10 +1,12 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 
+from .basestorage import BaseStorage
 import json
 import logging
 import requests
 
+
 class DashingClient:
     base_url = None
 
@@ -29,8 +31,20 @@ class DashingClient:
         self.logger.debug('Sent metric "{0}" = "{1}"'.format(metric, current))
         return resp
 
-    def push(self, data):
-        self.logger.warn('push() not implemented yet')
+    def push(self, storage):
+        if not isinstance(storage, BaseStorage):
+            self.logger.error('Mimimi, storage is not a BaseStorage.')
+            return
+
+        status = storage.status
+
+        # {akt,max}{Knoten,Client}count
+        self.send('aktKnotencount', status['nodes_active'])
+        self.send('aktClientcount', status['clients_unique'])
+
+        # aktTraffic (mit Historie ?!)
+        # evtl. Liste der letzten Knoten, die dazukamen
+
 
 if __name__ == "__main__":
     client = DashingClient(