Cosmetic changes and some more inline comments.
This commit is contained in:
parent
9c9274f0b4
commit
f4e3b9c01b
5 changed files with 15 additions and 10 deletions
|
|
@ -32,9 +32,9 @@ from linspector.core.environment import Environment
|
||||||
from linspector.core.linspector import Linspector
|
from linspector.core.linspector import Linspector
|
||||||
from linspector.core.monitors import Monitors
|
from linspector.core.monitors import Monitors
|
||||||
|
|
||||||
# i currently only set the 3rd number because the goal is that 0.19 will become the first stable
|
# i currently only increase the 3rd number because the goal is that 0.19 will become the first
|
||||||
# version.
|
# stable version.
|
||||||
__version__ = '0.19.17.dev1'
|
__version__ = '0.19.19.dev1'
|
||||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||||
|
|
||||||
logger = logging.getLogger('linspector')
|
logger = logging.getLogger('linspector')
|
||||||
|
|
@ -72,6 +72,8 @@ def main():
|
||||||
monitors = None
|
monitors = None
|
||||||
notifications = {}
|
notifications = {}
|
||||||
plugins = {}
|
plugins = {}
|
||||||
|
# the scheduler is a dict to make it possible in the future to run more than one scheduler in
|
||||||
|
# one linspector daemon. need to think about it a little more...
|
||||||
scheduler = {}
|
scheduler = {}
|
||||||
services = {}
|
services = {}
|
||||||
tasks = {}
|
tasks = {}
|
||||||
|
|
@ -105,6 +107,7 @@ def main():
|
||||||
backupCount=int(
|
backupCount=int(
|
||||||
configuration.get_option(
|
configuration.get_option(
|
||||||
'linspector', 'log_count')))
|
'linspector', 'log_count')))
|
||||||
|
|
||||||
log_file_handler.setFormatter(log_file_formatter)
|
log_file_handler.setFormatter(log_file_formatter)
|
||||||
logger.addHandler(log_file_handler)
|
logger.addHandler(log_file_handler)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ max_processes = 24
|
||||||
timezone = CET
|
timezone = CET
|
||||||
; this is for scheduling jobs to not run all at the same time. this should be set to the lowest interval you use. it
|
; this is for scheduling jobs to not run all at the same time. this should be set to the lowest interval you use. it
|
||||||
; can be set to a lower value if you only have a small amount of services you are monitoring. i recommend the lowest
|
; can be set to a lower value if you only have a small amount of services you are monitoring. i recommend the lowest
|
||||||
; interval you use any any monitor. it is always starting with 0. default is 60.
|
; interval you use any any monitor. it is always starting with 0. default is 60. the current setting is for development
|
||||||
|
; only.
|
||||||
delta_range = 10
|
delta_range = 10
|
||||||
|
|
||||||
; hostgroup parents; if the hostgroup "group1" is down, don't alert for the hosts in group2. see TODO.txt for more
|
; hostgroup parents; if the hostgroup "group1" is down, don't alert for the hosts in group2. see TODO.txt for more
|
||||||
|
|
@ -47,6 +48,7 @@ group1 = group2
|
||||||
; add single hosts
|
; add single hosts
|
||||||
group1 = host1,host2,host3
|
group1 = host1,host2,host3
|
||||||
; add a range of ip addresses. maybe a different range operator should be chosen but for now i think ">" is sexy... :)
|
; add a range of ip addresses. maybe a different range operator should be chosen but for now i think ">" is sexy... :)
|
||||||
|
; for ip ranges see: https://stackoverflow.com/questions/19157307/generate-range-of-ips-in-python
|
||||||
group2 = 192.168.1.1>192.168.1.127
|
group2 = 192.168.1.1>192.168.1.127
|
||||||
; add a combination of hosts and ranges
|
; add a combination of hosts and ranges
|
||||||
group3 = host1,host2,host3,192.168.1.1>192.168.1.127
|
group3 = host1,host2,host3,192.168.1.1>192.168.1.127
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ def log(level, msg):
|
||||||
# only use inspect when log level NOTSET or DEBUG is enabled.
|
# only use inspect when log level NOTSET or DEBUG is enabled.
|
||||||
if logger.isEnabledFor(0) or logger.isEnabledFor(10):
|
if logger.isEnabledFor(0) or logger.isEnabledFor(10):
|
||||||
import inspect
|
import inspect
|
||||||
frm = inspect.stack()[1]
|
from_stack = inspect.stack()[1]
|
||||||
function_name = frm.function
|
function_name = from_stack.function
|
||||||
module_name = inspect.getmodule(frm[0]).__name__
|
module_name = inspect.getmodule(from_stack[0]).__name__
|
||||||
line_number = str(frm.lineno)
|
line_number = str(from_stack.lineno)
|
||||||
if level == 'critical':
|
if level == 'critical':
|
||||||
logger.critical('[' + module_name + ']:[' + function_name + ']:[' + line_number + '] ' +
|
logger.critical('[' + module_name + ']:[' + function_name + ']:[' + line_number + '] ' +
|
||||||
str(msg))
|
str(msg))
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,6 @@ class DummyService(Service):
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
|
||||||
def execute(self, **kwargs):
|
def execute(self, **kwargs):
|
||||||
log('debug', 'dummy object @' + str(self))
|
log('debug', 'dummy object ' + str(self))
|
||||||
#log('debug', 'dummy object @' + str(self) + str(self.__kwargs['foo']))
|
#log('debug', 'dummy object @' + str(self) + str(self.__kwargs['foo']))
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,5 @@ class FritzboxUplinkService(Service):
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
|
||||||
def execute(self, **kwargs):
|
def execute(self, **kwargs):
|
||||||
log('debug', 'fritzboxuplink object @' + str(self))
|
log('debug', 'fritzboxuplink object ' + str(self))
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue