Role - tripleo_collectd

Role Documentation

Welcome to the “tripleo_collectd” role documentation.

Role Defaults

This section highlights all of the defaults and variables set within the “tripleo_collectd” role.

# Corresponds to MetricsQdrPort in THT
# Service name or port number on which the qdrouterd will accept connections.
metrics_qdr_port: 5666

# Corresponds to MetricsQdrUsername in THT
# Username which should be used to authenticate to the deployed qdrouterd.
metrics_qdr_username: guest

# Corresponds to MetricsQdrPassword in THT
# Password which should be used to authenticate to the deployed qdrouterd.
metrics_qdr_password: guest

# Corresponds to MonitoringSubscriptionCollectd in THT
tripleo_collectd_monitoring_subscription: overcloud-collectd

# Corresponds to CollectdConnectionType in THT
# Define which write plugin should collectd use. Currently supported are 'amqp1',
# 'network' and 'gnocchi'.
tripleo_collectd_connection_type: amqp1

# Corresponds to CollectdDefaultPollingInterval in THT
# Controls how often registered read functions are called and with that the
# resolution of the collected data. This value can be overridden per plugin(per
# role) by setting "::collectd::plugin::<plugin_name>::interval" key in
# ExtraConfig(<role_name>ExtraConfig).
tripleo_collectd_default_polling_interval: 120

# Corresponds to CollectdDefaultPlugins in THT
# List of collectd plugins to activate on all overcloud hosts.  See the
# documentation for the puppet-collectd module for a list plugins supported by
# the module (https://github.com/voxpupuli/puppet-collectd). Set this key to
# override the default list of plugins.  Use CollectdExtraPlugins if you want to
# load additional plugins without overriding the defaults.
tripleo_collectd_default_plugins: [cpu, df, disk, hugepages, interface, load, memory,
  processes, unixsock, uptime]

# Corresponds to CollectdExtraPlugins in THT
# List of collectd plugins to activate on all overcloud hosts.  See the
# documentation for the puppet-collectd module for a list plugins supported by
# the module (https://github.com/voxpupuli/puppet-collectd). Set this key to load
# plugins in addition to those in CollectdDefaultPlugins.
tripleo_collectd_extra_plugins: []

# Corresponds to CollectdServer in THT
# Address of remote collectd server to which we will send metrics.
tripleo_collectd_server:

# Corresponds to CollectdServerPort in THT
# Port on remote collectd server to which we will send metrics.
tripleo_collectd_server_port: 25826

# Corresponds to CollectdUsername in THT
# Username for authenticating to the remote collectd server. The default is to
# not configure any authentication.
tripleo_collectd_username:

# Corresponds to CollectdPassword in THT
# Password for authenticating to the remote collectd server. The default is to
# not configure any authentication.
tripleo_collectd_password:

# Corresponds to CollectdSecurityLevel in THT
# Security level setting for remote collectd connection. If it is set to Sign or
# Encrypt the CollectdPassword and CollectdUsername parameters need to be set.
tripleo_collectd_security_level: None

# Corresponds to EnableSQLAlchemyCollectd in THT
# Set to true to enable the SQLAlchemy-collectd server plugin
tripleo_collectd_enable_sqlalchemy: false

# Corresponds to CollectdSQLAlchemyLogMessages in THT
# set to "debug" to enable message logging.
tripleo_collectd_sqlalchemy_log_messages: info

# Corresponds to CollectdSQLAlchemyBindHost in THT
# hostname for SQLAlchemy-collectd plugin to bind on.  defaults to localhost.
tripleo_collectd_sqlalchemy_bind_host: localhost

# Corresponds to CollectdAmqpHost in THT
# Hostname or IP address of the AMQP 1.0 intermediary.
tripleo_collectd_amqp_host: nil

# Corresponds to CollectdAmqpPort in THT
# 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.
tripleo_collectd_amqp_port: 5666

# Corresponds to CollectdAmqpUser in THT
# User part of credentials used to authenticate to the AMQP 1.0 intermediary.
tripleo_collectd_amqp_user: guest

