changeset 466:1122016d16eb

stats handler, events output fix, build updaets Ignore-this: 3f2d695e0e49e8be8084017de08b0539
author drewp@bigasterisk.com
date Sat, 20 Apr 2019 23:40:29 -0700
parents 003343daeb62
children 56af0ca2db10
files service/piNode/makefile service/piNode/piNode.py service/piNode/requirements.txt
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/service/piNode/makefile	Sat Apr 20 23:39:45 2019 -0700
+++ b/service/piNode/makefile	Sat Apr 20 23:40:29 2019 -0700
@@ -15,3 +15,6 @@
 
 push_config:
 	docker run -it --net=host -v `pwd`/config:/opt/config bang6:5000/arduino_node python pushConfig.py pi/
+
+redeploy: build_image
+	sudo /my/proj/ansible/playbook -l pi -t raspi_io_node
--- a/service/piNode/piNode.py	Sat Apr 20 23:39:45 2019 -0700
+++ b/service/piNode/piNode.py	Sat Apr 20 23:40:29 2019 -0700
@@ -8,6 +8,8 @@
 from twisted.internet.threads import deferToThread
 from docopt import docopt
 import etcd3
+from greplin import scales
+from greplin.scales.cyclonehandler import StatsHandler
 
 logging.basicConfig(level=logging.DEBUG)
 
@@ -37,6 +39,8 @@
 hostname = socket.gethostname()
 CTX = ROOM['pi/%s' % hostname]
 
+STATS = scales.collection('/root',
+)
 def patchRandid():
     """
     I'm concerned urandom is slow on raspberry pi, and I'm adding to
@@ -306,12 +310,13 @@
         (r"/()", cyclone.web.StaticFileHandler, {
             "path": "static", "default_filename": "index.html"}),
         (r'/static/(.*)', cyclone.web.StaticFileHandler, {"path": "static"}),
+        (r'/stats/(.*)', StatsHandler, {'serverName': 'piNode'}),
         (r'/boards', Boards),
         (r"/graph", CycloneGraphHandler, {'masterGraph': masterGraph}),
         (r"/graph/events", CycloneGraphEventsHandler, {'masterGraph': masterGraph}),
         (r'/output', OutputPage),
         (r'/dot', Dot),
-        ], config=config, debug=arg['-v']), interface='::')
+    ], config=config, debug=arg['-v']), interface='::')
     log.warn('serving on 9059')
     reactor.run()
 
--- a/service/piNode/requirements.txt	Sat Apr 20 23:39:45 2019 -0700
+++ b/service/piNode/requirements.txt	Sat Apr 20 23:40:29 2019 -0700
@@ -15,5 +15,6 @@
 numpy
 pillow
 imageio==2.2.0
-https://projects.bigasterisk.com/rdfdb/rdfdb-0.3.0.tar.gz
+https://projects.bigasterisk.com/rdfdb/rdfdb-0.8.0.tar.gz
 etcd3==0.8.1
+git+http://github.com/drewp/scales.git@448d59fb491b7631877528e7695a93553bfaaa93#egg=scales