mirror of https://github.com/CIRCL/AIL-framework
import pystemon-feeder configuration from the central configuration file
parent
8102ff009d
commit
83db40104c
|
@ -24,13 +24,24 @@ import sys
|
||||||
import time
|
import time
|
||||||
import redis
|
import redis
|
||||||
import base64
|
import base64
|
||||||
|
import os
|
||||||
|
import ConfigParser
|
||||||
|
|
||||||
port = "5556"
|
configfile = os.path.join(os.environ['AIL_BIN'], 'packages/config.cfg')
|
||||||
pystemonpath = "/home/pystemon/pystemon/"
|
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()
|
context = zmq.Context()
|
||||||
socket = context.socket(zmq.PUB)
|
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
|
# check https://github.com/cvandeplas/pystemon/blob/master/pystemon.yaml#L16
|
||||||
r = redis.StrictRedis(host='localhost', db=10)
|
r = redis.StrictRedis(host='localhost', db=10)
|
||||||
|
|
Loading…
Reference in New Issue