Added a default job interval if not configured in core or monitor configuration.
This commit is contained in:
parent
87c88a243b
commit
390f768172
3 changed files with 19 additions and 7 deletions
|
|
@ -35,6 +35,9 @@ start_scheduler = true
|
|||
; explain this.... :) default is "thread" but Linspector will only run on one CPU core then. default threads are 1024
|
||||
; but this can be set much higher here. this should be minimal set to the number of monitors you are running.
|
||||
scheduler_mode = process
|
||||
; the default job interval can be set here. in the code 300 seconds are set when this option does not exist here nor in
|
||||
; the monitor configuration.
|
||||
default_interval = 5
|
||||
max_threads = 2048
|
||||
; i recommend to set this to your number of CPU cores available when running on a dedicated Linspector host. but if the
|
||||
; system is running other services you should lower this value when you have too high CPU load. if you have enough
|
||||
|
|
|
|||
|
|
@ -4,4 +4,3 @@ service = misc.dummy
|
|||
hosts = 192.168.10.10
|
||||
|
||||
[args]
|
||||
interval = 120
|
||||
|
|
|
|||
|
|
@ -20,13 +20,23 @@ class Monitor:
|
|||
self.__configuration = configuration
|
||||
self.__environment = environment
|
||||
self.__identifier = identifier
|
||||
if int(monitor_configuration.get('args', 'interval')):
|
||||
try:
|
||||
self.__interval = int(monitor_configuration.get('args', 'interval'))
|
||||
else:
|
||||
# default interval is 5 minutes if not set in the monitor.
|
||||
log('warning', 'no interval set in identifier ' + identifier + ' set to default '
|
||||
'interval 300 seconds.')
|
||||
self.__interval = 300
|
||||
except Exception as err:
|
||||
log('warning', 'no interval set in identifier ' + identifier + ', trying to get a '
|
||||
'monitor configuration '
|
||||
'setting. error: ' +
|
||||
str(err))
|
||||
try:
|
||||
self.__interval = int(configuration.get_option('linspector', 'default_interval'))
|
||||
log('warning', 'set default_interval as per configuration to core with '
|
||||
'identifier ' + identifier + ' to: ' + str(self.__interval))
|
||||
except Exception as err:
|
||||
log('warning', 'no default_interval found in core configuration for identifier ' +
|
||||
identifier + ', set to default interval 300 seconds. error: ' + str(err))
|
||||
# default interval is 300 seconds (5 minutes) if not set in the monitor
|
||||
# configuration args or a default_interval in the core configuration.
|
||||
self.__interval = 300
|
||||
self.__log = log
|
||||
self.__monitor_configuration = monitor_configuration
|
||||
self.__notification_list = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue