Puppet Class: tripleo::profile::base::metrics::collectd::sensubility
- Defined in:
- manifests/profile/base/metrics/collectd/sensubility.pp
Overview
Copyright 2018 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Define: tripleo::profile::base::metrics::collectd::sensubility
This is used to create configuration file for collectd-sensubility plugin
Parameters
- ensure
-
(Optional) String. Action to perform with sensubility plugin configuration file. Defaults to ‘present’
- config_path
-
(Optional) String. Path to configuration file, which should be populated. Defaults to ‘/etc/collectd-sensubility.conf’.
- log_file
-
(Optional) String. Override default log file path (/var/log/collectd/sensubility.log). Defaults to undef.
- log_level
-
(Optional) String. Override default logging level (WARN). Defaults to undef.
- connection
-
(Optional) String. URL to Sensu sever side (be default “ampq://sensu:sensu@localhost:5672//sensu”) Defaults to undef.
- subscriptions
-
(Optional) List of strings. List of channels to subscribe to. Defaults to undef.
- client_name
-
(Optional) String. Name of the client displayed on Sensu server side (by default COLLECTD_HOSTNAME env or hostname). Defaults to undef.
- client_address
-
(Optional) String. Address of the client displayed on Sensu server side (by default IP address of host). Defaults to undef.
- keepalive_interval
-
(Optional) Integer. Interval in seconds for sending keepalive messages to Sensu server side (By default 20). Defaults to undef.
- shell_path
-
(Optional) String. Path to shell used for executing check scripts (by default /usr/bin/sh). Defaults to undef.
- worker_count
-
(Optional) String. Number of goroutines spawned for executing check scripts (by default 2). Defaults to undef.
- checks
-
(Optional) Hash representing definitions of standalone checks (by default {}). Defaults to undef.
- amqp_host
-
(Optional) String. Hostname or IP address of the AMQP 1.0 intermediary. Defaults to the undef
- amqp_port
-
(Optional) String. Service name or port number on which the AMQP 1.0 intermediary accepts connections. This argument must be a string, even if the numeric form is used. Defaults to undef
- amqp_user
-
(Optional) String. User part of credentials used to authenticate to the AMQP 1.0 intermediary. Defaults to undef
- amqp_password
-
(Optional) String. Password part of credentials used to authenticate to the AMQP 1.0 intermediary. Defaults to undef
- exec_user
-
(Optional) String. User under which sensubility is executed via collectd-exec. Defaults to ‘collectd’
- exec_group
-
(Optional) String. Group under which sensubility is executed via collectd-exec. Defaults to ‘collectd’
- exec_sudo_rule
-
(Optional) String. Rule which will be saved in /etc/sudoers.d for user specified by parameter exec_user. Defaults to undef
- results_format
-
(Optional) String. Set message format compatability. Options are
- smartgateway,sensu
-
Defaults to smartgateway
- results_channel
-
String. Target AMQP1 channel address to which messages should be sent Defaults to undef
- transport
-
String. Bus type for message transport. Options are ‘sensu’ (rabbitmq) or ‘amqp1’ Defaults to ‘sensu’
- workdir
-
(Optional) String. Working directory for sensubility. This directory will contain temporary check scripts (in checks subdirectory) and downloaded scripts (in scripts subdirectory). Defaults to ‘/var/lib/collectd-sensubility’
- scripts
-
(Optional) Hash. Should contain information about what scripts should be downloaded. The item format is following: { “script-name” =>
"source" => "http://uri.from.where.to.download/script-name", "checksum" => "checksum-of-the-script", "create_bin_link" => true/false # whether to create link to /usr/bin} Defaults to {}
DEPRECATED PARAMETERS
- tmp_base_dir
-
(Optional) String. DEPRECATED, use “workdir” parameter instead.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'manifests/profile/base/metrics/collectd/sensubility.pp', line 135
class tripleo::profile::base::metrics::collectd::sensubility (
$ensure = 'present',
$config_path = '/etc/collectd-sensubility.conf',
$log_file = undef,
$log_level = undef,
$connection = undef,
$subscriptions = undef,
$client_name = undef,
$client_address = undef,
$keepalive_interval = undef,
$shell_path = undef,
$worker_count = undef,
$checks = undef,
$amqp_host = undef,
$amqp_port = undef,
$amqp_user = undef,
$amqp_password = undef,
$exec_user = 'collectd',
$exec_group = 'collectd',
$exec_sudo_rule = undef,
$results_format = 'smartgateway',
$results_channel = undef,
$transport = 'sensu',
$workdir = '/var/lib/collectd-sensubility',
$scripts = {},
# DEPRECATED
$tmp_base_dir = undef,
) {
include collectd
include collectd::plugin::exec
package { 'collectd-sensubility':
ensure => $ensure,
}
if $tmp_base_dir {
warning('The "tmp_base_dir" parameter is deprecated and might be ignored in future releases. Use "workdir" instead.')
$checkdir = $tmp_base_dir
} else {
$checkdir = "${workdir}/checks"
}
$scriptsdir = "${workdir}/scripts"
file { [$workdir, $checkdir, $scriptsdir]:
ensure => 'directory',
mode => '0700',
owner => $exec_user,
group => $exec_group
}
file { $config_path:
ensure => $ensure,
mode => '0644',
content => epp('tripleo/metrics/collectd-sensubility.conf.epp', {
log_file => $log_file,
log_level => $log_level,
connection => $connection,
subscriptions => $subscriptions,
client_name => $client_name,
client_address => $client_address,
keepalive_interval => $keepalive_interval,
tmp_base_dir => $checkdir,
shell_path => $shell_path,
worker_count => $worker_count,
checks => inline_template('<%= @checks.to_json %>'),
amqp_host => $amqp_host,
amqp_port => $amqp_port,
amqp_user => $amqp_user,
amqp_password => $amqp_password,
results_format => $results_format,
results_channel => $results_channel,
transport => $transport
})
}
collectd::plugin::exec::cmd { 'sensubility':
user => $exec_user,
group => $exec_group,
exec => ['collectd-sensubility'],
}
if $exec_sudo_rule {
$sudoers_path = "/etc/sudoers.d/sensubility_${exec_user}"
file { $sudoers_path:
ensure => $ensure,
mode => '0440',
content => "${exec_user} ${exec_sudo_rule}",
notify => Exec["${exec_user}-sudo-syntax-check"]
}
exec { "${exec_user}-sudo-syntax-check":
path => ['/usr/sbin/', '/usr/bin/'],
command => "visudo -c -f '${sudoers_path}' || (rm -f '${sudoers_path}' && exit 1)",
refreshonly => true,
}
}
$scripts.each |$name, $data| {
tripleo::profile::base::metrics::collectd::sensubility_script { $name:
checksum => $data['checksum'],
source => $data['source'],
user => $exec_user,
group => $exec_group,
scriptsdir => $scriptsdir,
create_bin_link => has_key($data, 'create_bin_link') ? {
true => $data['create_bin_link'],
default => true
}
}
}
}
|