# Corresponds to CollectdAmqpPassword in THT
# Password part of credentials used to authenticate to the AMQP 1.0 intermediary.
tripleo_collectd_amqp_password: guest

# Corresponds to CollectdAmqpTransportName in THT
# Name of the AMQP 1.0 transport.
tripleo_collectd_amqp_transport_name: metrics

# Corresponds to CollectdAmqpAddress in THT
# This option specifies the prefix for the send-to value in the message.
tripleo_collectd_amqp_address: collectd

# Corresponds to CollectdAmqpInstances in THT
# Hash of hashes. Each inner hash represent Instance block in plugin
# configuration file. Key of outter hash represents instance name. The 'address'
# value concatenated with the 'name' given will be used as the send-to address
# for communications over the messaging link.
tripleo_collectd_amqp_instances: {}

# Corresponds to CollectdAmqpRetryDelay in THT
# When the AMQP 1.0 connection is lost, defines the time in seconds to wait
# before attempting to reconnect.
tripleo_collectd_amqp_retry_delay: 1

# Corresponds to CollectdAmqpInterval in THT
# Interval on which metrics should be sent to AMQP intermediary. If not set the
# default for all collectd plugins is used.
tripleo_collectd_amqp_interval: -666

# Corresponds to CollectdAmqpSendQueueLimit in THT
# Number of data sets to be kept in memory, older sets will be discarded,
# if set to -1, this feature is disabled.
tripleo_collectd_amqp_send_queue_limit: -1

# Corresponds to CollectdEnableSensubility in THT
# Set to true if sensubility should be executed by exec plugin.
tripleo_collectd_enable_sensubility: false

# Corresponds to CollectdSensubilityExecSudoRule in THT
# Given rule will be created in /etc/sudoers.d for sensubility to enable it
# calling restricted commands via sensubility executor.
tripleo_collectd_sensubility_exec_sudo_rule: ''

# Corresponds to CollectdSensubilityLogLevel in THT
# Use for override the default logging level (WARNING).
tripleo_collectd_sensubility_log_level: WARNING

# Corresponds to CollectdSensubilityConnection in THT
# URL to Sensu sever side
tripleo_collectd_sensubility_connection: amqp://sensu:sensu@localhost:5672//sensu

tripleo_collectd_sensubility_subscriptions: []

# Corresponds to CollectdSensubilityKeepaliveInterval in THT
# Interval in seconds for sending keepalive messages to Sensu server side.
tripleo_collectd_sensubility_keepalive_interval: 20

# Corresponds to CollectdSensubilityTmpDir in THT
# Path to temporary directory which is used for creation of check scripts.
tripleo_collectd_sensubility_tmp_dir: /var/tmp/collectd-sensubility-checks

# Corresponds to CollectdSensubilityShellPath in THT
# Path to shell used for executing check scripts.
tripleo_collectd_sensubility_shell_path: /usr/bin/sh

# Corresponds to CollectdSensubilityWorkerCount in THT
# Number of goroutines spawned for executing check scripts.
tripleo_collectd_sensubility_worker_count: 2

# Corresponds to CollectdSensubilityChecks in THT
# JSON formated definition of standalone checks to be scheduled on client side.
tripleo_collectd_sensubility_checks: {}

# Corresponds to CollectdSensubilityTransport in THT
# Bus type for sent data. Options are 'sensu' (rabbitmq) and 'amqp1'
tripleo_collectd_sensubility_transport: sensu

# Corresponds to CollectdSensubilityResultsChannel in THT
# AMQP1 channel address
tripleo_collectd_sensubility_results_channel: collectd/notify

# Corresponds to CollectdEnableContainerHealthCheck in THT
# Set to false if container health check should not be defined and attached to
# CollectdEnableContainerHealthCheck.
tripleo_collectd_enable_container_health_check: true

