mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-21 07:40:18 +01:00
prepare for mysql plugin
This commit is contained in:
parent
80c0573098
commit
af3e371df6
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
31
plugin_test/plugins/MySQL/MySQL.py
Normal file
31
plugin_test/plugins/MySQL/MySQL.py
Normal 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")
|
||||
Loading…
Reference in a new issue