linux-system-roles.metrics

Metrics

ansible-lint.yml ansible-test.yml markdownlint.yml shellcheck.yml subtree.yml tft.yml tft_citest_bad.yml woke.yml

This is an Ansible role that sets up performance analysis services for a managed computer. It can also include a list of remote systems that the managed computer will monitor.

Requirements

You need Performance Co-Pilot (PCP) version 5 or higher. The necessary packages can be found in the standard repositories for Fedora, CentOS 8, and RHEL 8. For RHEL 7 and RHEL 6, you’ll need to enable the Optional repository/channel on your managed computer.

This role can also use Grafana v6 or newer (metrics_graph_service) and Redis v5 or newer (metrics_query_service) on Fedora, CentOS 8, RHEL 8, and later versions.

Collection Requirements

This role requires the firewall and selinux roles from the fedora.linux_system_roles collection if the metrics_manage_firewall and metrics_manage_selinux options are set to true, respectively. (For more details, see the Role Variables section.)

If the metrics role is from the fedora.linux_system_roles collection or installed as a Fedora RPM package, these requirements are automatically met.

For managing rpm-ostree systems, install the required collections using:

ansible-galaxy collection install -r meta/collection-requirements.yml

Role Variables

metrics_monitored_hosts: []

This variable lists the remote hosts that will be monitored by the managed computer. Ensure there is enough disk space under /var/log for each host to store their metrics.

Example:

metrics_monitored_hosts: ["webserver.example.com", "database.example.com"]

metrics_webhook_endpoint: ''

This is the URL where notifications about automatic performance issues will be sent. By default, these events are only logged locally.

metrics_retention_days: 14

This specifies how many days historical performance data will be retained before it is deleted.

metrics_graph_service: false

A flag that allows setting up graphing services. When enabled, it starts PCP and Grafana servers for visualizing metrics. Requires Grafana v6 or higher.

metrics_query_service: false

This flag allows setting up time series query services. When enabled, it starts PCP and Redis servers for querying recorded metrics. Requires Redis v5 or higher.

metrics_into_elasticsearch: false

This flag allows exporting metric values into Elasticsearch.

metrics_from_elasticsearch: false

This flag lets metrics from Elasticsearch be available for use.

metrics_from_postfix: false

This flag allows metrics from Postfix to be available.

metrics_from_mssql: false

This enables metrics from SQL Server to be accessible. Requires a 'trusted' connection to SQL Server.

metrics_from_bpftrace: false

This allows metrics from bpftrace to be accessible.

metrics_username: metrics

This is the username used to access remote metrics through the PCP pmcd daemon. For more information, refer to the PCP documentation.

If bpftrace metrics are enabled, this user can register bpftrace scripts.

metrics_password: metrics

Do not use a plain text metrics_password. Use Ansible Vault to encrypt it. This is required for executing dynamic bpftrace scripts.

metrics_provider: pcp

This is the metrics collector that will be used. Performance Co-Pilot is currently the only supported provider, utilizing specific TCP ports for various services.

metrics_manage_firewall: false

This flag enables firewall configuration through the firewall role. It manages specific ports according to the settings. If disabled, the role won't manage the firewall.

Note: metrics_manage_firewall can only add ports, not remove them.

Note: Firewall management is not supported on RHEL 6.

metrics_manage_selinux: false

This flag enables the configuration of SELinux using the selinux role. It manages specific ports. If set to false, this role won't manage SELinux settings.

Note: The services are in the "ephemeral" range so no special setup is needed, but the Redis port may require further configuration.

Note: metrics_manage_selinux can only add policy, not remove it.

Example Playbook

Here are different playbook examples for managing metrics:

Simple setup recording metrics for each managed host, keeping data for one week:

---
- name: Manage metrics service
  hosts: all
  vars:
    metrics_retention_days: 7
  roles:
    - linux-system-roles.metrics

Advanced setup with graphing and querying services enabled:

---
- name: Manage metrics with graph and query services
  hosts: all
  vars:
    metrics_graph_service: true
    metrics_query_service: true
  roles:
    - linux-system-roles.metrics

Centralized setup for gathering metrics from multiple remote hosts while enabling graphing and querying on the local host:

---
- name: Manage centralized metrics gathering
  hosts: monitors
  vars:
    metrics_monitored_hosts: [app.example.com, db.example.com, nas.example.com]
    metrics_graph_service: true
    metrics_query_service: true
  roles:
    - linux-system-roles.metrics

rpm-ostree

See README-ostree.md for more details.

License

MIT

Installa
ansible-galaxy install linux-system-roles.metrics
Licenza
mit
Download
3.5k
Proprietario