Skip to content

Commit

Permalink
Update data in the program_status brok to reflect the most recent Ali…
Browse files Browse the repository at this point in the history
…gnak configuration parameters
  • Loading branch information
mohierf committed May 29, 2017
1 parent 6e71691 commit bddc73d
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 21,096 deletions.
4 changes: 2 additions & 2 deletions alignak/daemons/brokerdaemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ def get_new_broks(self, s_type='scheduler'):
exp)
continue
if tmp_broks:
logger.info("Got %d Broks from %s in %s",
len(tmp_broks), link['name'], time.time() - _t0)
logger.debug("Got %d Broks from %s in %s",
len(tmp_broks), link['name'], time.time() - _t0)
statsmgr.timer('con-broks-get.%s' % (link['name']), time.time() - _t0)
statsmgr.gauge('con-broks-count.%s' % (link['name']), len(tmp_broks.values()))
for brok in tmp_broks.values():
Expand Down
130 changes: 93 additions & 37 deletions alignak/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ def load_conf(self, conf):
logger.debug("Properties:")
for key in sorted(self.conf.properties):
logger.debug("- %s: %s", key, getattr(self.conf, key, []))
logger.debug("Macros:")
logger.debug("Macros:")
for key in sorted(self.conf.macros):
logger.debug("- %s: %s", key, getattr(self.conf.macros, key, []))
logger.debug("Objects types:")
logger.debug("Objects types:")
for key in sorted(self.conf.types_creations):
logger.debug("- %s: %s", key, getattr(self.conf.types_creations, key, []))

