prepare for mysql plugin

This commit is contained in:
Schrolli 2015-05-20 10:38:21 +02:00
parent 80c0573098
commit af3e371df6
3 changed files with 47 additions and 2 deletions

View file

@ -39,9 +39,9 @@ logger.addHandler(ch)
def throwAlarm(typ,data):
for i in pluginloader.getPlugins():
plugin = pluginloader.loadPlugin(i)
logging.debug(i["name"] + " Plugin called")
logging.debug("call Plugin: %s", i["name"])
plugin.run(typ,"0",data)
# Programm
try:

View file

@ -18,12 +18,26 @@ poc_filter_range_end = 9999999
#can take on or off the plugins (0|1)
[Plugins]
MySQL = 0
BosMon = 0
# for developing template-module is enabled
template = 1
#none has no function, only demo
none = 1
[MySQL]
dbserver = localhost
dbuser = root
dbpassword = root
database = boswatch
#tables in the database
tableFMS = bos_fms
tableZVEI = bos_zvei
tablePOC = bos_pocsag
[BosMon]
#Server as IP of DNS-Name (without http://)
#actually no ssl supported

View file

@ -0,0 +1,31 @@
#!/usr/bin/python
# -*- coding: cp1252 -*-
import logging # Global logger
import globals # Global variables
def run(typ,freq,data):
try:
#ConfigParser
logging.debug("reading config file")
try:
config = dict(globals.config.items("MySQL"))
for key,val in config.items():
logging.debug(" - %s = %s", key, val)
except:
logging.exception("cannot read config file")
if typ == "FMS":
#logging.debug("FMS: %s Status: %s Dir: %s", data["fms"], data["status"], data["direction"])
logging.debug("FMS")
elif typ == "ZVEI":
#logging.debug("ZVEI: %s", data["zvei"])
logging.debug("ZVEI")
elif typ == "POC":
#logging.debug("POC: %s/%s - %s", data["ric"], data["function"], data["msg"])
logging.debug("POC")
else:
logging.warning(typ + " not supportet")
except:
logging.exception("unknown error")