added threshold handling to job.py and config

This commit is contained in:
Johannes Findeisen 2013-10-11 02:07:55 +02:00
commit ee5245eccb
2 changed files with 11 additions and 1 deletions

View file

@ -184,10 +184,12 @@
}
},
"core":{
"_documentation": "https://github.com/linspector/linspector/wiki/Configuration-Core",
"instance_name": "Master Monitoring (monitor.example.org)",
"max_logfile_size": 1024000,
"max_logfile_count": 4,
"max_worker_threads": 8,
"threshold_handling": "reset",
"members":[ "root" ],
"backends": {
"jsonrpc": {

View file

@ -73,6 +73,14 @@ class Job:
def handle_threshold(self, jobInfo, serviceThreshold, executionSucessful):
if executionSucessful:
if self.jobThreshold > 0:
#TODO: maybe set threshold_handling for each service optionally; will override core setting!
if self.core["threshold_handling"] == "reset":
# Reset counter to 0
self.log.debug("Threshold Reset")
self.jobThreshold = 0
else:
# Decrement the counter (default)
self.log.debug("Threshold Decrement")
self.jobThreshold -= 1
else:
self.jobThreshold += 1