From d28dfa951bfb113209d616d4be7417b5f3a6bb8c Mon Sep 17 00:00:00 2001 From: Schrolli Date: Tue, 30 Jun 2015 12:26:27 +0200 Subject: [PATCH] edit MySQL plugin - save all given information from data[ ] into MySQL database --- README.md | 3 ++- plugins/MySQL/MySQL.py | 10 +++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1e69290..b95340f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ unless you are developer you can use the develop-Branch - may be unstable! ##### Implemented features: - FMS, ZVEI and POCSAG512/1200/2400 decoding and displaying - Plugin support for easy functional extension -- Filtering double alarms with adjustable time +- Filtering double alarms with adjustable time and check width - Filtering allowed, denied and range of POCSAG RIC“s - Filtering data for each typ/plugin combination with RegEX - All configurations in a seperate config file @@ -118,6 +118,7 @@ In case of an error during the installation, check the logfile in `~/boswatch/in Caution, script don't install a webserver with PHP and MySQL. So you have to make up manually if you want to use MySQL support. +Database Structure `boswatch.sql` in the MySQL Plugin Folder If you want to use BOSWatch as a daemon, you have to set your configuration in `service/boswatch.sh` and copy it to `/etc/init.d`. diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index c321cc1..bfaa144 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -92,17 +92,13 @@ def run(typ,freq,data): logging.debug("Insert %s", typ) if typ == "FMS": - #data = {"fms":fms_id[0:8], "status":fms_status, "direction":fms_direction, "tsi":fms_tsi} - cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableFMS")+" (time,fms,status,direction,tsi) VALUES (NOW(),%s,%s,%s,%s)",(data["fms"],data["status"],data["direction"],data["tsi"])) + cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableFMS")+" (time,fms,status,direction,directionText,tsi,description) VALUES (NOW(),%s,%s,%s,%s,%s,%s)",(data["fms"],data["status"],data["direction"],data["directionText"],data["tsi"],data["description"])) elif typ == "ZVEI": - #data = {"zvei":zvei_id} - #Don't use %s here (bug in mysql-lib with one parameter) - cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableZVEI")+" (time,zvei) VALUES (NOW(),"+(data["zvei"])+")") + cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableZVEI")+" (time,zvei,description) VALUES (NOW(),%s,%s)",(data["zvei"],data["description"])) elif typ == "POC": - #data = {"ric":poc_id, "function":poc_sub, "msg":poc_text} - cursor.execute("INSERT INTO "+globals.config.get("MySQL","tablePOC")+" (time,ric,funktion,text) VALUES (NOW(),%s,%s,%s)",(data["ric"],data["function"],data["msg"])) + cursor.execute("INSERT INTO "+globals.config.get("MySQL","tablePOC")+" (time,ric,funktion,funktionChar,msg,bitrate,description) VALUES (NOW(),%s,%s,%s,%s,%s,%s)",(data["ric"],data["function"],data["functionChar"],data["msg"],data["bitrate"],data["description"])) else: logging.warning("Invalid Typ: %s", typ)