# Corresponds to CollectdContainerHealthCheckCommand in THT
# The command to be run by sensubility when the health check is enabled.
# Defaults to a script that is expected to be placed by TripleO at the given
# location.
tripleo_collectd_container_health_check_command: /scripts/collectd_check_health.py

# Corresponds to CollectdContainerHealthCheckInterval in THT
# The frequency in seconds the docker health check is executed.
tripleo_collectd_container_health_check_interval: 10

# Corresponds to CollectdContainerHealthCheckHandlers in THT
# The Sensu event handler to use for events created by the docker health check.
tripleo_collectd_container_health_check_handlers: []

# Corresponds to CollectdContainerHealthCheckOccurrences in THT
# The number of event occurrences before sensu-plugin-aware handler should take
# action.
tripleo_collectd_container_health_check_occurrences: 3

# Corresponds to CollectdContainerHealthCheckRefresh in THT
# The number of seconds sensu-plugin-aware handlers should wait before taking
# second action.
tripleo_collectd_container_health_check_refresh: 90

# Corresponds to EnableSTF in THT
# Set to true to enable configuration for STF client.
tripleo_collectd_enable_stf: false

# Corresponds to CollectdEnableMcelog in THT
# Set to true to enable mcelog
tripleo_collectd_enable_mcelog: false

# Corresponds to CollectdEnableLibpodstats in THT
# Set to true if collectd should run the libpodstats plugin
tripleo_collectd_enable_libpodstats: false

Role Variables: main.yml

# Vars to be passed to the collectd_config role
collectd_conf_output_dir: /var/lib/config-data/ansible-generated/collectd/etc/collectd.d

# TODO: Add actions for these to collectd-config-ansible-role
#   - collectd::manage_repo: false
#     collectd::purge: true
#     collectd::recurse: true
#     collectd::purge_config: true
#     collectd::minimum_version: "5.7"

# Plugin configuration
collectd_plugin_cpu_reportbycpu: true
collectd_plugin_cpu_reportbystate: true
collectd_plugin_cpu_reportnumcpu: false
collectd_plugin_cpu_valuespercentage: true

collectd_plugin_df_fstypes:
- xfs
collectd_plugin_df_ignoreselected: true
collectd_plugin_df_reportbydevice: true

collectd_plugin_load_reportrelative: true

collectd_plugin_logfile_file: /var/log/collectd/collectd.log

collectd_plugin_unixsock_socketgroup: root
collectd_plugin_unixsock_socketfile: /run/collectd-socket
collectd_plugin_unixsock_delete_socket: true

collectd_plugin_virt_connection: qemu:///system
collectd_plugin_virt_extrastats: >-
  "pcpu cpu_util vcpupin vcpu memory disk disk_err disk_allocation disk_capacity disk_physical
  domain_state job_stats_background perf"
collectd_plugin_virt_hostnameformat: hostname

Molecule Scenarios

Molecule is being used to test the “tripleo_collectd” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.

Scenario: default

Driver: podman
Molecule Inventory
hosts:
  all:
    hosts:
      collectd-test:
        ansible_python_interpreter: /usr/bin/python3
host_vars:
  collectd-test:
    collectd_conf_output_dir: /etc/collectd.d/
Example default playbook
- name: Converge
  hosts: collectd-test
  tasks:
  - name: Set up expected THT vars
    set_fact:
      tripleo_role_name: SomeRole
      service_net_map:
        some_role_metrics_qdr_network: ctlplane
      ctlplane_ip: 10.0.0.42

  - name: Use tripleo_collectd to configure collectd with defaults
    include_role:
      name: '{{ playbook_dir }}/../../../tripleo_collectd'
      tasks_from: configure_collectd
    vars:
      collectd_conf_output_dir: /etc/collectd.d/

Scenario: amqp_connection_default_interval

Driver: podman
Molecule Inventory
hosts:
  all:
    hosts:
      collectd-test:
        ansible_python_interpreter: /usr/bin/python3
host_vars:
  collectd-test:
    collectd_conf_output_dir: /etc/collectd.d/
