Skip to content

Commit

Permalink
Python3 version:
Browse files Browse the repository at this point in the history
- trying to clean some broken tests on Python 3
- pylint
  • Loading branch information
mohierf committed May 15, 2018
1 parent a5af52e commit 1dff516
Show file tree
Hide file tree
Showing 272 changed files with 14,503 additions and 28 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ script:
bash <(curl -s https://codecov.io/bash) -e TEST_SUITE
# Run load tests and code dynamic analysis
cd test_run
# Run test suite with py.test running its coverage plugin
# Dump the 10 slowest tests - do not capture to have some activity in Travis
travis_wait 60 pytest --durations=10 --no-print-logs --capture=no -s --cov=alignak --cov-config .coveragerc test_*.py || travis_terminate 1;
cd ..
cp test_run/.coverage .
# codecov
bash <(curl -s https://codecov.io/bash) -e TEST_SUITE
# cd test_run
# # Run test suite with py.test running its coverage plugin
# # Dump the 10 slowest tests - do not capture to have some activity in Travis
# travis_wait 60 pytest --durations=10 --no-print-logs --capture=no -s --cov=alignak --cov-config .coveragerc test_*.py || travis_terminate 1;
# cd ..
# cp test_run/.coverage .
# # codecov
# bash <(curl -s https://codecov.io/bash) -e TEST_SUITE
fi
after_success:
Expand Down
76 changes: 76 additions & 0 deletions test/cfg/run_daemons_1/alignak-logger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"version": 1,
"disable_existing_loggers": true,
"formatters": {
"unit_tests": {
"format": "[%(asctime)s] %(levelname)s: [%(daemon)s.%(name)s] %(message)s"
,"datefmt": "%Y-%m-%d %H:%M:%S"
},
"alignak": {
"format": "[%(asctime)s] %(levelname)s: [%(daemon)s.%(name)s] %(message)s"
,"datefmt": "%Y-%m-%d %H:%M:%S"
},
"monitoring-log": {
"format": "[%(asctime)s] %(levelname)s: %(message)s"
,"datefmt": "%Y-%m-%d %H:%M:%S"
}
},

"handlers": {
"unit_tests": {
"class": "alignak.log.CollectorHandler",
"level": "INFO",
"formatter": "unit_tests"
},
"console": {
"class": "logging.StreamHandler",
"level": "ERROR",
"formatter": "alignak",
"stream": "ext://sys.stdout"
},
"color_console": {
"class": "alignak.log.ColorStreamHandler",
"level": "WARNING",
"formatter": "alignak",
"stream": "ext://sys.stdout"
},
"daemons": {
"class": "logging.handlers.TimedRotatingFileHandler",
"level": "INFO",
"formatter": "alignak",
"filename": "%(logdir)s/%(daemon)s.log",
"when": "midnight",
"interval": 1,
"backupCount": 7,
"encoding": "utf8"
},
"monitoring_logs": {
"class": "logging.handlers.TimedRotatingFileHandler",
"level": "INFO",
"formatter": "monitoring-log",
"filename": "%(logdir)s/monitoring-logs.log",
"when": "midnight",
"interval": 1,
"backupCount": 365,
"encoding": "utf8"
}
},

"loggers": {
"alignak": {
"level": "DEBUG",
"handlers": ["unit_tests", "color_console", "daemons"],
"propagate": "no"
},
"monitoring-log": {
"level": "DEBUG",
"handlers": ["console", "monitoring_logs"],
"propagate": "no"
}
},

"root": {
"level": "ERROR",
"handlers": []
}
}
280 changes: 280 additions & 0 deletions test/cfg/run_daemons_1/alignak.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
# --------------------------------------------------------------------
# Alignak main configuration file
# --------------------------------------------------------------------
# This file is the main file that will be loaded by Alignak on boot.
# It is the entry point for the framework configuration.
# --------------------------------------------------------------------
# Please see the official project documentation for documentation about
# the configuration:
# http://alignak-doc.readthedocs.io/en/latest/04_configuration/index.html
# --------------------------------------------------------------------

# -------------------------------------------------------------------------
# Begin - Monitored objects configuration part
# -------------------------------------------------------------------------
# This part of the configuration file can be removed when the monitored
# objects are stored in the Alignak backend
# -------------------------------------------------------------------------
# Configuration files with common objects like commands, timeperiods,
# or templates that are used by the host/service/contacts
; When loading data only from the alignak backend, comment this
; block because data do not need to be read from files
cfg_dir=arbiter/objects/realms
cfg_dir=arbiter/objects/commands
cfg_dir=arbiter/objects/timeperiods
;cfg_dir=arbiter/objects/escalations
;cfg_dir=arbiter/objects/dependencies

# Templates and packs for hosts, services and contacts
; When loading data only from the alignak backend, comment this
; block because data do not need to be read from files
cfg_dir=arbiter/templates
;cfg_dir=arbiter/packs

# Notification ways
; When loading data only from the alignak backend, comment this
; block because data do not need to be read from files
cfg_dir=arbiter/objects/notificationways

# Groups
; When loading data only from the alignak backend, comment this
; block because data do not need to be read from files
;cfg_dir=arbiter/objects/servicegroups
;cfg_dir=arbiter/objects/hostgroups
cfg_dir=arbiter/objects/contactgroups

# Real hosts, services and contacts
; When loading data only from the alignak backend, comment this
; block because data do not need to be read from files
cfg_dir=arbiter/objects/hosts
cfg_dir=arbiter/objects/services
cfg_dir=arbiter/objects/contacts
# -------------------------------------------------------------------------
# End - Monitored objects configuration part
# -------------------------------------------------------------------------

# -------------------------------------------------------------------------
# Begin - Alignak framework configuration part
# -------------------------------------------------------------------------
# Alignak daemons and modules to be loaded
;cfg_dir=arbiter/daemons
;cfg_dir=arbiter/modules

# You will find global MACROS into the files in those directories
cfg_dir=arbiter/resource.d
cfg_dir=arbiter/packs/resource.d

# -------------------------------------------------------------------------
# End - Alignak framework configuration part
# -------------------------------------------------------------------------

# Alignak instance name
# This information is useful to get/store alignak global configuration in the Alignak backend
# If you share the same backend between several Alignak instances, each instance must have its own
# name. The default is to use the arbiter name as Alignak instance name. Else, you can can define
# your own Alignak instance name in this property
# alignak_name=my_alignak

# Notifications configuration
# ---
# Notifications are enabled/disabled
# enable_notifications=1

# After a timeout, launched plugins are killed
#notification_timeout=30


# Retention configuration
# ---
# Number of minutes between 2 retention save, default is 60 minutes
#retention_update_interval=60

# Checks configuration
# ---
# Active host/service checks are enabled/disabled
#execute_host_checks=1
#execute_service_checks=1

# Passive host/service checks are enabled/disabled
#accept_passive_host_checks=1
#accept_passive_service_checks=1

# As default, passive host checks are HARD states
#passive_host_checks_are_soft=0


# Interval length and re-scheduling configuration
# Do not change those values unless you are reaaly sure to master what you are doing ...
#interval_length=60
#auto_reschedule_checks=1
auto_rescheduling_interval=1
auto_rescheduling_window=180


# Number of interval to spread the first checks for hosts and services
# Default is 30
#max_service_check_spread=30
max_service_check_spread=5
# Default is 30
#max_host_check_spread=30
max_host_check_spread=5


# Max plugin output for the plugins launched by the pollers, in bytes
#max_plugins_output_length=8192
max_plugins_output_length=65536


# After a timeout, launched plugins are killed
# and the host state is set to a default value (2 for DOWN)
# and the service state is set to a default value (2 for CRITICAL)
#host_check_timeout=30
#service_check_timeout=60
#timeout_exit_status=2


# Freshness check
# Default is enabled for hosts and services
#check_host_freshness=1
#check_service_freshness=1
# Default is 60 for hosts and services
#host_freshness_check_interval=60
#service_freshness_check_interval=60
# Extra time for freshness check ...
#additional_freshness_latency=15


# Flapping detection configuration
# ---
# Default is enabled
#enable_flap_detection=1

# Flapping threshold for hosts and services
#low_service_flap_threshold=20
#high_service_flap_threshold=30
#low_host_flap_threshold=20
#high_host_flap_threshold=30

# flap_history is the lengh of history states we keep to look for flapping.
# 20 by default, can be useful to increase it. Each flap_history increases cost:
# flap_history cost = 4Bytes * flap_history * (nb hosts + nb services)
# Example: 4 * 20 * (1000+10000) ~ 900Ko for a quite big conf. So, go for it!
#flap_history=20


# Performance data configuration
# ---
# Performance data management is enabled/disabled
#process_performance_data=1


# Event handlers configuration
# ---
# Event handlers are enabled/disabled
#enable_event_handlers=1

# By default don't launch even handlers during downtime. Put 0 to
# get back the default nagios behavior
no_event_handlers_during_downtimes=1

# Global host/service event handlers
#global_host_event_handler=
#global_service_event_handler=

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


# External commands configuration
# ---
# External commands are enabled/disabled
# check_external_commands=1

# By default don't launch even handlers during downtime. Put 0 to
# get back the default nagios behavior
no_event_handlers_during_downtimes=1


# Impacts configuration
# ---
# Enable or not the state change on impact detection (like a host going unreachable
# if a parent is DOWN for example). It's for services and hosts.
# Note: defaults to 0 for Nagios old behavior compatibility
#enable_problem_impacts_states_change=0
enable_problem_impacts_states_change=1


# if 1, disable all notice and warning messages at
# configuration checking when arbiter checks the configuration.
# Default is to log the notices and warnings
#disable_old_nagios_parameters_whining=0
disable_old_nagios_parameters_whining=1


# Environment macros configuration
# ---
# Disabling environment macros is good for performance. If you really need it, enable it.
#enable_environment_macros=1
enable_environment_macros=0


# Monitoring log configuration
# ---
# Note that alerts and downtimes are always logged
# ---
# Notifications
# log_notifications=1

# Services retries
# log_service_retries=1

# Hosts retries
# log_host_retries=1

# Event handlers
# log_event_handlers=1

# Flappings
# log_flappings=1

# Snapshots
# log_snapshots=1

# External commands
# log_external_commands=1

# Active checks
# log_active_checks=0

# Passive checks
# log_passive_checks=0

# Initial states
# log_initial_states=1


# [Optional], a pack distribution file is a local file near the arbiter
# that will keep host pack id association, and so push same host on the same
# scheduler if possible between restarts.
pack_distribution_file=/usr/local/var/lib/alignak/pack_distribution.dat


# If you need to set a specific timezone to your deamons, uncomment it
#use_timezone=Europe/Paris


# Export all alignak inner performances into a statsd server.
# By default at localhost:8125 (UDP) with the alignak prefix
# Default is not enabled
#statsd_host=localhost
#statsd_port=8125
#statsd_prefix=alignak
#statsd_enabled=0


# --------------------------------------------------------------------
## Arbiter daemon part, similar to daemon ini file
# --------------------------------------------------------------------
#
# Those parameters are defined in the arbiterd.ini file
#
Loading

0 comments on commit 1dff516

Please sign in to comment.