import pystemon-feeder configuration from the central configuration file

pull/102/head
Olivier MEDOC 2017-01-10 18:18:55 +01:00 committed by Olivier Medoc
parent 8102ff009d
commit 83db40104c
1 changed files with 14 additions and 3 deletions

View File

@ -24,13 +24,24 @@ import sys
import time
import redis
import base64
import os
import ConfigParser
port = "5556"
pystemonpath = "/home/pystemon/pystemon/"
configfile = os.path.join(os.environ['AIL_BIN'], 'packages/config.cfg')
if not os.path.exists(configfile):
raise Exception('Unable to find the configuration file. \
Did you set environment variables? \
Or activate the virtualenv.')
cfg = ConfigParser.ConfigParser()
cfg.read(configfile)
zmq_url = cfg.get("ZMQ_Global", "address")
pystemonpath = cfg.get("Directories", "pystemonpath")
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:%s" % port)
socket.bind(zmq_url)
# check https://github.com/cvandeplas/pystemon/blob/master/pystemon.yaml#L16
r = redis.StrictRedis(host='localhost', db=10)