Merge "Use Basic authentication for Kibana"

This commit is contained in:
Jenkins 2016-07-05 12:41:58 +00:00 committed by Gerrit Code Review
commit 78ebecf56f
3 changed files with 24 additions and 3 deletions

View File

@ -51,7 +51,7 @@ if $tls_enabled {
}
}
$kibana_port = hiera('lma::elasticsearch::kibana_port', 80)
$kibana_port = hiera('lma::elasticsearch::apache_port', 80)
$es_port = hiera('lma::elasticsearch::rest_port', 9200)
$grafana_port = hiera('lma::influxdb::grafana_port', 8000)
$influxdb_port = hiera('lma::influxdb::influxdb_port', 8086)
@ -79,6 +79,12 @@ if empty($plugin['ldap_server_port']) {
$ldap_port = $plugin['ldap_server_port']
}
$elasticsearch_kibana = hiera_hash('elasticsearch_kibana', {})
if ! empty($elasticsearch_kibana) {
$kibana_username = $elasticsearch_kibana["kibana_username"]
$kibana_password = $elasticsearch_kibana["kibana_password"]
}
$calculated_content = inline_template('---
lma::corosync_roles:
- infrastructure_alerting
@ -87,6 +93,8 @@ lma::infrastructure_alerting::listen_address: <%= @listen_address %>
lma::infrastructure_alerting::vip: <%= @alerting_vip %>
lma::infrastructure_alerting::vip_ns: infrastructure_alerting
lma::infrastructure_alerting::kibana_port: <%= @kibana_port %>
lma::infrastructure_alerting::kibana_username: <%= @kibana_username %>
lma::infrastructure_alerting::kibana_password: <%= @kibana_password %>
lma::infrastructure_alerting::es_port: <%= @es_port %>
lma::infrastructure_alerting::grafana_port: <%= @grafana_port %>
lma::infrastructure_alerting::influxdb_port: <%= @influxdb_port %>

View File

@ -380,6 +380,8 @@ if ! empty($es_kibana_nodes){
$kibana_defaults = {
port => hiera('lma::infrastructure_alerting::kibana_port'),
url => '/',
username => hiera('lma::infrastructure_alerting::kibana_username'),
password => hiera('lma::infrastructure_alerting::kibana_password'),
string_expected_in_content => 'kibana',
service_description => 'Kibana',
require => Class[lma_infra_alerting::nagios::hosts],

View File

@ -22,6 +22,8 @@
# custom_address: (optional) the IP address, if not defined the address of the host is used.
# port: the HTTP port
# url: URL to GET
# username: Username to use for basic authentication
# password: Password to use for basic authentication
# string_expected_*: string to expect in the response
# response_time_*: configure the warning and critical thresholds of the response time
# timeout: seconds before connection times out
@ -33,6 +35,8 @@ define lma_infra_alerting::nagios::check_http(
$custom_address = undef,
$port = undef,
$url = '/',
$username = undef,
$password = undef,
$string_expected_in_status = '200 OK',
$string_expected_in_content = undef,
$string_expected_in_headers = undef,
@ -72,9 +76,16 @@ define lma_infra_alerting::nagios::check_http(
$check_command = "check_http_${title}"
}
if $username and $password {
$auth_basic_option = "-a \"${username}\":\"${password}\""
} else {
$auth_basic_option = ''
}
$command_line = rstrip(join([
"${nagios::params::nagios_plugin_dir}/check_http -4 -I '${hostaddress}' ${base_options} ${port_option} ",
"${url_option} ${expect_in_status_option} ${expect_in_content_option} ${expect_in_headers_option}",
"${nagios::params::nagios_plugin_dir}/check_http -4 -I '${hostaddress}' ${base_options} ${port_option}",
rstrip(" ${url_option} ${expect_in_status_option} ${expect_in_content_option} ${expect_in_headers_option}"),
rstrip(" ${auth_basic_option}"),
], ''))
nagios::command { $check_command:
prefix => $prefix,