Expand Down Expand Up @@ -1652,41 +1652,97 @@ def get_program_status_brok(self):
TODO: GET REAL VALUES
"""
now = int(time.time())
# todo: some information in this brok are unuseful: last_log_rotation, command_file
# Some others are unaccurate: last_command_check, modified_host_attributes,
# modified_service_attributes
# I do not remove yet because some modules may use them?
data = {"is_running": 1,
"instance_id": self.instance_id,
"alignak_name": self.alignak_name,
"instance_name": self.instance_name,
"last_alive": now,
"interval_length": self.conf.interval_length,
"program_start": self.program_start,
"pid": os.getpid(),
"daemon_mode": 1,
"last_command_check": now,
"last_log_rotation": now,
"notifications_enabled": self.conf.enable_notifications,
"active_service_checks_enabled": self.conf.execute_service_checks,
"passive_service_checks_enabled": self.conf.accept_passive_service_checks,
"active_host_checks_enabled": self.conf.execute_host_checks,
"passive_host_checks_enabled": self.conf.accept_passive_host_checks,
"event_handlers_enabled": self.conf.enable_event_handlers,
"flap_detection_enabled": self.conf.enable_flap_detection,
"failure_prediction_enabled": 0,
"process_performance_data": self.conf.process_performance_data,
"obsess_over_hosts": self.conf.obsess_over_hosts,
"obsess_over_services": self.conf.obsess_over_services,
"modified_host_attributes": 0,
"modified_service_attributes": 0,
"global_host_event_handler": self.conf.global_host_event_handler,
'global_service_event_handler': self.conf.global_service_event_handler,
'check_external_commands': self.conf.check_external_commands,
'check_service_freshness': self.conf.check_service_freshness,
'check_host_freshness': self.conf.check_host_freshness,
'command_file': self.conf.command_file
}
# Program status brok
data = {
# Status information
"last_alive": now,
"program_start": self.program_start,
"pid": os.getpid(),
"alignak_name": self.alignak_name,
"instance_id": self.instance_id,
"instance_name": self.instance_name,
"interval_length": self.conf.interval_length,
"last_command_check": now,
"last_log_rotation": now,

# Global configuration
"use_timezone": self.conf.use_timezone,
"illegal_macro_output_chars": self.conf.illegal_macro_output_chars,
"illegal_object_name_chars": self.conf.illegal_object_name_chars,
"cleaning_queues_interval": self.conf.cleaning_queues_interval,

# Log (monitoring log broks)
"log_initial_states": self.conf.log_initial_states,
"log_active_checks": self.conf.log_active_checks,
"log_host_retries": self.conf.log_host_retries,
"log_service_retries": self.conf.log_service_retries,
"log_passive_checks": self.conf.log_passive_checks,
"log_notifications": self.conf.log_notifications,
"log_event_handlers": self.conf.log_event_handlers,
"log_external_commands": self.conf.log_external_commands,
"log_flappings": self.conf.log_flappings,
"log_snapshots": self.conf.log_snapshots,

# Notifications
"enable_notifications": self.conf.enable_notifications,
"notification_timeout": self.conf.notification_timeout,
"timeout_exit_status": self.conf.timeout_exit_status,

# Active checks
"execute_host_checks": self.conf.execute_host_checks,
"max_host_check_spread": self.conf.max_host_check_spread,
"execute_service_checks": self.conf.execute_service_checks,
"max_service_check_spread": self.conf.max_service_check_spread,
"host_check_timeout": self.conf.host_check_timeout,
"check_for_orphaned_hosts": self.conf.check_for_orphaned_hosts,
"cached_host_check_horizon": self.conf.cached_host_check_horizon,
"service_check_timeout": self.conf.service_check_timeout,
"check_for_orphaned_services": self.conf.check_for_orphaned_services,
"cached_service_check_horizon": self.conf.cached_service_check_horizon,
"max_plugins_output_length": self.conf.max_plugins_output_length,
"enable_environment_macros": self.conf.enable_environment_macros,

# External commands
"check_external_commands": self.conf.check_external_commands,

# Performance data
"process_performance_data": self.conf.process_performance_data,
"host_perfdata_command": self.conf.host_perfdata_command,
"service_perfdata_command": self.conf.service_perfdata_command,

# Passive/Freshness check
"accept_passive_host_checks": self.conf.accept_passive_host_checks,
"accept_passive_service_checks": self.conf.accept_passive_service_checks,
"check_host_freshness": self.conf.check_host_freshness,
"host_freshness_check_interval": self.conf.host_freshness_check_interval,
"check_service_freshness": self.conf.check_service_freshness,
"service_freshness_check_interval": self.conf.service_freshness_check_interval,
"additional_freshness_latency": self.conf.additional_freshness_latency,

# Event handlers
"enable_event_handlers": self.conf.enable_event_handlers,
"no_event_handlers_during_downtimes": self.conf.no_event_handlers_during_downtimes,
"event_handler_timeout": self.conf.event_handler_timeout,
"global_host_event_handler": self.conf.global_host_event_handler.get_name()
if self.conf.global_host_event_handler else None,
'global_service_event_handler': self.conf.global_service_event_handler.get_name()
if self.conf.global_service_event_handler else None,

# Flapping
"enable_flap_detection": self.conf.enable_flap_detection,
"flap_history": self.conf.flap_history,
"low_host_flap_threshold": self.conf.low_host_flap_threshold,
"low_service_flap_threshold": self.conf.low_service_flap_threshold,
"high_host_flap_threshold": self.conf.high_host_flap_threshold,
"high_service_flap_threshold": self.conf.high_service_flap_threshold,

# Stats
"statsd_enabled": self.conf.statsd_enabled,
"statsd_host": self.conf.statsd_host,
"statsd_port": self.conf.statsd_port,
"statsd_prefix": self.conf.statsd_prefix,
}
logger.debug("Program status brok data: %s", data)
brok = Brok({'type': 'program_status', 'data': data})
return brok

Expand Down
63 changes: 0 additions & 63 deletions test_load/cfg/default/arbiter/objects/hosts/hosts.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,3 @@ define host{
address 127.0.0.1
}

define host{
use test-host
contact_groups admins
host_name host-1
address 127.0.0.1
}

define host{
use test-host
contact_groups admins
host_name host-2
address 127.0.0.1
}

define host{
use test-host
contact_groups admins
host_name host-3
address 127.0.0.1
}

define host{
use test-host
contact_groups admins
host_name host-4
address 127.0.0.1
}

define host{
use test-host
contact_groups admins
host_name host-5
address 127.0.0.1
}

define host{
use test-host
contact_groups admins
host_name host-6
address 127.0.0.1
}

define host{
use test-host
contact_groups admins
host_name host-7
address 127.0.0.1
}

define host{
use test-host
contact_groups admins
host_name host-8
address 127.0.0.1
}

define host{
use test-host
contact_groups admins
host_name host-9
address 127.0.0.1
}

2 changes: 2 additions & 0 deletions test_load/cfg/passive_daemons/alignak.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ no_event_handlers_during_downtimes=1

# Global host/service event handlers
#global_host_event_handler=
global_host_event_handler=dummy_check!0
#global_service_event_handler=
global_service_event_handler=dummy_check!0

# After a timeout, launched plugins are killed
#event_handler_timeout=30
Expand Down
Loading

0 comments on commit bddc73d

Please sign in to comment.