diff --git a/plugin_test/boswatch.py b/plugin_test/boswatch.py index 13ecf60..d28ec7a 100644 --- a/plugin_test/boswatch.py +++ b/plugin_test/boswatch.py @@ -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: diff --git a/plugin_test/config/config.ini b/plugin_test/config/config.ini index d4dedb4..5c7d780 100644 --- a/plugin_test/config/config.ini +++ b/plugin_test/config/config.ini @@ -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 diff --git a/plugin_test/plugins/MySQL/MySQL.py b/plugin_test/plugins/MySQL/MySQL.py new file mode 100644 index 0000000..356e6ae --- /dev/null +++ b/plugin_test/plugins/MySQL/MySQL.py @@ -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") \ No newline at end of file