Example amqp_connection_default_interval playbook
- name: Converge
  hosts: collectd-test
  tasks:
  - name: Set up expected THT vars
    set_fact:
      tripleo_role_name: SomeRole
      service_net_map:
        some_role_metrics_qdr_network: ctlplane
      ctlplane_ip: 10.0.0.42

  - name: Use tripleo_collectd to configure collectd using the default interval for
      amqp
    include_role:
      name: '{{ playbook_dir }}/../../../tripleo_collectd'
      tasks_from: configure_collectd
    vars:
      collectd_conf_output_dir: /etc/collectd.d/
      tripleo_collectd_amqp_host: collectd-test
      tripleo_collectd_connection_type: amqp1
      tripleo_collectd_amqp_interval: -666

Scenario: collectd_connection

Driver: podman
Molecule Inventory
hosts:
  all:
    hosts:
      collectd-test:
        ansible_python_interpreter: /usr/bin/python3
      collectd-server:
        ansible_python_interpreter: /usr/bin/python3
host_vars:
  collectd-test:
    collectd_conf_output_dir: /etc/collectd.d/
Example collectd_connection playbook
- name: Converge
  hosts: collectd-test
  tasks:
  - name: Use tripleo_collectd to configure collectd to sent metrics using the network
      plugin
    include_role:
      name: '{{ playbook_dir }}/../../../tripleo_collectd'
      tasks_from: configure_collectd
    vars:
      collectd_conf_output_dir: /etc/collectd.d/
      tripleo_collectd_connection_type: network
      tripleo_collectd_server: 192.168.42.2

- name: Converge collectd-server
  hosts: collectd-server
  tasks:
  - name: Configure collectd on the server to receive metrics
    include_role:
      name: collectd_config
    vars:
      collectd_conf_output_dir: /etc/collectd.d/
      collectd_plugin_network_listen:
      - address: 192.168.42.2
      collectd_plugins:
      - logfile
      - network
      - unixsock

Scenario: enable_sensubility_libpodstats_sqlalchemy

Driver: podman
Molecule Inventory
hosts:
  all:
    hosts:
      collectd-test:
        ansible_python_interpreter: /usr/bin/python3
host_vars:
  collectd-test:
    collectd_conf_output_dir: /etc/collectd.d/
Example enable_sensubility_libpodstats_sqlalchemy playbook
- name: Converge
  hosts: collectd-test
  tasks:
  - set_fact:
      tripleo_role_name: SomeRole
      service_net_map:
        some_role_metrics_qdr_network: ctlplane
      ctlplane_ip: 10.0.0.42
      fqdn_ctlplane: standalone.ctlplane.localdomain

  - include_role:
      name: '{{ playbook_dir }}/../../../tripleo_collectd'
      tasks_from: configure_collectd
    vars:
      collectd_conf_output_dir: /etc/collectd.d/
      tripleo_collectd_enable_sensubility: true
      tripleo_collectd_enable_libpodstats: true
      tripleo_collectd_enable_sqlalchemy: true
      tripleo_collectd_sensubility_exec_sudo_rule: 'collectd ALL = NOPASSWD: ALL'

Scenario: enable_stf

Driver: podman
Molecule Inventory
hosts:
  all:
    hosts:
      collectd-test:
        ansible_python_interpreter: /usr/bin/python3
host_vars:
  collectd-test:
    collectd_conf_output_dir: /etc/collectd.d/
Example enable_stf playbook
- name: Converge
  hosts: collectd-test
  tasks:
  - name: Set up expected THT vars
    set_fact:
      tripleo_role_name: SomeRole
      service_net_map:
        some_role_metrics_qdr_network: ctlplane
      ctlplane_ip: 10.0.0.42

  - name: Include tripleo-collectd-ansible-role
    include_role:
      name: '{{ playbook_dir }}/../../../tripleo_collectd'
      tasks_from: configure_collectd
    vars:
      collectd_conf_output_dir: /etc/collectd.d/
      tripleo_collectd_enable_stf: true