2015-05-22 21:32:37 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
# -*- coding: cp1252 -*-
|
|
|
|
|
|
2015-05-27 07:48:24 +02:00
|
|
|
"""
|
|
|
|
|
Handler for the Filter and Plugins at an Alarm
|
|
|
|
|
|
|
|
|
|
@author: Bastian Schroll
|
|
|
|
|
|
|
|
|
|
@requires: none
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import logging # Global logger
|
2015-05-22 21:32:37 +02:00
|
|
|
|
|
|
|
|
from includes import globals # Global variables
|
|
|
|
|
|
2015-05-27 07:48:24 +02:00
|
|
|
|
2015-05-22 21:32:37 +02:00
|
|
|
def processAlarm(typ,freq,data):
|
2015-05-27 07:48:24 +02:00
|
|
|
"""
|
|
|
|
|
Function to process Filters and Plugins at Alarm
|
|
|
|
|
|
|
|
|
|
@type typ: string (FMS|ZVEI|POC)
|
|
|
|
|
@param typ: Typ of the dataset
|
|
|
|
|
@type freq: string
|
|
|
|
|
@param freq: frequency of the SDR Stick
|
|
|
|
|
@type data: map of data (structure see interface.txt)
|
|
|
|
|
@param data: Contains the parameter
|
|
|
|
|
|
|
|
|
|
@requires: active Plugins in pluginList
|
|
|
|
|
|
|
|
|
|
@return: nothing
|
|
|
|
|
@exception: Exception if Alarm processing failed
|
|
|
|
|
"""
|
2015-05-26 11:41:05 +02:00
|
|
|
try:
|
|
|
|
|
logging.debug("[ ALARM ]")
|
2015-05-27 07:48:24 +02:00
|
|
|
#Go to all Plugins in pluginList
|
2015-05-26 11:41:05 +02:00
|
|
|
for pluginName, plugin in globals.pluginList.items():
|
|
|
|
|
|
|
|
|
|
#if enabled use RegEx-Filter
|
|
|
|
|
if globals.config.getint("BOSWatch","useRegExFilter"):
|
|
|
|
|
from includes import filter
|
|
|
|
|
if filter.checkFilters(data,typ,pluginName):
|
|
|
|
|
logging.debug("call Plugin: %s", pluginName)
|
|
|
|
|
plugin.run(typ,freq,data)
|
|
|
|
|
logging.debug("return from: %s", pluginName)
|
|
|
|
|
|
2015-05-27 07:48:24 +02:00
|
|
|
else: #RegEX Filter off - Call Plugin direct
|
2015-05-24 21:24:26 +02:00
|
|
|
logging.debug("call Plugin: %s", pluginName)
|
|
|
|
|
plugin.run(typ,freq,data)
|
|
|
|
|
logging.debug("return from: %s", pluginName)
|
2015-05-25 10:28:35 +02:00
|
|
|
|
2015-05-26 11:41:05 +02:00
|
|
|
logging.debug("[END ALARM]")
|
|
|
|
|
except:
|
|
|
|
|
logging.exception("Error in Alarm processing")
|