mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-03 23:30:19 +01:00
prepare for httpRequest plugin
This commit is contained in:
parent
972fc72aab
commit
d1d1e3e7bf
|
|
@ -20,6 +20,7 @@ poc_filter_range_end = 9999999
|
|||
[Plugins]
|
||||
MySQL = 0
|
||||
BosMon = 0
|
||||
httpRequest = 0
|
||||
# for developing template-module is enabled
|
||||
template = 1
|
||||
#none has no function, only demo
|
||||
|
|
@ -50,6 +51,13 @@ bosmon_user =
|
|||
bosmon_password =
|
||||
|
||||
|
||||
[httpRequest]
|
||||
#URL without http://
|
||||
fms_url = www.google.de
|
||||
zvei_url = www.google.de
|
||||
poc_url = www.google.de
|
||||
|
||||
|
||||
[template]
|
||||
data1 = test123
|
||||
data2 = test345
|
||||
|
|
|
|||
46
plugins/httpRequest/httpRequest.py
Normal file
46
plugins/httpRequest/httpRequest.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: cp1252 -*-
|
||||
|
||||
import logging # Global logger
|
||||
import globals # Global variables
|
||||
|
||||
#########
|
||||
# USAGE
|
||||
#
|
||||
# Config
|
||||
# ======
|
||||
# to read a option from config File
|
||||
# VALUE = globals.config.get("SECTION", "OPTION")
|
||||
#
|
||||
# Data from boswatch.py
|
||||
# =====================
|
||||
# use data["KEY"] for Alarm Data from boswatch.py
|
||||
# for usable KEYs in different Functions (FMS|ZVEI|POC) see interface.txt
|
||||
#
|
||||
# LOG Messages
|
||||
# ============
|
||||
# send Log Messages with logging.LOGLEVEL("MESSAGE")
|
||||
# usable Loglevels debug|info|warning|error|exception|critical
|
||||
# if you use .exception in Try:Exception: Construct, it logs the Python EX.message too
|
||||
|
||||
def run(typ,freq,data):
|
||||
try:
|
||||
#ConfigParser
|
||||
logging.debug("reading config file")
|
||||
try:
|
||||
for key,val in globals.config.items("template"):
|
||||
logging.debug(" - %s = %s", key, val)
|
||||
except:
|
||||
logging.exception("cannot read config file")
|
||||
|
||||
if typ == "FMS":
|
||||
logging.debug(typ + " not supported")
|
||||
elif typ == "ZVEI":
|
||||
logging.debug(typ + " not supported")
|
||||
elif typ == "POC":
|
||||
logging.debug(typ + " not supported")
|
||||
else:
|
||||
logging.warning(typ + " not supported")
|
||||
|
||||
except:
|
||||
logging.exception("unknown error")
|
||||
Loading…
Reference in a new issue