├── roles ├── keyserver │ ├── templates │ │ ├── redis.conf.j2 │ │ ├── valkey.conf.j2 │ │ ├── CentOS_8_keyserver.conf.j2 │ │ ├── CentOS_9_keyserver.conf.j2 │ │ ├── RedHat_8_keyserver.conf.j2 │ │ ├── RedHat_9_keyserver.conf.j2 │ │ ├── CentOS_10_keyserver.conf.j2 │ │ └── RedHat_10_keyserver.conf.j2 │ ├── vars │ │ ├── main.yml │ │ ├── default.yml │ │ ├── CentOS_6.yml │ │ ├── CentOS_7.yml │ │ ├── CentOS_8.yml │ │ ├── CentOS_9.yml │ │ ├── Fedora.yml │ │ ├── CentOS_10.yml │ │ ├── RedHat_6.yml │ │ ├── RedHat_7.yml │ │ ├── RedHat_8.yml │ │ ├── RedHat_9.yml │ │ ├── RedHat_10.yml │ │ └── Debian.yml │ ├── defaults │ │ └── main.yml │ ├── handlers │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── spark │ ├── templates │ │ ├── spark.url.j2 │ │ └── pcp2spark.service.j2 │ ├── vars │ │ ├── default.yml │ │ ├── CentOS_6.yml │ │ ├── RedHat_6.yml │ │ ├── Fedora.yml │ │ ├── CentOS_10.yml │ │ ├── CentOS_8.yml │ │ ├── CentOS_9.yml │ │ ├── RedHat.yml │ │ ├── RedHat_8.yml │ │ ├── RedHat_9.yml │ │ ├── RedHat_10.yml │ │ ├── CentOS_7.yml │ │ ├── Debian.yml │ │ ├── RedHat_7.yml │ │ └── main.yml │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── mssql │ ├── handlers │ │ └── main.yml │ ├── vars │ │ ├── default.yml │ │ ├── Debian.yml │ │ ├── CentOS_6.yml │ │ ├── CentOS_7.yml │ │ ├── CentOS_9.yml │ │ ├── CentOS_10.yml │ │ ├── RedHat_6.yml │ │ ├── RedHat_7.yml │ │ ├── CentOS_8.yml │ │ ├── Fedora.yml │ │ ├── RedHat_10.yml │ │ ├── RedHat_9.yml │ │ ├── RedHat_8.yml │ │ └── main.yml │ ├── defaults │ │ └── main.yml │ ├── templates │ │ └── mssql.conf.j2 │ ├── meta │ │ └── main.yml │ ├── files │ │ └── stolen_node_memory │ ├── README.md │ └── tasks │ │ └── main.yml ├── pcp │ ├── vars │ │ ├── default.yml │ │ ├── CentOS_7.yml │ │ ├── CentOS_8.yml │ │ ├── CentOS_9.yml │ │ ├── CentOS_10.yml │ │ ├── RedHat_10.yml │ │ ├── RedHat_7.yml │ │ ├── RedHat_8.yml │ │ ├── RedHat_9.yml │ │ ├── RedHat.yml │ │ ├── CentOS_6.yml │ │ ├── RedHat_6.yml │ │ ├── Debian.yml │ │ ├── Fedora.yml │ │ └── main.yml │ ├── templates │ │ ├── pmcd.explicit.labels.j2 │ │ ├── pmcd.implicit.labels.j2 │ │ ├── pmie.controld.j2 │ │ ├── pmlogger.controld.j2 │ │ ├── pmie.control.j2 │ │ ├── pmlogger.control.j2 │ │ ├── pmproxy.defaults.j2 │ │ ├── pmcd.sasl2.conf.j2 │ │ ├── pmlogger.timers.j2 │ │ ├── pmlogger.defaults.j2 │ │ └── pmcd.defaults.j2 │ ├── defaults │ │ └── main.yml │ ├── tasks │ │ ├── pmproxy.yml │ │ ├── pmlogger.yml │ │ ├── main.yml │ │ ├── pmcd.yml │ │ └── pmie.yml │ ├── handlers │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── files │ │ ├── zeroconf │ │ │ └── all_threads │ │ ├── filesys │ │ │ └── vfs_files │ │ ├── network │ │ │ ├── tcplistenoverflows │ │ │ ├── tcpqfulldrops │ │ │ └── tcpqfulldocookies │ │ └── power │ │ │ └── thermal_throttle │ └── README.md ├── repository │ ├── vars │ │ ├── main.yml │ │ ├── default.yml │ │ ├── Fedora.yml │ │ ├── RedHat.yml │ │ └── Debian.yml │ ├── defaults │ │ └── main.yml │ ├── handlers │ │ └── main.yml │ ├── templates │ │ ├── packagecloud.debs.j2 │ │ └── packagecloud.rpms.j2 │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── bpftrace │ ├── handlers │ │ └── main.yml │ ├── vars │ │ ├── default.yml │ │ ├── RedHat.yml │ │ ├── CentOS_6.yml │ │ ├── CentOS_7.yml │ │ ├── RedHat_6.yml │ │ ├── RedHat_7.yml │ │ ├── Debian.yml │ │ ├── Fedora.yml │ │ ├── CentOS_8.yml │ │ ├── CentOS_9.yml │ │ ├── CentOS_10.yml │ │ ├── RedHat_10.yml │ │ ├── RedHat_8.yml │ │ ├── RedHat_9.yml │ │ └── main.yml │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── templates │ │ └── bpftrace.conf.j2 │ ├── README.md │ └── tasks │ │ └── main.yml ├── grafana │ ├── defaults │ │ └── main.yml │ ├── files │ │ ├── grafana-pcp-settings.json │ │ └── grafana-pcp-provisioning.yaml │ ├── vars │ │ ├── default.yml │ │ ├── main.yml │ │ ├── CentOS_6.yml │ │ ├── CentOS_7.yml │ │ ├── CentOS_8.yml │ │ ├── RedHat.yml │ │ ├── RedHat_6.yml │ │ ├── RedHat_7.yml │ │ ├── CentOS_9.yml │ │ ├── Fedora.yml │ │ ├── CentOS_10.yml │ │ ├── Debian.yml │ │ ├── RedHat_8.yml │ │ ├── RedHat_9.yml │ │ └── RedHat_10.yml │ ├── handlers │ │ └── main.yml │ ├── templates │ │ └── grafana-pcp-datasources.yaml.j2 │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── postfix │ ├── handlers │ │ └── main.yml │ ├── vars │ │ ├── main.yml │ │ ├── default.yml │ │ ├── CentOS.yml │ │ ├── Fedora.yml │ │ ├── Debian.yml │ │ └── RedHat.yml │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml └── elasticsearch │ ├── vars │ ├── default.yml │ ├── Fedora.yml │ ├── CentOS_6.yml │ ├── RedHat.yml │ ├── RedHat_6.yml │ ├── CentOS_10.yml │ ├── CentOS_9.yml │ ├── Debian.yml │ ├── CentOS_7.yml │ ├── CentOS_8.yml │ ├── RedHat_10.yml │ ├── RedHat_9.yml │ ├── RedHat_7.yml │ ├── RedHat_8.yml │ └── main.yml │ ├── templates │ ├── elasticsearch.conf.j2 │ └── pcp2elasticsearch.service.j2 │ ├── defaults │ └── main.yml │ ├── meta │ └── main.yml │ ├── README.md │ └── tasks │ └── main.yml ├── tests ├── roles │ ├── performancecopilot.metrics.pcp │ ├── performancecopilot.metrics.mssql │ ├── performancecopilot.metrics.spark │ ├── performancecopilot.metrics.bpftrace │ ├── performancecopilot.metrics.grafana │ ├── performancecopilot.metrics.postfix │ ├── performancecopilot.metrics.keyserver │ ├── performancecopilot.metrics.repository │ └── performancecopilot.metrics.elasticsearch ├── get_ansible_managed.j2 ├── check_pcp.yml ├── get_services_state.yml ├── tests_default.yml ├── check_grafana.yml ├── check_pmproxy.yml ├── check_into_elasticsearch.yml ├── check_pcp2spark.yml ├── check_pcp2elasticsearch.yml ├── check_mssql.yml ├── check_postfix.yml ├── check_retention.yml ├── check_from_elasticsearch.yml ├── check_keyserver.yml ├── check_grafana_pcp.yml ├── check_pmdamssql.yml ├── check_pmdabpftrace.yml ├── check_pmdaopenmetrics.yml ├── check_header.yml ├── check_pmdaelasticsearch.yml ├── check_pmie.yml ├── check_pmlogger.yml ├── check_default_datasources.yml ├── check_bpftrace.yml ├── tests_verify_basic.yml ├── check_sasl.yml ├── tests_verify_retention.yml ├── restore_services_state.yml ├── tests_verify_pmie_webhook.yml ├── tests_verify_repository.yml ├── tests_verify_spark.yml ├── tests_verify_into_elasticsearch.yml ├── check_pmie_webhook.yml ├── tests_verify_from_elasticsearch.yml ├── tests_verify_keyserver.yml ├── tests_verify_postfix.yml ├── tests_verify_grafana.yml ├── tests_verify_bpftrace.yml ├── tests_verify_auth.yml ├── tests_verify_mssql.yml └── tests_verify_fullstack.yml ├── .wokeignore ├── .github ├── FUNDING.yml ├── pull_request_template.md ├── CODEOWNERS ├── dependabot.yml └── workflows │ ├── ansible-lint.yml │ ├── woke.yml │ ├── pr-title-lint.yml │ ├── markdownlint.yml │ └── tox.yml ├── meta └── runtime.yml ├── .yamllint.yml ├── docs ├── grafana │ └── setup.yml ├── keyserver │ └── setup.yml ├── postfix │ └── basic.yml ├── mssql │ ├── secure.yml │ └── basic.yml ├── repository │ └── setup.yml ├── spark │ └── setup.yml ├── elasticsearch │ └── setup.yml ├── bpftrace │ └── setup.yml └── pcp │ ├── users.yml │ ├── farms.yml │ └── setup.yml ├── scripts ├── lsrcollection.sh └── redhat.rhel_metrics ├── .gitignore ├── tox.ini ├── .ansible-lint ├── plugins └── README.md ├── molecule └── default │ ├── molecule.yml │ └── Dockerfile.j2 ├── LICENSE ├── galaxy.yml ├── README.md ├── .commitlintrc.js └── .markdownlint.yaml /roles/keyserver/templates/redis.conf.j2: -------------------------------------------------------------------------------- 1 | redis_6.conf.j2 -------------------------------------------------------------------------------- /roles/keyserver/templates/valkey.conf.j2: -------------------------------------------------------------------------------- 1 | valkey_7.conf.j2 -------------------------------------------------------------------------------- /tests/roles/performancecopilot.metrics.pcp: -------------------------------------------------------------------------------- 1 | ../../roles/pcp -------------------------------------------------------------------------------- /tests/roles/performancecopilot.metrics.mssql: -------------------------------------------------------------------------------- 1 | ../../roles/mssql -------------------------------------------------------------------------------- /tests/roles/performancecopilot.metrics.spark: -------------------------------------------------------------------------------- 1 | ../../roles/spark -------------------------------------------------------------------------------- /roles/keyserver/templates/CentOS_8_keyserver.conf.j2: -------------------------------------------------------------------------------- 1 | redis_5.conf.j2 -------------------------------------------------------------------------------- /roles/keyserver/templates/CentOS_9_keyserver.conf.j2: -------------------------------------------------------------------------------- 1 | redis_5.conf.j2 -------------------------------------------------------------------------------- /roles/keyserver/templates/RedHat_8_keyserver.conf.j2: -------------------------------------------------------------------------------- 1 | redis_5.conf.j2 -------------------------------------------------------------------------------- /roles/keyserver/templates/RedHat_9_keyserver.conf.j2: -------------------------------------------------------------------------------- 1 | redis_5.conf.j2 -------------------------------------------------------------------------------- /roles/spark/templates/spark.url.j2: -------------------------------------------------------------------------------- 1 | {{ spark_metrics_agent_url }} 2 | -------------------------------------------------------------------------------- /tests/roles/performancecopilot.metrics.bpftrace: -------------------------------------------------------------------------------- 1 | ../../roles/bpftrace -------------------------------------------------------------------------------- /tests/roles/performancecopilot.metrics.grafana: -------------------------------------------------------------------------------- 1 | ../../roles/grafana -------------------------------------------------------------------------------- /tests/roles/performancecopilot.metrics.postfix: -------------------------------------------------------------------------------- 1 | ../../roles/postfix -------------------------------------------------------------------------------- /.wokeignore: -------------------------------------------------------------------------------- 1 | roles/keyserver/templates/ 2 | roles/grafana/templates/ 3 | -------------------------------------------------------------------------------- /roles/keyserver/templates/CentOS_10_keyserver.conf.j2: -------------------------------------------------------------------------------- 1 | valkey_7.conf.j2 -------------------------------------------------------------------------------- /roles/keyserver/templates/RedHat_10_keyserver.conf.j2: -------------------------------------------------------------------------------- 1 | valkey_7.conf.j2 -------------------------------------------------------------------------------- /roles/keyserver/vars/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /roles/mssql/handlers/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /roles/pcp/vars/default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /roles/repository/vars/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /tests/roles/performancecopilot.metrics.keyserver: -------------------------------------------------------------------------------- 1 | ../../roles/keyserver -------------------------------------------------------------------------------- /tests/roles/performancecopilot.metrics.repository: -------------------------------------------------------------------------------- 1 | ../../roles/repository -------------------------------------------------------------------------------- /roles/bpftrace/handlers/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /roles/grafana/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /roles/postfix/handlers/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /roles/repository/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /roles/repository/handlers/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /roles/repository/vars/default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | -------------------------------------------------------------------------------- /tests/roles/performancecopilot.metrics.elasticsearch: -------------------------------------------------------------------------------- 1 | ../../roles/elasticsearch -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | --- 2 | custom: https://hcb.hackclub.com/donations/start/pcp 3 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmcd.explicit.labels.j2: -------------------------------------------------------------------------------- 1 | {{ pcp_explicit_labels | to_nice_json }} 2 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmcd.implicit.labels.j2: -------------------------------------------------------------------------------- 1 | {{ pcp_implicit_labels | to_nice_json }} 2 | -------------------------------------------------------------------------------- /meta/runtime.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | requires_ansible: ">=2.16.0" 4 | -------------------------------------------------------------------------------- /tests/get_ansible_managed.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment(__comment_type | d("plain")) }} 2 | -------------------------------------------------------------------------------- /roles/grafana/files/grafana-pcp-settings.json: -------------------------------------------------------------------------------- 1 | {"enabled":true,"pinned":true,"jsonData":null} 2 | -------------------------------------------------------------------------------- /.yamllint.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | ignore: | 4 | /.tox/ 5 | extends: default 6 | -------------------------------------------------------------------------------- /roles/postfix/vars/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | __postfix_packages_extra: [] 5 | -------------------------------------------------------------------------------- /roles/keyserver/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | keyserver_save_to_disk: true 4 | -------------------------------------------------------------------------------- /roles/keyserver/vars/default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | __keyserver_conf_link: /etc 5 | -------------------------------------------------------------------------------- /roles/mssql/vars/default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | mssql_metrics_provider: 'pcp' 5 | -------------------------------------------------------------------------------- /roles/spark/vars/default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | spark_metrics_provider: 'pcp' 5 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | bpftrace_metrics_provider: 'pcp' 5 | -------------------------------------------------------------------------------- /roles/grafana/vars/default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | grafana_metrics_provider: 'pcp' 5 | -------------------------------------------------------------------------------- /roles/postfix/vars/default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | postfix_metrics_provider: 'pcp' 5 | -------------------------------------------------------------------------------- /roles/bpftrace/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | bpftrace_users: 5 | - {user: metrics} 6 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | elasticsearch_metrics_provider: 'pcp' 5 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Enhancement: 2 | 3 | Reason: 4 | 5 | Result: 6 | 7 | Issue Tracker Tickets (Jira or BZ if any): 8 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/RedHat.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat specific values. 4 | -------------------------------------------------------------------------------- /tests/check_pcp.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if PCP works 4 | command: pcp 5 | changed_when: false 6 | -------------------------------------------------------------------------------- /docs/grafana/setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of grafana 3 | hosts: all 4 | roles: 5 | - role: performancecopilot.metrics.grafana 6 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # https://help.github.com/en/articles/about-code-owners 2 | # Default reviewers for everything 3 | * @pcp-ansible-maintainers 4 | -------------------------------------------------------------------------------- /docs/keyserver/setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of key server 3 | hosts: all 4 | roles: 5 | - role: performancecopilot.metrics.keyserver 6 | -------------------------------------------------------------------------------- /docs/postfix/basic.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of postfix 3 | hosts: monitoring 4 | roles: 5 | - role: performancecopilot.metrics.postfix 6 | -------------------------------------------------------------------------------- /docs/mssql/secure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of secure Microsoft SQL 3 | hosts: monitoring 4 | roles: 5 | - role: performancecopilot.metrics.mssql 6 | -------------------------------------------------------------------------------- /roles/mssql/vars/Debian.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Debian specific values. 4 | 5 | __mssql_packages_pcp: 6 | - pcp 7 | -------------------------------------------------------------------------------- /roles/spark/vars/CentOS_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 6 specific values. 4 | 5 | __spark_packages_export_pcp: [] 6 | -------------------------------------------------------------------------------- /roles/repository/vars/Fedora.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Fedora specific values. 4 | 5 | __repository_distro_name: "fedora" 6 | -------------------------------------------------------------------------------- /roles/repository/vars/RedHat.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat specific values. 4 | 5 | __repository_distro_name: "el" 6 | -------------------------------------------------------------------------------- /roles/mssql/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | mssql_agent_trusted: true 5 | mssql_agent_username: '' 6 | mssql_agent_password: '' 7 | mssql_agent_timeout: 2 8 | -------------------------------------------------------------------------------- /roles/postfix/vars/CentOS.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS specific values. 4 | 5 | __postfix_packages_pcp: 6 | - pcp-pmda-postfix 7 | -------------------------------------------------------------------------------- /roles/postfix/vars/Fedora.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Fedora specific values. 4 | 5 | __postfix_packages_pcp: 6 | - pcp-pmda-postfix 7 | -------------------------------------------------------------------------------- /tests/get_services_state.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Get initial state of services 4 | tags: tests::cleanup 5 | service_facts: 6 | register: initial_state 7 | -------------------------------------------------------------------------------- /tests/tests_default.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test the pcp role with default params 4 | hosts: all 5 | 6 | roles: 7 | - performancecopilot.metrics.pcp 8 | -------------------------------------------------------------------------------- /docs/repository/setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of repository 3 | hosts: all 4 | roles: 5 | - role: performancecopilot.metrics.repository 6 | - role: performancecopilot.metrics.pcp 7 | -------------------------------------------------------------------------------- /roles/postfix/vars/Debian.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Debian specific values. 4 | 5 | __postfix_packages_pcp: 6 | - pcp 7 | - postfix 8 | -------------------------------------------------------------------------------- /roles/spark/vars/RedHat_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 6 specific values. 4 | 5 | __spark_packages_export_pcp: [] 6 | -------------------------------------------------------------------------------- /tests/check_grafana.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if Grafana works 4 | uri: 5 | url: http://localhost:3000/login 6 | method: GET 7 | status_code: 200 8 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/CentOS_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 6 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | 7 | __bpftrace_packages: 8 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/CentOS_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 7 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | 7 | __bpftrace_packages: 8 | -------------------------------------------------------------------------------- /tests/check_pmproxy.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if pmproxy responds 4 | uri: 5 | url: http://localhost:44322/series/ping 6 | method: GET 7 | status_code: 200 8 | -------------------------------------------------------------------------------- /roles/postfix/vars/RedHat.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux specific values. 4 | 5 | __postfix_packages_pcp: 6 | - pcp-pmda-postfix 7 | -------------------------------------------------------------------------------- /roles/repository/vars/Debian.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Debian specific values. 4 | 5 | __repository_distro_name: "{{ ansible_distribution | lower }}" 6 | -------------------------------------------------------------------------------- /tests/check_into_elasticsearch.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if export to Elasticsearch is installed 4 | command: test -x /usr/bin/pcp2elasticsearch 5 | changed_when: false 6 | -------------------------------------------------------------------------------- /roles/grafana/handlers/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | - name: Restart grafana 5 | service: 6 | name: grafana-server 7 | state: restarted 8 | when: __grafana_is_booted | bool 9 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: github-actions 5 | directory: / 6 | schedule: 7 | interval: monthly 8 | commit-message: 9 | prefix: ci 10 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/RedHat_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 6 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | 7 | __bpftrace_packages: 8 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/RedHat_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 7 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | 7 | __bpftrace_packages: 8 | -------------------------------------------------------------------------------- /roles/mssql/vars/CentOS_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 6 specific values. 4 | 5 | __mssql_conf_dir: /var/lib/pcp/pmdas/mssql 6 | 7 | __mssql_packages_pcp: 8 | -------------------------------------------------------------------------------- /roles/mssql/vars/CentOS_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 7 specific values. 4 | 5 | __mssql_conf_dir: /var/lib/pcp/pmdas/mssql 6 | 7 | __mssql_packages_pcp: 8 | -------------------------------------------------------------------------------- /tests/check_pcp2spark.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if pcp2spark is running 4 | # noqa command-instead-of-module 5 | command: systemctl is-active pcp2spark 6 | changed_when: false 7 | -------------------------------------------------------------------------------- /roles/spark/vars/Fedora.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Fedora specific values. 4 | 5 | __spark_packages_export_pcp: 6 | - pcp-export-pcp2spark 7 | - pcp-system-tools 8 | -------------------------------------------------------------------------------- /roles/keyserver/handlers/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | - name: Restart key server 5 | service: 6 | name: "{{ __keyserver_name }}" 7 | state: restarted 8 | when: __keyserver_is_booted | bool 9 | -------------------------------------------------------------------------------- /roles/mssql/vars/CentOS_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 9 specific values. 4 | 5 | __mssql_conf_dir: /etc/pcp/mssql 6 | 7 | __mssql_packages_pcp: 8 | - pcp-pmda-mssql 9 | -------------------------------------------------------------------------------- /roles/spark/vars/CentOS_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 10 specific values. 4 | 5 | __spark_packages_export_pcp: 6 | - pcp-export-pcp2spark 7 | - pcp-system-tools 8 | -------------------------------------------------------------------------------- /roles/spark/vars/CentOS_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 8 specific values. 4 | 5 | __spark_packages_export_pcp: 6 | - pcp-export-pcp2spark 7 | - pcp-system-tools 8 | -------------------------------------------------------------------------------- /roles/spark/vars/CentOS_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 9 specific values. 4 | 5 | __spark_packages_export_pcp: 6 | - pcp-export-pcp2spark 7 | - pcp-system-tools 8 | -------------------------------------------------------------------------------- /docs/spark/setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of spark 3 | hosts: monitoring 4 | roles: 5 | - role: performancecopilot.metrics.spark 6 | vars: 7 | spark_metrics_agent: true 8 | spark_export_metrics: true 9 | -------------------------------------------------------------------------------- /roles/mssql/vars/CentOS_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 10 specific values. 4 | 5 | __mssql_conf_dir: /etc/pcp/mssql 6 | 7 | __mssql_packages_pcp: 8 | - pcp-pmda-mssql 9 | -------------------------------------------------------------------------------- /roles/mssql/vars/RedHat_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 6 specific values. 4 | 5 | __mssql_conf_dir: /var/lib/pcp/pmdas/mssql 6 | 7 | __mssql_packages_pcp: 8 | -------------------------------------------------------------------------------- /roles/mssql/vars/RedHat_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 7 specific values. 4 | 5 | __mssql_conf_dir: /var/lib/pcp/pmdas/mssql 6 | 7 | __mssql_packages_pcp: 8 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/Debian.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Debian specific values. 4 | 5 | __bpftrace_packages: 6 | - bpftrace 7 | 8 | __bpftrace_packages_pcp: 9 | - pcp 10 | -------------------------------------------------------------------------------- /roles/mssql/vars/CentOS_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 8 specific values. 4 | 5 | __mssql_conf_dir: /var/lib/pcp/pmdas/mssql 6 | 7 | __mssql_packages_pcp: 8 | - pcp-pmda-mssql 9 | -------------------------------------------------------------------------------- /roles/mssql/vars/Fedora.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Fedora specific values. 4 | 5 | __mssql_conf_dir: /var/lib/pcp/pmdas/mssql 6 | 7 | __mssql_packages_pcp: 8 | - pcp-pmda-mssql 9 | -------------------------------------------------------------------------------- /roles/spark/vars/RedHat.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat specific values. 4 | 5 | __spark_service_path: /usr/lib/systemd/system 6 | __spark_packages_pcp: 7 | - pcp-pmda-openmetrics 8 | -------------------------------------------------------------------------------- /roles/spark/vars/RedHat_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 8 specific values. 4 | 5 | __spark_packages_export_pcp: 6 | - pcp-export-pcp2spark 7 | - pcp-system-tools 8 | -------------------------------------------------------------------------------- /roles/spark/vars/RedHat_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 9 specific values. 4 | 5 | __spark_packages_export_pcp: 6 | - pcp-export-pcp2spark 7 | - pcp-system-tools 8 | -------------------------------------------------------------------------------- /scripts/lsrcollection.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | TOPDIR=$(pwd) 4 | LSRDIR="ansible_collections/$LSR_ROLE2COLL_NAMESPACE/$LSR_ROLE2COLL_NAME" 5 | mkdir -p "$TOX_WORK_DIR/$LSRDIR" 6 | cp -a "$TOPDIR"/* "$TOPDIR/.ansible-lint" "$TOX_WORK_DIR/$LSRDIR" 7 | -------------------------------------------------------------------------------- /tests/check_pcp2elasticsearch.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if pcp2elasticsearch is running 4 | # noqa command-instead-of-module 5 | command: systemctl is-active pcp2elasticsearch 6 | changed_when: false 7 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/Fedora.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Fedora specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | - pcp-pmda-bpftrace 7 | 8 | __bpftrace_packages: 9 | - bpftrace 10 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/Fedora.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Fedora specific values. 4 | 5 | __elasticsearch_packages_export_pcp: 6 | - pcp-export-pcp2elasticsearch 7 | - pcp-system-tools 8 | -------------------------------------------------------------------------------- /roles/mssql/vars/RedHat_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 10 specific values. 4 | 5 | __mssql_conf_dir: /etc/pcp/mssql 6 | 7 | __mssql_packages_pcp: 8 | - pcp-pmda-mssql 9 | -------------------------------------------------------------------------------- /roles/mssql/vars/RedHat_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 9 specific values. 4 | 5 | __mssql_conf_dir: /etc/pcp/mssql 6 | 7 | __mssql_packages_pcp: 8 | - pcp-pmda-mssql 9 | -------------------------------------------------------------------------------- /roles/spark/vars/RedHat_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 10 specific values. 4 | 5 | __spark_packages_export_pcp: 6 | - pcp-export-pcp2spark 7 | - pcp-system-tools 8 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/CentOS_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 8 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | - pcp-pmda-bpftrace 7 | 8 | __bpftrace_packages: 9 | - bpftrace 10 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/CentOS_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 9 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | - pcp-pmda-bpftrace 7 | 8 | __bpftrace_packages: 9 | - bpftrace 10 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/CentOS_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 6 specific values. 4 | 5 | __elasticsearch_conf_dir: /var/lib/pcp/pmdas/elasticsearch 6 | __elasticsearch_packages_export_pcp: [] 7 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/CentOS_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 10 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | - pcp-pmda-bpftrace 7 | 8 | __bpftrace_packages: 9 | - bpftrace 10 | -------------------------------------------------------------------------------- /roles/mssql/vars/RedHat_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 8 specific values. 4 | 5 | __mssql_conf_dir: /var/lib/pcp/pmdas/mssql 6 | 7 | __mssql_packages_pcp: 8 | - pcp-pmda-mssql 9 | -------------------------------------------------------------------------------- /docs/elasticsearch/setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of elasticsearch 3 | hosts: monitoring 4 | roles: 5 | - role: performancecopilot.metrics.elasticsearch 6 | vars: 7 | elasticsearch_agent: true 8 | elasticsearch_export_metrics: true 9 | -------------------------------------------------------------------------------- /roles/grafana/files/grafana-pcp-provisioning.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: 1 3 | 4 | apps: 5 | - type: performancecopilot-pcp-app 6 | org_id: 1 7 | org_name: Performance Co-Pilot 8 | disabled: false 9 | jsonData: 10 | secureJsonData: 11 | -------------------------------------------------------------------------------- /docs/bpftrace/setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of bpftrace 3 | hosts: monitoring 4 | roles: 5 | - role: performancecopilot.metrics.bpftrace 6 | vars: 7 | bpftrace_users: 8 | - {user: metrics, sasluser: metrics, saslpassword: p4ssw0rd} 9 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/RedHat.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat specific values. 4 | 5 | __elasticsearch_service_path: /usr/lib/systemd/system 6 | __elasticsearch_packages_pcp: 7 | - pcp-pmda-elasticsearch 8 | -------------------------------------------------------------------------------- /roles/spark/vars/CentOS_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 7 specific values. 4 | 5 | __spark_packages_export_pcp: 6 | - pcp-export-pcp2spark 7 | - pcp-system-tools 8 | 9 | __spark_packages_pcp: [] 10 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/RedHat_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 10 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | - pcp-pmda-bpftrace 7 | 8 | __bpftrace_packages: 9 | - bpftrace 10 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/RedHat_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 8 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | - pcp-pmda-bpftrace 7 | 8 | __bpftrace_packages: 9 | - bpftrace 10 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/RedHat_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 9 specific values. 4 | 5 | __bpftrace_packages_pcp: 6 | - pcp-pmda-bpftrace 7 | 8 | __bpftrace_packages: 9 | - bpftrace 10 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/RedHat_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 6 specific values. 4 | 5 | __elasticsearch_conf_dir: /var/lib/pcp/pmdas/elasticsearch 6 | __elasticsearch_packages_export_pcp: [] 7 | -------------------------------------------------------------------------------- /roles/spark/vars/Debian.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Debian specific values. 4 | 5 | __spark_service_path: /lib/systemd/system 6 | __spark_packages_pcp: 7 | - pcp 8 | __spark_packages_export_pcp: 9 | - pcp 10 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmie.controld.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | $version=1.1 4 | #Host P? S? Directory Arguments 5 | {{ item }} n n PCP_LOG_DIR/pmie/{{ item }}/pmie.log -c config.{{ item }} 6 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmlogger.controld.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | $version=1.1 4 | #Host P? S? directory args 5 | {{ item }} n n PCP_ARCHIVE_DIR/{{ item }} -r -T24h10m -c config.{{ item }} -v 100Mb 6 | -------------------------------------------------------------------------------- /roles/spark/vars/RedHat_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 7 specific values. 4 | 5 | __spark_packages_export_pcp: 6 | - pcp-export-pcp2spark 7 | - pcp-system-tools 8 | 9 | __spark_packages_pcp: [] 10 | -------------------------------------------------------------------------------- /tests/check_mssql.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if mssql PMDA is registered 4 | command: pmprobe -I pmcd.agent.status 5 | register: status 6 | until: status.stdout.find("mssql") != -1 7 | retries: 10 8 | delay: 1 9 | changed_when: false 10 | -------------------------------------------------------------------------------- /docs/mssql/basic.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of basic Microsoft SQL 3 | hosts: monitoring 4 | roles: 5 | - role: performancecopilot.metrics.mssql 6 | vars: 7 | mssql_agent_trusted: false 8 | mssql_agent_username: sa 9 | mssql_agent_password: admin 10 | -------------------------------------------------------------------------------- /roles/repository/templates/packagecloud.debs.j2: -------------------------------------------------------------------------------- 1 | deb https://packagecloud.io/performancecopilot/pcp/{{ __repository_distro_name }} {{ ansible_distribution_release }} main 2 | deb-src https://packagecloud.io/performancecopilot/pcp/{{ __repository_distro_name }} {{ ansible_distribution_release }} main 3 | -------------------------------------------------------------------------------- /tests/check_postfix.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if postfix PMDA is registered 4 | command: pmprobe -I pmcd.agent.status 5 | register: status 6 | until: status.stdout.find("postfix") != -1 7 | retries: 10 8 | delay: 1 9 | changed_when: false 10 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/CentOS_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 10 specific values. 4 | 5 | __elasticsearch_conf_dir: /etc/pcp/elasticsearch 6 | __elasticsearch_packages_export_pcp: 7 | - pcp-export-pcp2elasticsearch 8 | - pcp-system-tools 9 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/CentOS_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 9 specific values. 4 | 5 | __elasticsearch_conf_dir: /etc/pcp/elasticsearch 6 | __elasticsearch_packages_export_pcp: 7 | - pcp-export-pcp2elasticsearch 8 | - pcp-system-tools 9 | -------------------------------------------------------------------------------- /tests/check_retention.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Check if retention period is set 5 | command: grep -e '--discard {{ __test_retention }}' /etc/sysconfig/pmlogger_timers 6 | changed_when: false 7 | # yamllint enable rule:line-length 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | performancecopilot-metrics-*.tar.gz 2 | redhat-rhel_metrics-*.tar.gz 3 | passes.yml 4 | vault.yml 5 | *.pyc 6 | *.retry 7 | /tests/.coverage 8 | /tests/htmlcov* 9 | /.tox 10 | /venv*/ 11 | /.venv/ 12 | .vscode/ 13 | artifacts/ 14 | __pycache__/ 15 | *~ 16 | .pytest_cache/ 17 | .cache/ 18 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/Debian.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Debian specific values. 4 | 5 | __elasticsearch_service_path: /lib/systemd/system 6 | __elasticsearch_packages_pcp: 7 | - pcp 8 | __elasticsearch_packages_export_pcp: 9 | - pcp 10 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/CentOS_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 7 specific values. 4 | 5 | __elasticsearch_conf_dir: /var/lib/pcp/pmdas/elasticsearch 6 | __elasticsearch_packages_export_pcp: 7 | - pcp-export-pcp2elasticsearch 8 | - pcp-system-tools 9 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/CentOS_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 8 specific values. 4 | 5 | __elasticsearch_conf_dir: /var/lib/pcp/pmdas/elasticsearch 6 | __elasticsearch_packages_export_pcp: 7 | - pcp-export-pcp2elasticsearch 8 | - pcp-system-tools 9 | -------------------------------------------------------------------------------- /roles/pcp/vars/CentOS_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 7 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-zeroconf 7 | 8 | __pcp_sasl_packages: 9 | - cyrus-sasl-lib 10 | - cyrus-sasl-scram 11 | 12 | __pcp_sasl_mechlist: scram-sha-256 13 | -------------------------------------------------------------------------------- /roles/pcp/vars/CentOS_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 8 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-zeroconf 7 | 8 | __pcp_sasl_packages: 9 | - cyrus-sasl-lib 10 | - cyrus-sasl-scram 11 | 12 | __pcp_sasl_mechlist: scram-sha-256 13 | -------------------------------------------------------------------------------- /roles/pcp/vars/CentOS_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 9 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-zeroconf 7 | 8 | __pcp_sasl_packages: 9 | - cyrus-sasl-lib 10 | - cyrus-sasl-scram 11 | 12 | __pcp_sasl_mechlist: scram-sha-256 13 | -------------------------------------------------------------------------------- /tests/check_from_elasticsearch.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if Elasticsearch PMDA is registered 4 | command: pmprobe -I pmcd.agent.status 5 | register: status 6 | until: status.stdout.find("elasticsearch") != -1 7 | retries: 10 8 | delay: 1 9 | changed_when: false 10 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/RedHat_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 10 specific values. 4 | 5 | __elasticsearch_conf_dir: /etc/pcp/elasticsearch 6 | __elasticsearch_packages_export_pcp: 7 | - pcp-export-pcp2elasticsearch 8 | - pcp-system-tools 9 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/RedHat_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 9 specific values. 4 | 5 | __elasticsearch_conf_dir: /etc/pcp/elasticsearch 6 | __elasticsearch_packages_export_pcp: 7 | - pcp-export-pcp2elasticsearch 8 | - pcp-system-tools 9 | -------------------------------------------------------------------------------- /roles/grafana/vars/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | __grafana_user: admin 5 | __grafana_password: admin 6 | __grafana_server: localhost:3000 7 | __grafana_pmproxy_server: localhost:44322 8 | __grafana_conf: /etc/grafana/grafana.ini 9 | __grafana_provisioning_path: /etc/grafana/provisioning 10 | -------------------------------------------------------------------------------- /roles/pcp/vars/CentOS_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 10 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-zeroconf 7 | 8 | __pcp_sasl_packages: 9 | - cyrus-sasl-lib 10 | - cyrus-sasl-scram 11 | 12 | __pcp_sasl_mechlist: scram-sha-256 13 | -------------------------------------------------------------------------------- /roles/spark/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | spark_metrics_agent: true 5 | spark_metrics_agent_url: http://localhost:4040/metrics/executors/prometheus 6 | spark_export_metrics: false 7 | spark_export_interval: 60 8 | spark_export_server: '127.0.0.1' 9 | spark_export_port: 44325 10 | -------------------------------------------------------------------------------- /roles/spark/vars/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | __spark_packages_extra: [] 5 | __spark_export_conf: /etc/pcp/pcp2spark.conf 6 | __spark_metrics_conf: /etc/pcp/openmetrics/spark.url 7 | __spark_metrics_symlink: /var/lib/pcp/pmdas/openmetrics/config.d/spark.url 8 | __spark_packages_export_pcp: [] 9 | -------------------------------------------------------------------------------- /roles/bpftrace/vars/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | __bpftrace_packages: [] 5 | __bpftrace_packages_pcp: [] 6 | __bpftrace_packages_extra: [] 7 | 8 | __bpftrace_usernames: root 9 | 10 | __bpftrace_conf_dir: /etc/pcp/bpftrace 11 | __bpftrace_conf: "{{ __bpftrace_conf_dir }}/bpftrace.conf" 12 | -------------------------------------------------------------------------------- /docs/pcp/users.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of pcp with users 3 | hosts: monitoring 4 | roles: 5 | - role: performancecopilot.metrics.pcp 6 | vars: 7 | pcp_accounts: 8 | - {user: metrics, sasluser: metrics, saslpassword: p4ssw0rd} 9 | - {sasluser: nathans, saslpassword: "adm1n!"} 10 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/RedHat_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 7 specific values. 4 | 5 | __elasticsearch_conf_dir: /var/lib/pcp/pmdas/elasticsearch 6 | __elasticsearch_packages_export_pcp: 7 | - pcp-export-pcp2elasticsearch 8 | - pcp-system-tools 9 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/RedHat_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 8 specific values. 4 | 5 | __elasticsearch_conf_dir: /var/lib/pcp/pmdas/elasticsearch 6 | __elasticsearch_packages_export_pcp: 7 | - pcp-export-pcp2elasticsearch 8 | - pcp-system-tools 9 | -------------------------------------------------------------------------------- /roles/pcp/vars/RedHat_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 10 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-zeroconf 7 | 8 | __pcp_sasl_packages: 9 | - cyrus-sasl-lib 10 | - cyrus-sasl-scram 11 | 12 | __pcp_sasl_mechlist: scram-sha-256 13 | -------------------------------------------------------------------------------- /roles/pcp/vars/RedHat_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 7 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-zeroconf 7 | 8 | __pcp_sasl_packages: 9 | - cyrus-sasl-lib 10 | - cyrus-sasl-scram 11 | 12 | __pcp_sasl_mechlist: scram-sha-256 13 | -------------------------------------------------------------------------------- /roles/pcp/vars/RedHat_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 8 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-zeroconf 7 | 8 | __pcp_sasl_packages: 9 | - cyrus-sasl-lib 10 | - cyrus-sasl-scram 11 | 12 | __pcp_sasl_mechlist: scram-sha-256 13 | -------------------------------------------------------------------------------- /roles/pcp/vars/RedHat_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 9 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-zeroconf 7 | 8 | __pcp_sasl_packages: 9 | - cyrus-sasl-lib 10 | - cyrus-sasl-scram 11 | 12 | __pcp_sasl_mechlist: scram-sha-256 13 | -------------------------------------------------------------------------------- /roles/elasticsearch/templates/elasticsearch.conf.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | [pmda] 4 | user = pcp 5 | baseurl = http://localhost:{{ elasticsearch_agent_port }}/ 6 | auth = {{ elasticsearch_agent_authname }} 7 | password = {{ elasticsearch_agent_password }} 8 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmie.control.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | $version=1.1 4 | #Host P? S? Directory Arguments 5 | {% for item in pcp_target_hosts %} 6 | {{ item }} n n PCP_LOG_DIR/pmie/{{ item }}/pmie.log -c config.{{ item }} 7 | {% endfor %} 8 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmlogger.control.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | $version=1.1 4 | #Host P? S? directory args 5 | {% for item in pcp_target_hosts %} 6 | {{ item }} n n PCP_ARCHIVE_DIR/{{ item }} -r -T24h10m -c config.{{ item }} -v 100Mb 7 | {% endfor %} 8 | -------------------------------------------------------------------------------- /tests/check_keyserver.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if key server responds 4 | changed_when: false 5 | shell: | 6 | set -eu 7 | if set -o | grep -q pipefail; then 8 | set -o pipefail # no pipefail on debian, some ubuntu 9 | fi 10 | {{ __keyserver_name }}-cli PING | grep PONG 11 | -------------------------------------------------------------------------------- /roles/elasticsearch/vars/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | __elasticsearch_packages_extra: [] 5 | __elasticsearch_conf_dir: /etc/pcp/elasticsearch 6 | __elasticsearch_conf: "{{ __elasticsearch_conf_dir }}/elasticsearch.conf" 7 | __elasticsearch_export_conf: /etc/pcp/pcp2elasticsearch.conf 8 | __elasticsearch_packages_export_pcp: [] 9 | -------------------------------------------------------------------------------- /docs/pcp/farms.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of multiple target hosts 3 | hosts: monitoring 4 | roles: 5 | - role: performancecopilot.metrics.pcp 6 | vars: 7 | pcp_rest_api: true 8 | pcp_pmlogger_interval: 10 9 | pcp_pmlogger_discard: 5 10 | pcp_target_hosts: ["webserver.example.com", "database.example.com"] 11 | -------------------------------------------------------------------------------- /roles/grafana/vars/CentOS_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 6 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Redis 6 | __grafana_keyserver_datasource_type: pcp-redis-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-redis-datasource 8 | __grafana_packages_extra: [] 9 | -------------------------------------------------------------------------------- /roles/grafana/vars/CentOS_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 7 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Redis 6 | __grafana_keyserver_datasource_type: pcp-redis-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-redis-datasource 8 | __grafana_packages_extra: [] 9 | -------------------------------------------------------------------------------- /roles/grafana/vars/CentOS_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 8 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Redis 6 | __grafana_keyserver_datasource_type: pcp-redis-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-redis-datasource 8 | __grafana_packages_extra: [] 9 | -------------------------------------------------------------------------------- /roles/pcp/vars/RedHat.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat specific values. 4 | 5 | __pcp_pmcd_defaults_path: /etc/sysconfig/pmcd 6 | __pcp_pmproxy_defaults_path: /etc/sysconfig/pmproxy 7 | __pcp_pmlogger_defaults_path: /etc/sysconfig/pmlogger 8 | __pcp_pmlogger_timers_path: /etc/sysconfig/pmlogger_timers 9 | -------------------------------------------------------------------------------- /roles/keyserver/vars/CentOS_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 6 specific values. 4 | 5 | __keyserver_name: redis 6 | __keyserver_packages: 7 | - redis 8 | __keyserver_conf_path: /etc/redis 9 | __keyserver_conf_file: redis.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/keyserver/vars/CentOS_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 7 specific values. 4 | 5 | __keyserver_name: redis 6 | __keyserver_packages: 7 | - redis 8 | __keyserver_conf_path: /etc/redis 9 | __keyserver_conf_file: redis.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/keyserver/vars/CentOS_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 8 specific values. 4 | 5 | __keyserver_name: redis 6 | __keyserver_packages: 7 | - redis 8 | __keyserver_conf_path: /etc/redis 9 | __keyserver_conf_file: redis.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/keyserver/vars/CentOS_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 9 specific values. 4 | 5 | __keyserver_name: redis 6 | __keyserver_packages: 7 | - redis 8 | __keyserver_conf_path: /etc/redis 9 | __keyserver_conf_file: redis.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/keyserver/vars/Fedora.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Fedora specific values. 4 | 5 | __keyserver_name: valkey 6 | __keyserver_packages: 7 | - valkey 8 | __keyserver_conf_path: /etc/valkey 9 | __keyserver_conf_file: valkey.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/pcp/vars/CentOS_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 6 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-pmda-dm 7 | - pcp-pmda-nfsclient 8 | - pcp-system-tools 9 | 10 | __pcp_sasl_packages: 11 | - cyrus-sasl-lib 12 | - cyrus-sasl-md5 13 | 14 | __pcp_sasl_mechlist: digest-md5 15 | -------------------------------------------------------------------------------- /roles/keyserver/vars/CentOS_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 10 specific values. 4 | 5 | __keyserver_name: valkey 6 | __keyserver_packages: 7 | - valkey 8 | __keyserver_conf_path: /etc/valkey 9 | __keyserver_conf_file: valkey.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/grafana/vars/RedHat.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat specific values. 4 | 5 | __grafana_keyserver_datasource_name: Valkey 6 | __grafana_keyserver_datasource_type: pcp-valkey-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-valkey-datasource 8 | __grafana_packages: 9 | - grafana 10 | -------------------------------------------------------------------------------- /tests/check_grafana_pcp.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if grafana-pcp is installed 4 | changed_when: false 5 | shell: | 6 | set -eu 7 | if set -o | grep -q pipefail; then 8 | set -o pipefail # no pipefail on debian, some ubuntu 9 | fi 10 | (cd /tmp && /usr/sbin/grafana-cli plugins ls) | grep performancecopilot 11 | -------------------------------------------------------------------------------- /roles/grafana/vars/RedHat_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 6 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Redis 6 | __grafana_keyserver_datasource_type: pcp-redis-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-redis-datasource 8 | __grafana_packages_extra: [] 9 | -------------------------------------------------------------------------------- /roles/grafana/vars/RedHat_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 7 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Redis 6 | __grafana_keyserver_datasource_type: pcp-redis-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-redis-datasource 8 | __grafana_packages_extra: [] 9 | -------------------------------------------------------------------------------- /roles/pcp/vars/RedHat_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 6 specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-pmda-dm 7 | - pcp-pmda-nfsclient 8 | - pcp-system-tools 9 | 10 | __pcp_sasl_packages: 11 | - cyrus-sasl-lib 12 | - cyrus-sasl-md5 13 | 14 | __pcp_sasl_mechlist: digest-md5 15 | -------------------------------------------------------------------------------- /roles/grafana/vars/CentOS_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 9 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Redis 6 | __grafana_keyserver_datasource_type: pcp-redis-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-redis-datasource 8 | __grafana_packages_extra: 9 | - grafana-pcp 10 | -------------------------------------------------------------------------------- /roles/grafana/vars/Fedora.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Fedora specific values. 4 | 5 | __grafana_keyserver_datasource_name: Valkey 6 | __grafana_keyserver_datasource_type: pcp-valkey-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-valkey-datasource 8 | __grafana_packages_extra: 9 | - grafana-pcp 10 | -------------------------------------------------------------------------------- /roles/keyserver/vars/RedHat_6.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 6 specific values. 4 | 5 | __keyserver_name: redis 6 | __keyserver_packages: 7 | - redis 8 | __keyserver_conf_path: /etc/redis 9 | __keyserver_conf_file: redis.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/keyserver/vars/RedHat_7.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 7 specific values. 4 | 5 | __keyserver_name: redis 6 | __keyserver_packages: 7 | - redis 8 | __keyserver_conf_path: /etc/redis 9 | __keyserver_conf_file: redis.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/keyserver/vars/RedHat_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 8 specific values. 4 | 5 | __keyserver_name: redis 6 | __keyserver_packages: 7 | - redis 8 | __keyserver_conf_path: /etc/redis 9 | __keyserver_conf_file: redis.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/keyserver/vars/RedHat_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 9 specific values. 4 | 5 | __keyserver_name: redis 6 | __keyserver_packages: 7 | - redis 8 | __keyserver_conf_path: /etc/redis 9 | __keyserver_conf_file: redis.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/mssql/vars/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | __mssql_packages_extra: [] 5 | 6 | __mssql_conf_dir: /etc/pcp/mssql 7 | __mssql_conf: "{{ __mssql_conf_dir }}/mssql.conf" 8 | 9 | __mssql_pmieconf_path: /etc/pcp/pmieconf/mssql 10 | __mssql_pmieconf_link_path: /var/lib/pcp/config/pmieconf/mssql 11 | __mssql_pmieconf_rules: 12 | - stolen_node_memory 13 | -------------------------------------------------------------------------------- /roles/grafana/vars/CentOS_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with CentOS 10 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Valkey 6 | __grafana_keyserver_datasource_type: pcp-valkey-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-valkey-datasource 8 | __grafana_packages_extra: 9 | - grafana-pcp 10 | -------------------------------------------------------------------------------- /roles/keyserver/vars/RedHat_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 10 specific values. 4 | 5 | __keyserver_name: valkey 6 | __keyserver_packages: 7 | - valkey 8 | __keyserver_conf_path: /etc/valkey 9 | __keyserver_conf_file: valkey.conf 10 | __keyserver_packages_extra: [] 11 | __keyserver_loaded_modules: [] 12 | -------------------------------------------------------------------------------- /roles/grafana/vars/Debian.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Debian specific values. 4 | 5 | __grafana_keyserver_datasource_name: Valkey 6 | __grafana_keyserver_datasource_type: pcp-valkey-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-valkey-datasource 8 | __grafana_packages: [] 9 | __grafana_packages_extra: [] 10 | -------------------------------------------------------------------------------- /roles/grafana/vars/RedHat_8.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 8 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Redis 6 | __grafana_keyserver_datasource_type: pcp-redis-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-redis-datasource 8 | __grafana_packages_extra: 9 | - grafana-pcp 10 | -------------------------------------------------------------------------------- /roles/grafana/vars/RedHat_9.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 9 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Redis 6 | __grafana_keyserver_datasource_type: pcp-redis-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-redis-datasource 8 | __grafana_packages_extra: 9 | - grafana-pcp 10 | -------------------------------------------------------------------------------- /roles/grafana/vars/RedHat_10.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Red Hat Enterprise Linux 10 specific values. 4 | 5 | __grafana_keyserver_datasource_name: Valkey 6 | __grafana_keyserver_datasource_type: pcp-valkey-datasource 7 | __grafana_keyserver_datasource_alttype: performancecopilot-valkey-datasource 8 | __grafana_packages_extra: 9 | - grafana-pcp 10 | -------------------------------------------------------------------------------- /roles/keyserver/vars/Debian.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Debian specific values. 4 | 5 | __keyserver_name: valkey 6 | __keyserver_conf_path: /etc/valkey 7 | __keyserver_conf_file: valkey.conf 8 | 9 | __keyserver_packages: 10 | - valkey-tools 11 | - valkey-server 12 | 13 | __keyserver_packages_extra: [] 14 | 15 | __keyserver_loaded_modules: [] 16 | -------------------------------------------------------------------------------- /docs/pcp/setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Example of basic pcp setup 3 | hosts: all 4 | roles: 5 | - role: performancecopilot.metrics.pcp 6 | vars: 7 | pcp_pmie_endpoint: https://example.com/webhook 8 | pcp_pmlogger_interval: 10 9 | # NOTE: No openmetrics on EL7 10 | pcp_optional_agents: [dm, nfsclient, openmetrics] 11 | pcp_explicit_labels: 12 | environment: production 13 | -------------------------------------------------------------------------------- /tests/check_pmdamssql.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if mssql PMDA is installed in the filesystem 4 | command: test -d "/var/lib/pcp/pmdas/mssql" 5 | changed_when: false 6 | 7 | - name: Check if mssql PMDA is registered with pmcd 8 | command: pmprobe -I pmcd.agent.status 9 | register: status 10 | until: status.stdout.find("mssql") != -1 11 | retries: 10 12 | delay: 1 13 | changed_when: false 14 | -------------------------------------------------------------------------------- /tests/check_pmdabpftrace.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if bpftrace PMDA is installed in the filesystem 4 | command: test -d "/var/lib/pcp/pmdas/bpftrace" 5 | changed_when: false 6 | 7 | - name: Check if bpftrace PMDA is registered with pmcd 8 | command: pmprobe -I pmcd.agent.status 9 | register: status 10 | until: status.stdout.find("bpftrace") != -1 11 | retries: 10 12 | delay: 1 13 | changed_when: false 14 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | [lsr_config] 3 | lsr_enable = true 4 | 5 | [testenv] 6 | setenv = 7 | LSR_ROLE2COLL_NAMESPACE = performancecopilot 8 | LSR_ROLE2COLL_NAME = metrics 9 | 10 | [lsr_ansible-lint] 11 | configfile = {toxinidir}/.ansible-lint 12 | 13 | [lsr_yamllint] 14 | configfile = {toxinidir}/.yamllint.yml 15 | configbasename = .yamllint.yml 16 | 17 | [testenv:collection] 18 | commands = 19 | bash scripts/lsrcollection.sh 20 | -------------------------------------------------------------------------------- /tests/check_pmdaopenmetrics.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if openmetrics PMDA is installed in the filesystem 4 | command: test -d "/var/lib/pcp/pmdas/openmetrics" 5 | changed_when: false 6 | 7 | - name: Check if openmetrics PMDA is registered with pmcd 8 | command: pmprobe -I pmcd.agent.status 9 | register: status 10 | until: status.stdout.find("openmetrics") != -1 11 | retries: 10 12 | delay: 1 13 | changed_when: false 14 | -------------------------------------------------------------------------------- /roles/elasticsearch/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | elasticsearch_agent: true 5 | elasticsearch_agent_port: 9200 6 | elasticsearch_agent_authname: '' 7 | elasticsearch_agent_password: '' 8 | elasticsearch_export_metrics: false 9 | elasticsearch_export_interval: 60 10 | elasticsearch_export_server: 'http://localhost:9200' 11 | elasticsearch_export_index: 'pcp' 12 | elasticsearch_export_hostid: '' 13 | elasticsearch_export_type: 'pcp-metric' 14 | -------------------------------------------------------------------------------- /roles/pcp/vars/Debian.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Debian specific values. 4 | 5 | __pcp_pmcd_defaults_path: /etc/default/pmcd 6 | __pcp_pmproxy_defaults_path: /etc/default/pmproxy 7 | __pcp_pmlogger_defaults_path: /etc/default/pmlogger 8 | __pcp_pmlogger_timers_path: /etc/default/pmlogger_timers 9 | 10 | __pcp_sasl_packages: 11 | - sasl2-bin 12 | - libsasl2-modules-gssapi-mit 13 | 14 | __pcp_sasl_mechlist: scram-sha-256 15 | -------------------------------------------------------------------------------- /tests/check_header.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Get file 4 | slurp: 5 | path: "{{ __file }}" 6 | register: __content 7 | 8 | - name: Check for presence of ansible managed header, fingerprint 9 | assert: 10 | that: 11 | - ansible_managed in content 12 | - __fingerprint in content 13 | vars: 14 | content: "{{ __content.content | b64decode }}" 15 | ansible_managed: "{{ lookup('template', 'get_ansible_managed.j2') }}" 16 | -------------------------------------------------------------------------------- /tests/check_pmdaelasticsearch.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if elasticsearch PMDA is installed in the filesystem 4 | command: test -d "/var/lib/pcp/pmdas/elasticsearch" 5 | changed_when: false 6 | 7 | - name: Check if elasticsearch PMDA is registered with pmcd 8 | command: pmprobe -I pmcd.agent.status 9 | register: status 10 | until: status.stdout.find("elasticsearch") != -1 11 | retries: 10 12 | delay: 1 13 | changed_when: false 14 | -------------------------------------------------------------------------------- /roles/pcp/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | pcp_rest_api: false 5 | pcp_pmlogger_discard: 14 6 | pcp_pmlogger_interval: 60 7 | pcp_archive_dir: /var/log/pcp/pmlogger 8 | pcp_pmie_endpoint: '' 9 | pcp_pmcd_localonly: 0 10 | pcp_pmproxy_localonly: 0 11 | pcp_pmlogger_localonly: 1 12 | pcp_optional_packages: [] 13 | pcp_optional_agents: [] 14 | pcp_explicit_labels: {} 15 | pcp_implicit_labels: {} 16 | pcp_single_control: 0 17 | pcp_target_hosts: [] 18 | pcp_accounts: [] 19 | -------------------------------------------------------------------------------- /roles/pcp/tasks/pmproxy.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | - name: Ensure REST API, proxy and metric log discovery is configured 5 | template: 6 | src: pmproxy.defaults.j2 7 | dest: "{{ __pcp_pmproxy_defaults_path }}" 8 | mode: "0644" 9 | notify: Restart pmproxy 10 | 11 | - name: Ensure REST API, proxy and log discovery is running and enabled on boot 12 | service: 13 | name: pmproxy 14 | state: "{{ 'started' if __pcp_is_booted else omit }}" 15 | enabled: true 16 | -------------------------------------------------------------------------------- /roles/pcp/vars/Fedora.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # Put internal variables here with Fedora specific values. 4 | 5 | __pcp_packages_extra: 6 | - pcp-zeroconf 7 | 8 | __pcp_sasl_packages: 9 | - cyrus-sasl-lib 10 | - cyrus-sasl-scram 11 | 12 | __pcp_sasl_mechlist: scram-sha-256 13 | 14 | __pcp_pmcd_defaults_path: /etc/sysconfig/pmcd 15 | __pcp_pmproxy_defaults_path: /etc/sysconfig/pmproxy 16 | __pcp_pmlogger_defaults_path: /etc/sysconfig/pmlogger 17 | __pcp_pmlogger_timers_path: /etc/sysconfig/pmlogger_timers 18 | -------------------------------------------------------------------------------- /scripts/redhat.rhel_metrics: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | collection_namespace=redhat 4 | collection_name=rhel_metrics 5 | 6 | sed -i \ 7 | -e "s/^name: .*/name: ${collection_name}/g" \ 8 | -e "s/^namespace: .*/namespace: ${collection_namespace}/g" \ 9 | galaxy.yml 10 | find . -name \*.yml -o -name \*.md | while read file 11 | do 12 | sed -i \ 13 | -e "s/performancecopilot.metrics/${collection_namespace}.${collection_name}/g" \ 14 | $file 15 | done 16 | 17 | ansible-galaxy collection build --force 18 | git checkout -f # remove sed changes 19 | -------------------------------------------------------------------------------- /tests/check_pmie.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if primary pmie is running 4 | changed_when: false 5 | shell: | 6 | set -eu 7 | if set -o | grep -q pipefail; then 8 | set -o pipefail # no pipefail on debian, some ubuntu 9 | fi 10 | pmprobe -I pmcd.pmie.pmcd_host | grep '"primary"' 11 | when: (ansible_facts['distribution'] in ['RedHat', 'CentOS'] and 12 | ansible_facts['distribution_major_version'] | int > 6) or 13 | ansible_facts['distribution'] not in ['Fedora', 'RedHat', 'CentOS'] 14 | -------------------------------------------------------------------------------- /.github/workflows/ansible-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Ansible Lint 3 | on: # yamllint disable-line rule:truthy 4 | merge_group: 5 | branches: 6 | - main 7 | types: 8 | - checks_requested 9 | pull_request: 10 | push: 11 | branches: 12 | - main 13 | workflow_dispatch: 14 | permissions: 15 | contents: read 16 | jobs: 17 | ansible_lint: 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Checkout repo 21 | uses: actions/checkout@v4 22 | - name: Run ansible-lint 23 | uses: ansible/ansible-lint@v24 24 | -------------------------------------------------------------------------------- /tests/check_pmlogger.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if primary pmlogger is running 4 | shell: | 5 | set -eu 6 | if set -o | grep -q pipefail; then 7 | set -o pipefail # no pipefail on debian, some ubuntu 8 | fi 9 | pmprobe -I pmcd.pmlogger.pmcd_host | grep '"primary"' 10 | when: (ansible_facts['distribution'] in ['RedHat', 'CentOS'] and 11 | ansible_facts['distribution_major_version'] | int > 6) or 12 | ansible_facts['distribution'] not in ['Fedora', 'RedHat', 'CentOS'] 13 | changed_when: false 14 | -------------------------------------------------------------------------------- /roles/pcp/handlers/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | - name: Restart pmcd 5 | service: 6 | name: pmcd 7 | state: restarted 8 | when: __pcp_is_booted | bool 9 | 10 | - name: Restart pmie 11 | service: 12 | name: pmie 13 | state: restarted 14 | when: __pcp_is_booted | bool 15 | 16 | - name: Restart pmproxy 17 | service: 18 | name: pmproxy 19 | state: restarted 20 | when: __pcp_is_booted | bool 21 | 22 | - name: Restart pmlogger 23 | service: 24 | name: pmlogger 25 | state: restarted 26 | when: __pcp_is_booted | bool 27 | -------------------------------------------------------------------------------- /tests/check_default_datasources.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Check if grafana-pcp datasources are configured 5 | uri: 6 | url: "http://admin:admin@localhost:3000/api/datasources/name/PCP%20{{ item }}" 7 | force_basic_auth: true 8 | headers: 9 | Content-Type: application/json 10 | Accept: application/json 11 | method: GET 12 | status_code: 200 13 | loop: 14 | - "{{ __grafana_keyserver_datasource_name }}" 15 | - Vector 16 | - bpftrace 17 | # yamllint enable rule:line-length 18 | -------------------------------------------------------------------------------- /.github/workflows/woke.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # yamllint disable rule:line-length 3 | name: Check for non-inclusive language 4 | on: # yamllint disable-line rule:truthy 5 | - pull_request 6 | jobs: 7 | woke: 8 | name: woke 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v4 13 | 14 | - name: woke 15 | uses: get-woke/woke-action@v0 16 | with: 17 | woke-args: "-c https://raw.githubusercontent.com/linux-system-roles/tox-lsr/main/src/tox_lsr/config_files/woke.yml" 18 | # Cause the check to fail on any broke rules 19 | fail-on-error: true 20 | -------------------------------------------------------------------------------- /tests/check_bpftrace.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if bpftrace PMDA is registered 4 | command: pmprobe -I pmcd.agent.status 5 | register: status 6 | until: status.stdout.find("bpftrace") != -1 7 | retries: 10 8 | delay: 1 9 | changed_when: false 10 | 11 | - name: Check if allowed users of bpftrace are configured 12 | changed_when: false 13 | shell: | 14 | set -eu 15 | if set -o | grep -q pipefail; then 16 | set -o pipefail # no pipefail on debian, some ubuntu 17 | fi 18 | grep -w '^allowed_users' /var/lib/pcp/pmdas/bpftrace/bpftrace.conf \ 19 | | grep -wq '{{ __test_uname }}' 20 | -------------------------------------------------------------------------------- /roles/mssql/templates/mssql.conf.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | [connection] 4 | driver={ODBC Driver 17 for SQL Server} 5 | server=tcp:localhost 6 | timeout={{ mssql_agent_timeout }} 7 | 8 | [authentication] 9 | ## General reference on authentication options: 10 | #https://docs.microsoft.com/en-us/sql/relational-databases/security/choose-an-authentication-mode 11 | 12 | # Option 1: Mixed mode authentication 13 | username={{ mssql_agent_username }} 14 | password={{ mssql_agent_password }} 15 | 16 | # Option 2: Windows authentication 17 | trusted={{ mssql_agent_trusted }} 18 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmproxy.defaults.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | # Environment variables for the pmproxy daemon. Refer also to 4 | # the pmproxy.options file for additional configuration state. 5 | 6 | # Behaviour regarding listening on external-facing interfaces; 7 | # unset PMPROXY_LOCAL to allow connections from remote hosts. 8 | # A value of 0 permits remote connections, 1 permits local only. 9 | PMPROXY_LOCAL={{ pcp_pmproxy_localonly }} 10 | 11 | # Max length to which the queue of pending connections may grow 12 | # A value of 5 is the default. 13 | # PMPROXY_MAXPENDING=5 14 | -------------------------------------------------------------------------------- /.ansible-lint: -------------------------------------------------------------------------------- 1 | --- 2 | skip_list: 3 | - fqcn-builtins 4 | - galaxy[no-changelog] 5 | exclude_paths: 6 | - tests/roles/ 7 | - .github/ 8 | - examples/roles/ 9 | - .markdownlint.yaml 10 | # downloaded, not ours 11 | - .ansible/collections 12 | kinds: 13 | - yaml: "**/meta/collection-requirements.yml" 14 | - yaml: "**/tests/collection-requirements.yml" 15 | - playbook: "**/tests/tests_*.yml" 16 | - playbook: "**/tests/setup-snapshot.yml" 17 | - tasks: "**/tests/*.yml" 18 | - playbook: "**/tests/playbooks/*.yml" 19 | - tasks: "**/tests/tasks/*.yml" 20 | - tasks: "**/tests/tasks/*/*.yml" 21 | - vars: "**/tests/vars/*.yml" 22 | - playbook: "**/examples/*.yml" 23 | -------------------------------------------------------------------------------- /tests/tests_verify_basic.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test basic services of the pcp role are installed and running 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.keyserver 8 | - role: performancecopilot.metrics.pcp 9 | 10 | pre_tasks: 11 | - name: Save state of services 12 | import_tasks: get_services_state.yml 13 | 14 | tasks: 15 | - name: Check if basic pcp role setup works 16 | include_tasks: "{{ item }}" 17 | loop: 18 | - check_pcp.yml 19 | - check_pmie.yml 20 | - check_pmlogger.yml 21 | 22 | post_tasks: 23 | - name: Restore state of services 24 | import_tasks: restore_services_state.yml 25 | -------------------------------------------------------------------------------- /tests/check_sasl.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if user exists 4 | command: id "{{ __test_uname }}" 5 | changed_when: false 6 | 7 | - name: Check if password is configured 8 | changed_when: false 9 | shell: | 10 | set -eu 11 | if set -o | grep -q pipefail; then 12 | set -o pipefail # no pipefail on debian, some ubuntu 13 | fi 14 | sasldblistusers2 -f /etc/pcp/passwd.db | grep -wq "{{ __test_uname }}" 15 | 16 | # yamllint disable rule:line-length 17 | - name: Check if a client can access metrics 18 | command: pminfo -f -h "pcp://127.0.0.1?username={{ __test_uname }}&password={{ __test_pswd }}" disk.dev.read 19 | changed_when: false 20 | # yamllint enable rule:line-length 21 | -------------------------------------------------------------------------------- /roles/spark/templates/pcp2spark.service.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | [Unit] 4 | Description=pcp-to-spark metrics export service 5 | Documentation=man:pcp2spark(1) 6 | After=network-online.target pmcd.service 7 | 8 | [Service] 9 | TimeoutSec=10 10 | ExecStartPre=/usr/bin/pmrepconf -c \ 11 | --option interval={{ spark_export_interval }} \ 12 | --option spark_server={{ spark_export_server }} \ 13 | --option spark_port={{ spark_export_port }} \ 14 | {{ __spark_export_conf }} 15 | ExecStart=/usr/bin/pcp2spark --include-labels :metrics 16 | Restart=on-failure 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /roles/repository/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] 3 | 4 | galaxy_info: 5 | author: performancecopilot 6 | description: Performance Co-Pilot repository role 7 | role_name: repository 8 | company: pcp.io 9 | license: "license (MIT)" 10 | min_ansible_version: "2.9" 11 | platforms: 12 | - name: EL 13 | versions: 14 | - all 15 | - name: Fedora 16 | versions: 17 | - all 18 | - name: Debian 19 | versions: 20 | - all 21 | - name: Ubuntu 22 | versions: 23 | - all 24 | galaxy_tags: 25 | - pcp 26 | - metrics 27 | - packages 28 | - packaging 29 | - monitoring 30 | - performance 31 | - el 32 | - fedora 33 | - debian 34 | - ubuntu 35 | -------------------------------------------------------------------------------- /roles/grafana/templates/grafana-pcp-datasources.yaml.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | apiVersion: 1 4 | 5 | datasources: 6 | - name: PCP Vector 7 | type: pcp-vector-datasource 8 | access: proxy 9 | orgId: 1 10 | url: http://{{ __grafana_pmproxy_server }} 11 | editable: true 12 | isDefault: true 13 | - name: PCP {{ __grafana_keyserver_datasource_name }} 14 | type: {{ __grafana_keyserver_datasource_type }} 15 | access: proxy 16 | orgId: 1 17 | url: http://{{ __grafana_pmproxy_server }} 18 | editable: true 19 | - name: PCP bpftrace 20 | type: pcp-bpftrace-datasource 21 | access: proxy 22 | orgId: 1 23 | url: http://{{ __grafana_pmproxy_server }} 24 | editable: true 25 | -------------------------------------------------------------------------------- /roles/repository/README.md: -------------------------------------------------------------------------------- 1 | # performancecopilot.metrics.repository 2 | 3 | Installs and configures the upstream package repositories - currently hosted at [Packagecloud](https://packagecloud.io/performancecopilot/pcp) - to get the very latest [Performance Co-Pilot](https://pcp.io/) toolkit releases. 4 | 5 | ## Requirements 6 | 7 | None. 8 | 9 | ## Role Variables 10 | 11 | None. 12 | 13 | ## Dependencies 14 | 15 | None. 16 | 17 | ## Example Playbooks 18 | 19 | Ensure latest upstream PCP packages are available for installation. 20 | 21 | ```yaml 22 | - hosts: monitoring 23 | roles: 24 | - role: performancecopilot.metrics.repository 25 | ``` 26 | 27 | ## License 28 | 29 | MIT 30 | 31 | ## Author Information 32 | 33 | An official role for PCP, maintained by the PCP developers 34 | -------------------------------------------------------------------------------- /roles/pcp/meta/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | dependencies: [] 5 | 6 | galaxy_info: 7 | author: performancecopilot 8 | description: Performance Co-Pilot 9 | role_name: pcp 10 | company: pcp.io 11 | license: "license (MIT)" 12 | min_ansible_version: "2.9" 13 | platforms: 14 | - name: EL 15 | versions: 16 | - all 17 | - name: Fedora 18 | versions: 19 | - all 20 | - name: Debian 21 | versions: 22 | - all 23 | - name: Ubuntu 24 | versions: 25 | - all 26 | galaxy_tags: 27 | - metrics 28 | - analysis 29 | - monitoring 30 | - timeseries 31 | - performance 32 | - lightweight 33 | - visualization 34 | - instrumentation 35 | - el 36 | - fedora 37 | - debian 38 | - ubuntu 39 | -------------------------------------------------------------------------------- /roles/spark/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] 3 | 4 | galaxy_info: 5 | author: performancecopilot 6 | description: Performance Co-Pilot Spark role 7 | role_name: spark 8 | company: pcp.io 9 | license: "license (MIT)" 10 | min_ansible_version: "2.9" 11 | platforms: 12 | - name: EL 13 | versions: 14 | - all 15 | - name: Fedora 16 | versions: 17 | - all 18 | - name: Debian 19 | versions: 20 | - all 21 | - name: Ubuntu 22 | versions: 23 | - all 24 | galaxy_tags: 25 | - pcp 26 | - spark 27 | - metrics 28 | - analysis 29 | - monitoring 30 | - timeseries 31 | - performance 32 | - lightweight 33 | - visualization 34 | - instrumentation 35 | - el 36 | - fedora 37 | - debian 38 | - ubuntu 39 | -------------------------------------------------------------------------------- /roles/mssql/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] 3 | 4 | galaxy_info: 5 | author: performancecopilot 6 | description: Performance Co-Pilot SQL Server role 7 | role_name: mssql 8 | company: pcp.io 9 | license: "license (MIT)" 10 | min_ansible_version: "2.9" 11 | platforms: 12 | - name: EL 13 | versions: 14 | - all 15 | - name: Fedora 16 | versions: 17 | - all 18 | - name: Debian 19 | versions: 20 | - all 21 | - name: Ubuntu 22 | versions: 23 | - all 24 | galaxy_tags: 25 | - pcp 26 | - mssql 27 | - metrics 28 | - analysis 29 | - sqlserver 30 | - monitoring 31 | - timeseries 32 | - performance 33 | - lightweight 34 | - visualization 35 | - instrumentation 36 | - el 37 | - fedora 38 | - debian 39 | - ubuntu 40 | -------------------------------------------------------------------------------- /roles/postfix/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] 3 | 4 | galaxy_info: 5 | author: performancecopilot 6 | description: Performance Co-Pilot Postfix role 7 | role_name: postfix 8 | company: pcp.io 9 | license: "license (MIT)" 10 | min_ansible_version: "2.9" 11 | platforms: 12 | - name: EL 13 | versions: 14 | - all 15 | - name: Fedora 16 | versions: 17 | - all 18 | - name: Debian 19 | versions: 20 | - all 21 | - name: Ubuntu 22 | versions: 23 | - all 24 | galaxy_tags: 25 | - pcp 26 | - mail 27 | - postfix 28 | - metrics 29 | - analysis 30 | - monitoring 31 | - timeseries 32 | - performance 33 | - lightweight 34 | - visualization 35 | - instrumentation 36 | - el 37 | - fedora 38 | - debian 39 | - ubuntu 40 | -------------------------------------------------------------------------------- /roles/bpftrace/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] 3 | 4 | galaxy_info: 5 | author: performancecopilot 6 | description: Performance Co-Pilot bpftrace role 7 | role_name: bpftrace 8 | company: pcp.io 9 | license: "license (MIT)" 10 | min_ansible_version: "2.9" 11 | platforms: 12 | - name: EL 13 | versions: 14 | - all 15 | - name: Fedora 16 | versions: 17 | - all 18 | - name: Debian 19 | versions: 20 | - all 21 | - name: Ubuntu 22 | versions: 23 | - all 24 | galaxy_tags: 25 | - pcp 26 | - ebpf 27 | - metrics 28 | - bpftrace 29 | - analysis 30 | - monitoring 31 | - timeseries 32 | - performance 33 | - lightweight 34 | - visualization 35 | - instrumentation 36 | - el 37 | - fedora 38 | - debian 39 | - ubuntu 40 | -------------------------------------------------------------------------------- /roles/grafana/meta/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | dependencies: [] 5 | 6 | galaxy_info: 7 | author: performancecopilot 8 | description: Performance Co-Pilot Grafana role 9 | role_name: grafana 10 | company: pcp.io 11 | license: "license (MIT)" 12 | min_ansible_version: "2.9" 13 | platforms: 14 | - name: EL 15 | versions: 16 | - "8" 17 | - "9" 18 | - name: Fedora 19 | versions: 20 | - all 21 | galaxy_tags: 22 | - pcp 23 | - graph 24 | - redis 25 | - valkey 26 | - vector 27 | - grafana 28 | - metrics 29 | - analysis 30 | - bpftrace 31 | - monitoring 32 | - timeseries 33 | - performance 34 | - lightweight 35 | - visualization 36 | - instrumentation 37 | - el 38 | - fedora 39 | - debian 40 | - ubuntu 41 | -------------------------------------------------------------------------------- /roles/postfix/README.md: -------------------------------------------------------------------------------- 1 | # performancecopilot.metrics.postfix 2 | 3 | Installs [Postfix](https://www.postfix.org/) metrics from the [Performance Co-Pilot](https://pcp.io/) toolkit. 4 | 5 | ## Requirements 6 | 7 | All versions of Postfix and PCP should function correctly with this role. This role does *not* install or configure Postfix itself, rather it configures PCP to extract metrics from a running Postfix service. 8 | 9 | ## Role Variables 10 | 11 | None. 12 | 13 | ## Dependencies 14 | 15 | None. 16 | 17 | ## Example Playbooks 18 | 19 | Setup PCP Postfix performance metrics. 20 | 21 | ```yaml 22 | - hosts: monitoring 23 | roles: 24 | - role: performancecopilot.metrics.postfix 25 | ``` 26 | 27 | ## License 28 | 29 | MIT 30 | 31 | ## Author Information 32 | 33 | An official role for PCP, maintained by the PCP developers 34 | -------------------------------------------------------------------------------- /tests/tests_verify_retention.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test configuration of retention period 4 | hosts: all 5 | vars: 6 | __test_retention: 137 7 | 8 | roles: 9 | - role: performancecopilot.metrics.keyserver 10 | - role: performancecopilot.metrics.pcp 11 | vars: 12 | pcp_pmlogger_discard: "{{ __test_retention }}" 13 | 14 | pre_tasks: 15 | - name: Save state of services 16 | import_tasks: get_services_state.yml 17 | 18 | tasks: 19 | - name: Check basic services and the retention 20 | include_tasks: "{{ item }}" 21 | loop: 22 | - check_pcp.yml 23 | - check_pmlogger.yml 24 | - check_pmie.yml 25 | - check_retention.yml 26 | 27 | post_tasks: 28 | - name: Restore state of services 29 | import_tasks: restore_services_state.yml 30 | -------------------------------------------------------------------------------- /roles/elasticsearch/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] 3 | 4 | galaxy_info: 5 | author: performancecopilot 6 | description: Performance Co-Pilot Elasticsearch role 7 | role_name: elasticsearch 8 | company: pcp.io 9 | license: "license (MIT)" 10 | min_ansible_version: "2.9" 11 | platforms: 12 | - name: EL 13 | versions: 14 | - all 15 | - name: Fedora 16 | versions: 17 | - all 18 | - name: Debian 19 | versions: 20 | - all 21 | - name: Ubuntu 22 | versions: 23 | - all 24 | galaxy_tags: 25 | - pcp 26 | - elastic 27 | - metrics 28 | - analysis 29 | - elasticsearch 30 | - monitoring 31 | - timeseries 32 | - performance 33 | - lightweight 34 | - visualization 35 | - instrumentation 36 | - el 37 | - fedora 38 | - debian 39 | - ubuntu 40 | -------------------------------------------------------------------------------- /roles/repository/templates/packagecloud.rpms.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | [performancecopilot] 4 | name=Performance Co-Pilot 5 | baseurl=https://packagecloud.io/performancecopilot/pcp/{{ __repository_distro_name }}/$releasever/$basearch 6 | repo_gpgcheck=1 7 | enabled=1 8 | gpgcheck=0 9 | gpgkey=https://packagecloud.io/performancecopilot/pcp/gpgkey 10 | sslverify=1 11 | sslcacert=/etc/pki/tls/certs/ca-bundle.crt 12 | metadata_expire=300 13 | 14 | [performancecopilot-source] 15 | name=Performance Co-Pilot source 16 | baseurl=https://packagecloud.io/performancecopilot/pcp/{{ __repository_distro_name }}/$releasever/SRPMS 17 | repo_gpgcheck=1 18 | gpgcheck=0 19 | enabled=1 20 | gpgkey=https://packagecloud.io/performancecopilot/pcp/gpgkey 21 | sslverify=1 22 | sslcacert=/etc/pki/tls/certs/ca-bundle.crt 23 | metadata_expire=300 24 | -------------------------------------------------------------------------------- /roles/keyserver/meta/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | dependencies: [] 5 | 6 | galaxy_info: 7 | author: performancecopilot 8 | description: Performance Co-Pilot key server role 9 | role_name: keyserver 10 | company: pcp.io 11 | license: "license (MIT)" 12 | min_ansible_version: "2.9" 13 | platforms: 14 | - name: EL 15 | versions: 16 | - "8" 17 | - "9" 18 | - name: Fedora 19 | versions: 20 | - all 21 | - name: Debian 22 | versions: 23 | - all 24 | - name: Ubuntu 25 | versions: 26 | - all 27 | galaxy_tags: 28 | - pcp 29 | - redis 30 | - valkey 31 | - metrics 32 | - analysis 33 | - monitoring 34 | - timeseries 35 | - performance 36 | - lightweight 37 | - visualization 38 | - instrumentation 39 | - el 40 | - fedora 41 | - debian 42 | - ubuntu 43 | -------------------------------------------------------------------------------- /tests/restore_services_state.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Get final state of services 4 | tags: tests::cleanup 5 | service_facts: 6 | register: final_state 7 | 8 | # yamllint disable rule:line-length 9 | - name: Restore state of services 10 | tags: tests::cleanup 11 | service: 12 | name: "{{ item }}" 13 | # noqa args[module] 14 | state: "{{ 'started' if initial_state.ansible_facts.services[item + '.service']['state'] == 'running' else 'stopped' }}" 15 | when: 16 | - item + '.service' in final_state.ansible_facts.services 17 | - item + '.service' in initial_state.ansible_facts.services 18 | - initial_state.ansible_facts.services[item + '.service'].status != "not-found" 19 | with_items: 20 | - pmcd 21 | - pmlogger 22 | - pmie 23 | - pmproxy 24 | - "{{ __keyserver_name }}" 25 | - grafana-server 26 | # yamllint enable rule:line-length 27 | -------------------------------------------------------------------------------- /.github/workflows/pr-title-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: PR Title Lint 3 | on: # yamllint disable-line rule:truthy 4 | pull_request: 5 | types: 6 | - opened 7 | - synchronize 8 | - reopened 9 | - edited 10 | merge_group: 11 | branches: 12 | - main 13 | types: 14 | - checks_requested 15 | permissions: 16 | contents: read 17 | jobs: 18 | commit-checks: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | fetch-depth: 0 24 | 25 | - name: Install conventional-commit linter 26 | run: npm install @commitlint/config-conventional @commitlint/cli 27 | 28 | - name: Run commitlint on PR title 29 | env: 30 | PR_TITLE: ${{ github.event.pull_request.title }} 31 | # Echo from env variable to avoid bash errors with extra characters 32 | run: echo "$PR_TITLE" | npx commitlint --verbose 33 | -------------------------------------------------------------------------------- /roles/grafana/README.md: -------------------------------------------------------------------------------- 1 | # performancecopilot.metrics.grafana 2 | 3 | Installs and configures [Grafana](https://grafana.com) for use with the [Performance Co-Pilot](https://pcp.io/) toolkit. 4 | 5 | ## Requirements 6 | 7 | Uses features of Grafana v6+. All available PCP datasources will be installed from the [grafana-pcp](https://github.com/performancecopilot/grafana-pcp) package. 8 | 9 | ## Role Variables 10 | 11 | None. 12 | 13 | ## Dependencies 14 | 15 | None. 16 | 17 | ## Example Playbook 18 | 19 | Setup PCP and Grafana for graphing live metrics locally using Vector. 20 | 21 | ```yaml 22 | - hosts: monitoring 23 | roles: 24 | - role: performancecopilot.metrics.grafana 25 | - role: performancecopilot.metrics.pcp 26 | vars: 27 | pcp_rest_api: true 28 | ``` 29 | 30 | ## License 31 | 32 | MIT 33 | 34 | ## Author Information 35 | 36 | An official role for PCP, maintained by the PCP developers 37 | -------------------------------------------------------------------------------- /roles/elasticsearch/templates/pcp2elasticsearch.service.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | [Unit] 4 | Description=pcp-to-elasticsearch metrics export service 5 | Documentation=man:pcp2elasticsearch(1) 6 | After=network-online.target pmcd.service 7 | 8 | [Service] 9 | TimeoutSec=10 10 | ExecStartPre=/usr/bin/pmrepconf -c \ 11 | --option interval={{ elasticsearch_export_interval }} \ 12 | --option es_index={{ elasticsearch_export_index }} \ 13 | --option es_hostid={{ elasticsearch_export_hostid }} \ 14 | --option es_server={{ elasticsearch_export_server }} \ 15 | --option es_search_type={{ elasticsearch_export_type }} \ 16 | {{ __elasticsearch_export_conf }} 17 | ExecStart=/usr/bin/pcp2elasticsearch --include-labels :metrics 18 | Restart=on-failure 19 | 20 | [Install] 21 | WantedBy=multi-user.target 22 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # Collections Plugins Directory 2 | 3 | This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that 4 | is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that 5 | would contain module utils and modules respectively. 6 | 7 | Here is an example directory of the majority of plugins currently supported by Ansible: 8 | 9 | ```plain 10 | └── plugins 11 | ├── action 12 | ├── become 13 | ├── cache 14 | ├── callback 15 | ├── cliconf 16 | ├── connection 17 | ├── filter 18 | ├── httpapi 19 | ├── inventory 20 | ├── lookup 21 | ├── module_utils 22 | ├── modules 23 | ├── netconf 24 | ├── shell 25 | ├── strategy 26 | ├── terminal 27 | ├── test 28 | └── vars 29 | ``` 30 | 31 | A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible/2.9/plugins/plugins.html). 32 | -------------------------------------------------------------------------------- /tests/tests_verify_pmie_webhook.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test pmie webhook configuration 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.keyserver 8 | - role: performancecopilot.metrics.pcp 9 | vars: 10 | pcp_pmie_endpoint: https://example.com:12345/webhook 11 | 12 | pre_tasks: 13 | - name: Skip test if not supported by platform 14 | meta: end_host 15 | when: (ansible_distribution in ['RedHat', 'CentOS'] and 16 | (ansible_facts['distribution_version'] is version('9.3', '<'))) or 17 | ansible_distribution not in ['Fedora', 'RedHat', 'CentOS'] 18 | 19 | - name: Save state of services 20 | import_tasks: get_services_state.yml 21 | 22 | tasks: 23 | - name: Check if configuring pmie webhook works 24 | include_tasks: check_pmie_webhook.yml 25 | 26 | post_tasks: 27 | - name: Restore state of services 28 | import_tasks: restore_services_state.yml 29 | -------------------------------------------------------------------------------- /roles/pcp/files/zeroconf/all_threads: -------------------------------------------------------------------------------- 1 | #pmieconf-rules 1 2 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 3 | # 4 | 5 | rule zeroconf.all_threads 6 | default = "$rule$" 7 | predicate = "some_host ( proc.control.all.threads == 0 )" 8 | enabled = no 9 | version = 1 10 | help = 11 | "Ensure per-thread metrics are exported by the pmdaproc(1) 12 | Performance Metric Domain Agent (PMDA)."; 13 | 14 | string rule 15 | default = "Enable per-thread proc metrics" 16 | modify = no 17 | display = no; 18 | 19 | string action_expand 20 | default = "threads[%v]@%h" 21 | display = no 22 | modify = no; 23 | 24 | string email_expand 25 | default = "host: %h threads=%v" 26 | display = no 27 | modify = no; 28 | 29 | shell all_threads_action 30 | enabled = yes 31 | default = "pmstore proc.control.all.threads 1" 32 | help = 33 | "The pmdaproc(1) Performance Metrics Domain Agent will receive a 34 | metric store to via pmstore(1) to export threads values as well."; 35 | 36 | # 37 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 38 | -------------------------------------------------------------------------------- /tests/tests_verify_repository.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Ensure that the repository role runs 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.keyserver 8 | - role: performancecopilot.metrics.repository 9 | - role: performancecopilot.metrics.pcp 10 | 11 | pre_tasks: 12 | - name: Save state of services 13 | import_tasks: get_services_state.yml 14 | 15 | tasks: 16 | - name: Check if pcp role setup still works 17 | include_tasks: "{{ item }}" 18 | loop: 19 | - check_pcp.yml 20 | - check_pmie.yml 21 | - check_pmlogger.yml 22 | 23 | - name: Check headers for ansible_managed, fingerprint 24 | include_tasks: check_header.yml 25 | vars: 26 | __fingerprint: "performancecopilot:ansible-pcp" 27 | __file: /etc/yum.repos.d/performancecopilot.repo 28 | when: ansible_facts["os_family"] == "RedHat" 29 | 30 | post_tasks: 31 | - name: Restore state of services 32 | import_tasks: restore_services_state.yml 33 | -------------------------------------------------------------------------------- /molecule/default/molecule.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | dependency: 4 | name: galaxy 5 | driver: 6 | name: ${LSR_MOLECULE_DRIVER:-docker} 7 | platforms: 8 | - name: centos-6 9 | image: registry.centos.org/centos:6 10 | volumes: 11 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 12 | privileged: true 13 | command: /sbin/init 14 | - name: centos-7 15 | image: registry.centos.org/centos/systemd:latest 16 | volumes: 17 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 18 | privileged: true 19 | command: /usr/lib/systemd/systemd --system 20 | - name: centos-8 21 | image: registry.centos.org/centos:8 22 | volumes: 23 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 24 | privileged: true 25 | command: /usr/lib/systemd/systemd --system 26 | provisioner: 27 | name: ansible 28 | log: true 29 | playbooks: 30 | converge: ../../tests/tests_default.yml 31 | scenario: 32 | name: default 33 | test_sequence: 34 | - destroy 35 | - create 36 | - converge 37 | - idempotence 38 | - check 39 | - destroy 40 | -------------------------------------------------------------------------------- /.github/workflows/markdownlint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # yamllint disable rule:line-length 3 | name: Markdown Lint 4 | on: # yamllint disable-line rule:truthy 5 | pull_request: 6 | merge_group: 7 | branches: 8 | - main 9 | types: 10 | - checks_requested 11 | push: 12 | branches: 13 | - main 14 | workflow_dispatch: 15 | permissions: 16 | contents: read 17 | jobs: 18 | markdownlint: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Update pip, git 22 | run: | 23 | set -euxo pipefail 24 | sudo apt update 25 | sudo apt install -y git 26 | 27 | - name: Check out code 28 | uses: actions/checkout@v4 29 | 30 | # CHANGELOG.md is generated automatically from PR titles and descriptions 31 | # It might have issues but they are not critical 32 | - name: Lint all markdown files except for CHANGELOG.md 33 | uses: docker://avtodev/markdown-lint:master 34 | with: 35 | args: >- 36 | --ignore=CHANGELOG.md 37 | **/*.md 38 | config: .markdownlint.yaml 39 | -------------------------------------------------------------------------------- /tests/tests_verify_spark.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Ensure that the spark role runs 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.keyserver 8 | - role: performancecopilot.metrics.pcp 9 | vars: 10 | pcp_rest_api: true 11 | pcp_pmproxy_localonly: 1 12 | - role: performancecopilot.metrics.spark 13 | vars: 14 | spark_export_metrics: true 15 | 16 | pre_tasks: 17 | - name: Save state of services 18 | import_tasks: get_services_state.yml 19 | 20 | tasks: 21 | - name: Check if spark role setup works 22 | include_tasks: "{{ item }}" 23 | loop: 24 | - check_pcp2spark.yml 25 | - check_pmdaopenmetrics.yml 26 | 27 | - name: Check headers for ansible_managed, fingerprint 28 | include_tasks: check_header.yml 29 | vars: 30 | __fingerprint: "performancecopilot:ansible-pcp" 31 | __file: "{{ __spark_service_path }}/pcp2spark.service" 32 | 33 | post_tasks: 34 | - name: Restore state of services 35 | import_tasks: restore_services_state.yml 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020-2021 Red Hat, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /roles/pcp/files/filesys/vfs_files: -------------------------------------------------------------------------------- 1 | #pmieconf-rules 1 2 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 3 | 4 | rule filesys.vfs_files 5 | summary = "$rule$" 6 | enumerate = hosts 7 | predicate = 8 | "some_host ( 9 | vfs.files.count $hosts$ > 0 && vfs.files.max $hosts$ > 0 && 10 | 100 * ( vfs.files.count $hosts$ / vfs.files.max $hosts$ ) > $threshold$ 11 | )" 12 | enabled = yes 13 | version = 1 14 | help = 15 | "Number of allocated file handles (open file descriptors) is at or 16 | above a threshold percentage of the total available (maximum kernel 17 | enforced limit)."; 18 | 19 | percent threshold 20 | default = 90 21 | help = 22 | "The threshold of open file handles that has been allocated compared 23 | to the maximum number available, expressed as a percentage."; 24 | 25 | string rule 26 | default = "Approaching open file descriptor limit" 27 | modify = no 28 | display = no; 29 | 30 | string action_expand 31 | default = %vopen@%h 32 | display = yes 33 | modify = no; 34 | 35 | string email_expand 36 | default = "host: %h open files: %v" 37 | display = no 38 | modify = no; 39 | 40 | # 41 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 42 | 43 | -------------------------------------------------------------------------------- /roles/pcp/vars/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | __pcp_packages: 5 | - pcp 6 | 7 | __pcp_packages_extra: [] 8 | 9 | __pcp_conf: /etc/pcp.conf 10 | __pcp_pmcd_conf: /etc/pcp/pmcd/pmcd.conf 11 | __pcp_pmcd_sasldb_path: /etc/pcp/passwd.db 12 | __pcp_pmcd_saslconf_path: /etc/sasl2/pmcd.conf 13 | __pcp_explicit_labels_path: /etc/pcp/labels 14 | __pcp_implicit_labels_path: /etc/pcp/labels/optional 15 | __pcp_agents_path: /var/lib/pcp/pmdas 16 | 17 | __pcp_pmlogger_control_d_path: /etc/pcp/pmlogger/control.d 18 | __pcp_pmlogger_control_path: /etc/pcp/pmlogger/control 19 | 20 | __pcp_pmie_control_d_path: /etc/pcp/pmie/control.d 21 | __pcp_pmie_control_path: /etc/pcp/pmie/control 22 | __pcp_pmie_config_path: /var/lib/pcp/config/pmie 23 | 24 | __pcp_pmieconf_path: /etc/pcp/pmieconf 25 | __pcp_pmieconf_link_path: /var/lib/pcp/config/pmieconf 26 | 27 | __pcp_pmieconf_groups: 28 | - network 29 | - power 30 | - zeroconf 31 | - filesys 32 | 33 | __pcp_pmieconf_rules: 34 | - network/tcplistenoverflows 35 | - network/tcpqfulldocookies 36 | - network/tcpqfulldrops 37 | - power/thermal_throttle 38 | - zeroconf/all_threads 39 | - filesys/vfs_files 40 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmcd.sasl2.conf.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | # Enabled authentication mechanisms (space-separated list). 4 | # You can list many mechanisms at once, then the user can choose 5 | # by adding e.g. '?authmech=gssapi' to their host specification. 6 | # For other options, refer to SASL pluginviewer command output. 7 | #mech_list: plain login digest-md5 gssapi 8 | mech_list: {{ __pcp_sasl_mechlist }} 9 | 10 | # If deferring to the SASL auth daemon (runs as root, can do PAM 11 | # login using regular user accounts, unprivileged daemons cannot). 12 | #pwcheck_method: saslauthd 13 | 14 | # If using plain/digest-md5 for user database, this sets the file 15 | # containing the passwords. Use 'saslpasswd2 -a pmcd [username]' 16 | # to add entries and 'sasldblistusers2 -f $sasldb_path' to browse. 17 | # Note: must be readable as the PCP daemons user (chown root:pcp). 18 | sasldb_path: {{ __pcp_pmcd_sasldb_path }} 19 | 20 | # Before using Kerberos via GSSAPI, you need a service principal on 21 | # the KDC server for pmcd, and that to be exported to the keytab. 22 | #keytab: /etc/pcp/krb5.tab 23 | -------------------------------------------------------------------------------- /roles/pcp/files/network/tcplistenoverflows: -------------------------------------------------------------------------------- 1 | #pmieconf-rules 1 2 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 3 | # 4 | 5 | rule network.listenoverflows 6 | summary = "$rule$" 7 | enumerate = hosts 8 | predicate = 9 | "some_host ( 10 | network.tcp.listenoverflows $hosts$ > 0 11 | )" 12 | enabled = yes 13 | version = 1 14 | help = 15 | "Socket connections are being dropped by the kernel due to the accept 16 | queue backlog for a socket being overrun. This can happen when there 17 | are too many socket connections being made in too short a time, such 18 | that the service listening on the socket is not processing them (via 19 | the listen(2) system call) sufficiently quickly."; 20 | 21 | string rule 22 | default = "TCP listen overflows" 23 | modify = no 24 | display = no; 25 | 26 | string delta 27 | default = "2 min" 28 | help = 29 | "Sample interval between evaluations of this rule."; 30 | 31 | string action_expand 32 | default = "%v/sec@%h" 33 | display = no 34 | modify = no; 35 | 36 | string email_expand 37 | default = "host: %h listen overflows: %v%" 38 | display = no 39 | modify = no; 40 | 41 | # 42 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 43 | -------------------------------------------------------------------------------- /roles/keyserver/README.md: -------------------------------------------------------------------------------- 1 | # performancecopilot.metrics.keyserver 2 | 3 | Installs and configures either [Valkey](https://valkey.io) or [Redis](https://redis.io) for use with the [Performance Co-Pilot](https://pcp.io/) toolkit. 4 | 5 | ## Requirements 6 | 7 | Requires a modern version of either Valkey or Redis (preferencing the open source Valkey on latest Linux distributions). If the target platform provides it, the ValkeySearch (or RediSearch) module will also be installed. 8 | 9 | ## Role Variables 10 | 11 | ### keyserver_save_to_disk: true 12 | 13 | Incrementally save the database to disk. Default: true. 14 | 15 | ## Dependencies 16 | 17 | None. 18 | 19 | ## Example Playbook 20 | 21 | Central PCP setup for monitoring of several remote hosts with fast, scalable querying enabled. 22 | 23 | ```yaml 24 | - hosts: monitoring 25 | roles: 26 | - role: performancecopilot.metrics.keyserver 27 | - role: performancecopilot.metrics.pcp 28 | vars: 29 | pcp_target_hosts: [slip, slop, slap] 30 | pcp_rest_api: true 31 | ``` 32 | 33 | ## License 34 | 35 | MIT 36 | 37 | ## Author Information 38 | 39 | An official role for PCP, maintained by the PCP developers 40 | -------------------------------------------------------------------------------- /roles/repository/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Set platform/version specific variables 5 | include_vars: "{{ item }}" 6 | loop: 7 | - "{{ role_path }}/vars/default.yml" 8 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml" 9 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml" 10 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" 11 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml" 12 | when: item is file 13 | # yamllint enable rule:line-length 14 | 15 | - name: Ensure PCP package repository is configured for RPMs 16 | template: 17 | src: packagecloud.rpms.j2 18 | dest: /etc/yum.repos.d/performancecopilot.repo 19 | mode: "0600" 20 | when: 21 | - ansible_facts['os_family'] == 'RedHat' 22 | 23 | - name: Ensure PCP package repository is configured for DEBs 24 | file: 25 | src: packagecloud.debs.j2 26 | dest: /etc/apt/sources.list.d/performancecopilot.sources 27 | mode: "0600" 28 | when: 29 | - ansible_facts['os_family'] == 'Debian' 30 | -------------------------------------------------------------------------------- /tests/tests_verify_into_elasticsearch.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test import to Elasticsearch 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.keyserver 8 | - role: performancecopilot.metrics.elasticsearch 9 | vars: 10 | elasticsearch_export_metrics: true 11 | 12 | pre_tasks: 13 | - name: Skip test if not supported by platform 14 | meta: end_host 15 | when: (ansible_distribution in ['RedHat'] and 16 | (ansible_facts['distribution_version'] is version('8.4', '<'))) or 17 | ansible_distribution not in ['Fedora', 'RedHat'] 18 | 19 | - name: Save state of services 20 | import_tasks: get_services_state.yml 21 | 22 | tasks: 23 | - name: Check if import to Elasticsearch works 24 | include_tasks: check_into_elasticsearch.yml 25 | 26 | - name: Check headers for ansible_managed, fingerprint 27 | include_tasks: check_header.yml 28 | vars: 29 | __fingerprint: "performancecopilot:ansible-pcp" 30 | __file: "{{ __elasticsearch_service_path }}/pcp2elasticsearch.service" 31 | 32 | post_tasks: 33 | - name: Restore state of services 34 | import_tasks: restore_services_state.yml 35 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmlogger.timers.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | ## Type: string 4 | ## Default: "" 5 | # 6 | # Run the pmlogger_daily binary, via pmlogger_daily.service, with the 7 | # following parameters. 8 | # 9 | PMLOGGER_DAILY_PARAMS="--discard {{ pcp_pmlogger_discard }}" 10 | 11 | ## Type: string 12 | ## Default: "-C" 13 | # 14 | # Run the pmlogger_check binary, via pmlogger_check.service, with the 15 | # following parameters. 16 | # 17 | #PMLOGGER_CHECK_PARAMS="" 18 | 19 | ## Type: string 20 | ## Default: "-p" 21 | # 22 | # Run the pmlogger_daily binary, via pmlogger_daily_poll.service, with the 23 | # following parameters. 24 | # 25 | #PMLOGGER_DAILY_POLL_PARAMS="" 26 | 27 | 28 | ## Type: string 29 | ## Default: "-o /var/log/pcp/sa/" 30 | # 31 | # Run the pmlogger_daily_report binary, via pmlogger_daily_report.service, with 32 | # the following parameters. 33 | # 34 | #PMLOGGER_DAILY_REPORT_PARAMS="" 35 | 36 | ## Type: string 37 | ## Default: "-o /var/log/pcp/sa/ -p" 38 | # 39 | # Run the pmlogger_daily_report binary, via pmlogger_daily_report_poll.service, 40 | # with the following parameters. 41 | # 42 | #PMLOGGER_DAILY_REPORT_POLL_PARAMS="" 43 | -------------------------------------------------------------------------------- /roles/bpftrace/templates/bpftrace.conf.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | # 4 | # PCP bpftrace PMDA config file - see pmdabpftrace(1) and PMDA(3) 5 | # 6 | 7 | [bpftrace] 8 | # Path to bpftrace executable 9 | bpftrace_path = bpftrace 10 | 11 | # Unnamed scripts are removed if their value is not requested within a 12 | # specified time period (in seconds) 13 | script_expiry_time = 60 14 | 15 | # Maximum throughput of bpftrace scripts in bytes 16 | max_throughput = 2097152 17 | 18 | 19 | [dynamic_scripts] 20 | # Control whether the bpftrace PMDA should start bpftrace scripts 21 | # on demand by executing pmStore (3) bpftrace.control.register 22 | # required for the PCP bpftrace datasource in grafana-pcp 23 | enabled = true 24 | 25 | # See https://grafana-pcp.readthedocs.io/en/latest/datasources/authentication.html 26 | # on how to set up authentication. Disabling authentication is NOT RECOMMENDED, 27 | # as everyone would be able to run bpftrace scripts AS ROOT, which can leak sensitive 28 | # information and run unsafe commands! 29 | auth_enabled = true 30 | 31 | # Comma-separated list of usernames which are allowed to register 32 | # bpftrace scripts 33 | allowed_users = {{ __bpftrace_usernames }} 34 | -------------------------------------------------------------------------------- /tests/check_pmie_webhook.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Check if primary pmie is running 4 | changed_when: false 5 | shell: | 6 | set -eu 7 | if set -o | grep -q pipefail; then 8 | set -o pipefail # no pipefail on debian, some ubuntu 9 | fi 10 | pmprobe -I pmcd.pmie.pmcd_host | grep '"primary"' 11 | when: (ansible_facts['distribution'] in ['RedHat', 'CentOS'] and 12 | ansible_facts['distribution_major_version'] | int > 6) or 13 | ansible_facts['distribution'] not in ['Fedora', 'RedHat', 'CentOS'] 14 | 15 | # yamllint disable rule:line-length 16 | - name: Check if primary pmie uses webhook 17 | changed_when: false 18 | shell: | 19 | set -eu 20 | if set -o | grep -q pipefail; then 21 | set -o pipefail # no pipefail on debian, some ubuntu 22 | fi 23 | pmieconf -f /var/lib/pcp/config/pmie/config.default list global webhook_endpoint | grep '"example"' 24 | pmieconf -f /var/lib/pcp/config/pmie/config.default list global webhook_action | grep '"yes"' 25 | when: (ansible_distribution in ['RedHat', 'CentOS'] and 26 | (ansible_facts['distribution_version'] is version('9.3', '<'))) or 27 | ansible_distribution not in ['Fedora', 'RedHat', 'CentOS'] 28 | # yamllint enable rule:line-length 29 | -------------------------------------------------------------------------------- /tests/tests_verify_from_elasticsearch.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test import from Elasticsearch 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.keyserver 8 | - role: performancecopilot.metrics.elasticsearch 9 | vars: 10 | elasticsearch_agent: true 11 | - role: performancecopilot.metrics.pcp 12 | vars: 13 | pcp_optional_agents: ['elasticsearch'] 14 | 15 | pre_tasks: 16 | - name: Skip test if not supported by platform 17 | meta: end_host 18 | when: (ansible_distribution in ['RedHat', 'CentOS'] and 19 | ansible_distribution_major_version | int < 7) or 20 | ansible_distribution not in ['Fedora', 'RedHat', 'CentOS'] 21 | 22 | - name: Save state of services 23 | import_tasks: get_services_state.yml 24 | 25 | tasks: 26 | - name: Check if import from Elasticsearch works 27 | include_tasks: check_from_elasticsearch.yml 28 | 29 | - name: Check headers for ansible_managed, fingerprint 30 | include_tasks: check_header.yml 31 | vars: 32 | __fingerprint: "performancecopilot:ansible-pcp" 33 | __file: "{{ __elasticsearch_conf }}" 34 | 35 | post_tasks: 36 | - name: Restore state of services 37 | import_tasks: restore_services_state.yml 38 | -------------------------------------------------------------------------------- /galaxy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### REQUIRED 3 | namespace: performancecopilot 4 | name: metrics 5 | version: 2.4.2 6 | readme: README.md 7 | authors: 8 | - Jan Kurik 9 | - Nathan Scott 10 | - Rich Megginson 11 | - Sergei Petrosian 12 | 13 | ### OPTIONAL 14 | description: Performance Co-Pilot Ansible collection 15 | license_file: 'LICENSE' 16 | repository: https://github.com/performancecopilot/ansible-pcp 17 | documentation: https://pcp.readthedocs.io 18 | homepage: https://pcp.io 19 | issues: https://github.com/performancecopilot/ansible-pcp/issues 20 | tags: 21 | - metrics 22 | - analysis 23 | - telemetry 24 | - monitoring 25 | - timeseries 26 | - performance 27 | - lightweight 28 | - visualization 29 | - instrumentation 30 | - observability 31 | - grafana 32 | - valkey 33 | - redis 34 | - pcp 35 | build_ignore: 36 | - .ansible-lint 37 | - .github 38 | - .gitignore 39 | - .lgtm.yml 40 | - .yamllint.yml 41 | - .yamllint_defaults.yml 42 | - ansible_pytest_extra_requirements.txt 43 | - custom_requirements.txt 44 | - molecule_extra_requirements.txt 45 | - pylint_extra_requirements.txt 46 | - pytest_extra_requirements.txt 47 | - tests 48 | - tox.ini 49 | 50 | dependencies: 51 | ansible.posix: '*' # for rpm-ostree 52 | -------------------------------------------------------------------------------- /roles/pcp/files/network/tcpqfulldrops: -------------------------------------------------------------------------------- 1 | #pmieconf-rules 1 2 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 3 | # 4 | 5 | rule network.tcpqfulldrops 6 | summary = "$rule$" 7 | enumerate = hosts 8 | predicate = 9 | "some_host ( 10 | network.tcp.reqqfulldrop $hosts$ > 0 11 | )" 12 | enabled = yes 13 | version = 1 14 | help = 15 | "New socket connection attempts are being dropped because the SYN 16 | backlog queue is full. This occurs when the kernel, accepting new 17 | connections on behalf of a service, has received the client SYN 18 | message, but had not yet received the client ACK, when the SYN backlog 19 | is overrun. This is likely to be observed mainly on systems with SYN 20 | cookies disabled, as the kernel will enter a different state when they 21 | are enabled (the tcpqfulldocookies rule detects that situation)."; 22 | 23 | string rule 24 | default = "TCP request queue full drops" 25 | modify = no 26 | display = no; 27 | 28 | string delta 29 | default = "2 min" 30 | help = 31 | "Sample interval between evaluations of this rule."; 32 | 33 | string action_expand 34 | default = "%v/sec@%h" 35 | display = no 36 | modify = no; 37 | 38 | string email_expand 39 | default = "host: %h request queue full drops: %v%" 40 | display = no 41 | modify = no; 42 | 43 | # 44 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 45 | -------------------------------------------------------------------------------- /roles/pcp/files/network/tcpqfulldocookies: -------------------------------------------------------------------------------- 1 | #pmieconf-rules 1 2 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 3 | # 4 | 5 | rule network.tcpqfulldocookies 6 | summary = "$rule$" 7 | enumerate = hosts 8 | predicate = 9 | "some_host ( 10 | network.tcp.reqqfulldocookies $hosts$ > 0 11 | )" 12 | enabled = yes 13 | version = 1 14 | help = 15 | "New socket connection attempts are being dropped because the SYN 16 | backlog queue is full and the kernel's built-in SYN flood prevention 17 | has kicked in. When the kernel is sending SYN cookies during normal 18 | operation it indicates that the rate of connections is probably too 19 | high for the default limits as SYN cookies are really only meant for 20 | mitigating SYN floods (see also tcpqfulldocookies and listenoverflows 21 | rules for additional details)."; 22 | 23 | string rule 24 | default = "TCP request queue full SYN cookie replies" 25 | modify = no 26 | display = no; 27 | 28 | string delta 29 | default = "2 min" 30 | help = 31 | "Sample interval between evaluations of this rule."; 32 | 33 | string action_expand 34 | default = "%v/sec@%h" 35 | display = no 36 | modify = no; 37 | 38 | string email_expand 39 | default = "host: %h request queue full SYNCOOKIE replies: %v%" 40 | display = no 41 | modify = no; 42 | 43 | # 44 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 45 | -------------------------------------------------------------------------------- /roles/pcp/files/power/thermal_throttle: -------------------------------------------------------------------------------- 1 | #pmieconf-rules 1 2 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 3 | # 4 | 5 | rule power.thermal_throttle 6 | summary = "$rule$" 7 | enumerate = hosts 8 | predicate = 9 | "some_host ( 10 | 100 * hinv.cpu.thermal_throttle.package.time $hosts$ > $threshold$ 11 | )" 12 | enabled = yes 13 | version = 1 14 | help = 15 | "Over the last sample interval at least one CPU was affected by 16 | thermal throttling for a threshold percent or more of the time. 17 | When a CPU is throttled the hardware is slowed (voltage lowered, 18 | frequency lowered) to reduce the heat being generated."; 19 | 20 | string rule 21 | default = "CPU is experiencing thermal throttling" 22 | modify = no 23 | display = no; 24 | 25 | unsigned threshold 26 | default = 50 27 | help = 28 | "Threshold percentage for time a CPU spent under the effects of 29 | thermal throttling, in the range 0 (no time) to 100 (all time), 30 | independent of the number of CPUs."; 31 | 32 | string delta 33 | default = "2 min" 34 | help = 35 | "Sample interval between evaluations of this rule."; 36 | 37 | string action_expand 38 | default = "%v%time[%i]@%h" 39 | display = no 40 | modify = no; 41 | 42 | string email_expand 43 | default = "host: %h CPU: %i thermal throttle time: %v%" 44 | display = no 45 | modify = no; 46 | 47 | # 48 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 49 | -------------------------------------------------------------------------------- /tests/tests_verify_keyserver.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Ensure that the role runs with scalable timeseries queries enabled 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.pcp 8 | vars: 9 | pcp_rest_api: true 10 | pcp_pmproxy_localonly: 1 11 | - role: performancecopilot.metrics.keyserver 12 | 13 | pre_tasks: 14 | - name: Skip test if not supported by platform 15 | meta: end_host 16 | when: (ansible_facts['distribution'] in ['RedHat', 'CentOS'] and 17 | ansible_facts['distribution_major_version'] | int < 8) or 18 | ansible_facts['distribution'] not in ['Fedora', 'RedHat', 'CentOS'] 19 | 20 | - name: Save state of services 21 | import_tasks: get_services_state.yml 22 | 23 | tasks: 24 | - name: Check the set of all services needed for queryies 25 | include_tasks: "{{ item }}" 26 | loop: 27 | - check_pcp.yml 28 | - check_keyserver.yml 29 | - check_pmproxy.yml 30 | 31 | - name: Check headers for ansible_managed, fingerprint 32 | include_tasks: check_header.yml 33 | vars: 34 | __fingerprint: "performancecopilot:ansible-pcp" 35 | __file: "{{ __keyserver_conf_link }}/{{ __keyserver_conf_file }}" 36 | 37 | post_tasks: 38 | - name: Restore state of services 39 | import_tasks: restore_services_state.yml 40 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmlogger.defaults.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | # Environment variables for the primary pmlogger daemon. See also 4 | # the pmlogger control file and pmlogconf(1) for additional details. 5 | 6 | # Behaviour regarding listening on external-facing interfaces; 7 | # unset PMLOGGER_LOCAL to allow connections from remote hosts. 8 | # A value of 0 permits remote connections, 1 permits local only. 9 | PMLOGGER_LOCAL={{ pcp_pmlogger_localonly }} 10 | 11 | # Max length to which the queue of pending connections may grow 12 | # A value of 5 is the default. 13 | # PMLOGGER_MAXPENDING=5 14 | 15 | # Default sampling interval pmlogger uses when no more specific 16 | # interval is requested. A value of 60 seconds is the default. 17 | # Both pmlogger command line (via control file) and also pmlogger 18 | # configuration file directives will override this value. 19 | PMLOGGER_INTERVAL={{ pcp_pmlogger_interval }} 20 | 21 | # The default behaviour, when pmlogger configuration comes from 22 | # pmlogconf(1), is to regenerate the configuration file and check for 23 | # changes whenever pmlogger is started from pmlogger_check(1). 24 | # If the PMDA configuration is stable, this is not necessary, and 25 | # setting PMLOGGER_CHECK_SKIP_LOGCONF to yes disables the regeneration 26 | # and checking. 27 | # PMLOGGER_CHECK_SKIP_LOGCONF=yes 28 | -------------------------------------------------------------------------------- /tests/tests_verify_postfix.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test installation and configuration of Postfix agent 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.keyserver 8 | - role: performancecopilot.metrics.postfix 9 | - role: performancecopilot.metrics.pcp 10 | vars: 11 | pcp_optional_agents: ['postfix'] 12 | 13 | pre_tasks: 14 | - name: Save state of services 15 | import_tasks: get_services_state.yml 16 | 17 | - name: Determine if system is ostree and set flag 18 | when: not __ansible_pcp_is_ostree is defined 19 | block: 20 | - name: Check if system is ostree 21 | stat: 22 | path: /run/ostree-booted 23 | register: __ostree_booted_stat 24 | 25 | - name: Set flag to indicate system is ostree 26 | set_fact: 27 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 28 | 29 | - name: Ensure Postfix is installed 30 | package: 31 | name: postfix 32 | state: present 33 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 34 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 35 | 36 | tasks: 37 | - name: Check Postfix functionality 38 | include_tasks: "{{ item }}" 39 | loop: 40 | - check_postfix.yml 41 | 42 | post_tasks: 43 | - name: Restore state of services 44 | import_tasks: restore_services_state.yml 45 | -------------------------------------------------------------------------------- /tests/tests_verify_grafana.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Ensure that the grafana role works 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.keyserver 8 | - role: performancecopilot.metrics.pcp 9 | vars: 10 | pcp_rest_api: true 11 | pcp_pmproxy_localonly: 1 12 | - role: performancecopilot.metrics.grafana 13 | 14 | pre_tasks: 15 | - name: Skip test if not supported by platform 16 | meta: end_host 17 | when: (ansible_facts['distribution'] in ['RedHat', 'CentOS'] and 18 | ansible_facts['distribution_major_version'] | int < 8) or 19 | ansible_facts['distribution'] not in ['Fedora', 'RedHat', 'CentOS'] 20 | 21 | - name: Save state of services 22 | import_tasks: get_services_state.yml 23 | 24 | tasks: 25 | - name: Check if Grafana works 26 | include_tasks: "{{ item }}" 27 | loop: 28 | - check_grafana.yml 29 | - check_grafana_pcp.yml 30 | - check_default_datasources.yml 31 | 32 | - name: Check headers for ansible_managed, fingerprint 33 | include_tasks: check_header.yml 34 | vars: 35 | __fingerprint: "performancecopilot:ansible-pcp" 36 | loop: 37 | - "{{ __grafana_conf }}" 38 | - "{{ __grafana_provisioning_path }}/datasources/grafana-pcp.yaml" 39 | loop_control: 40 | loop_var: __file 41 | 42 | post_tasks: 43 | - name: Restore state of services 44 | import_tasks: restore_services_state.yml 45 | -------------------------------------------------------------------------------- /roles/postfix/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Set platform/version specific variables 5 | include_vars: "{{ item }}" 6 | loop: 7 | - "{{ role_path }}/vars/default.yml" 8 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml" 9 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml" 10 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" 11 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml" 12 | when: item is file 13 | # yamllint enable rule:line-length 14 | 15 | - name: Determine if system is ostree and set flag 16 | when: not __ansible_pcp_is_ostree is defined 17 | block: 18 | - name: Check if system is ostree 19 | stat: 20 | path: /run/ostree-booted 21 | register: __ostree_booted_stat 22 | 23 | - name: Set flag to indicate system is ostree 24 | set_fact: 25 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 26 | 27 | - name: Establish Postfix metrics package names 28 | set_fact: 29 | __postfix_packages_extra: "{{ __postfix_packages_pcp }}" 30 | when: postfix_metrics_provider == 'pcp' 31 | 32 | - name: Install needed Postfix metrics packages 33 | package: 34 | name: "{{ __postfix_packages_extra }}" 35 | state: present 36 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 37 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 38 | when: __postfix_packages_extra | d([]) | length > 0 39 | -------------------------------------------------------------------------------- /molecule/default/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # Molecule managed 3 | 4 | {% if item.registry is defined %} 5 | FROM {{ item.registry.url }}/{{ item.image }} 6 | {% else %} 7 | FROM {{ item.image }} 8 | {% endif %} 9 | 10 | RUN set -euo pipefail; \ 11 | pkgs="python sudo yum-plugin-ovl bash"; \ 12 | if grep 'CentOS release 6' /etc/centos-release > /dev/null 2>&1; then \ 13 | for file in /etc/yum.repos.d/CentOS-*.repo; do \ 14 | if ! grep '^baseurl=.*vault[.]centos[.]org' "$file"; then \ 15 | sed -i -e 's,^mirrorlist,#mirrorlist,' \ 16 | -e 's,^#baseurl=,baseurl=,' \ 17 | -e 's,mirror.centos.org/centos/$releasever,vault.centos.org/6.10,' \ 18 | "$file"; \ 19 | fi; \ 20 | done; \ 21 | pkgs="$pkgs upstart chkconfig initscripts"; \ 22 | fi; \ 23 | if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 24 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python3 sudo python3-devel python3-dnf bash && dnf clean all; \ 25 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y $pkgs && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 26 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 27 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 28 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 29 | -------------------------------------------------------------------------------- /tests/tests_verify_bpftrace.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test BPFTrace with SASL auth 4 | hosts: all 5 | vars: 6 | __test_uname: pcptest 7 | __test_pswd: t;dlen;dle 8 | 9 | # yamllint disable rule:line-length 10 | roles: 11 | - role: performancecopilot.metrics.keyserver 12 | - role: performancecopilot.metrics.bpftrace 13 | vars: 14 | bpftrace_users: 15 | - {user: "{{ __test_uname }}"} 16 | - role: performancecopilot.metrics.pcp 17 | vars: 18 | pcp_optional_agents: ['bpftrace'] 19 | pcp_accounts: 20 | - {user: "{{ __test_uname }}", sasluser: "{{ __test_uname }}", saslpassword: "{{ __test_pswd }}"} 21 | # yamllint enable rule:line-length 22 | 23 | pre_tasks: 24 | - name: Skip test if not supported by platform 25 | meta: end_host 26 | when: (ansible_distribution in ['RedHat', 'CentOS'] and 27 | ansible_distribution_major_version | int < 8) or 28 | ansible_distribution not in ['Fedora', 'RedHat', 'CentOS'] 29 | 30 | - name: Save state of services 31 | import_tasks: get_services_state.yml 32 | 33 | tasks: 34 | - name: Check if BPFTrace & SASL works 35 | include_tasks: "{{ item }}" 36 | loop: 37 | - check_bpftrace.yml 38 | - check_sasl.yml 39 | 40 | - name: Check headers for ansible_managed, fingerprint 41 | include_tasks: check_header.yml 42 | vars: 43 | __file: "{{ __bpftrace_conf }}" 44 | __fingerprint: "performancecopilot:ansible-pcp" 45 | 46 | post_tasks: 47 | - name: Restore state of services 48 | import_tasks: restore_services_state.yml 49 | -------------------------------------------------------------------------------- /.github/workflows/tox.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # yamllint disable rule:line-length 3 | name: tox 4 | on: # yamllint disable-line rule:truthy 5 | - pull_request 6 | - push 7 | env: 8 | TOX_LSR: "git+https://github.com/linux-system-roles/tox-lsr@2.13.1" 9 | LSR_ROLE2COLL_NAMESPACE: performancecopilot 10 | LSR_ROLE2COLL_NAME: metrics 11 | LSR_ANSIBLE_TEST_DOCKER: "true" 12 | LSR_ANSIBLES: 'ansible==2.9.*' 13 | LSR_MSCENARIOS: default 14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 15 | jobs: 16 | python: 17 | strategy: 18 | matrix: 19 | pyver_os: 20 | - ver: '3.8' 21 | os: ubuntu-latest 22 | - ver: '3.9' 23 | os: ubuntu-latest 24 | runs-on: ${{ matrix.pyver_os.os }} 25 | steps: 26 | - name: checkout PR 27 | uses: actions/checkout@v4 28 | - name: Set up Python 29 | uses: actions/setup-python@v5 30 | with: 31 | python-version: ${{ matrix.pyver_os.ver }} 32 | - name: Install platform dependencies, python, tox, tox-lsr 33 | run: | 34 | set -euxo pipefail 35 | python -m pip install --upgrade pip 36 | sudo apt-get update 37 | sudo apt-get install -y git 38 | pip install "$TOX_LSR" 39 | lsr_ci_preinstall 40 | - name: Run tox tests 41 | run: | 42 | set -euxo pipefail 43 | toxpyver=$(echo "${{ matrix.pyver_os.ver }}" | tr -d .) 44 | case "$toxpyver" in 45 | 38) toxenvs="ansible-plugin-scan,collection,ansible-test" ;; 46 | 39) toxenvs="shellcheck,ansible-managed-var-comment" ;; 47 | esac 48 | TOXENV="$toxenvs" lsr_ci_runtox 49 | -------------------------------------------------------------------------------- /roles/mssql/files/stolen_node_memory: -------------------------------------------------------------------------------- 1 | #pmieconf-rules 1 2 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 3 | # 4 | # Based on a rule originally developed by Jiajun Zhang at Red Hat 5 | # 6 | 7 | rule mssql.stolen_node_memory 8 | summary = "$rule$" 9 | predicate = 10 | "some_host ( 11 | ( avg_sample ( mssql.memory_manager.stolen_node_memory $hosts$ @0..9 ) ) > 0 12 | && $pct$ %_sample 13 | ( 100 * ( mssql.memory_manager.stolen_node_memory @0..9 $hosts$ / 14 | mssql.memory_manager.total_server_memory @0..9 $hosts$ ) ) 15 | > $threshold$ 16 | )" 17 | enabled = yes 18 | version = 1 19 | help = 20 | "A substantial proportion of total SQL Server memory is classified as 21 | stolen node memory which means the amount of memory used by SQL Server 22 | but not for database pages. 23 | A high amount of stolen memory indicates memory pressure - run DBCC 24 | MemoryStatus or query sys.dm_os_memory_clerks to identify the problem."; 25 | 26 | percent threshold 27 | default = 70 28 | help = 29 | "Threshold percent of total server memory which is stolen node memory, 30 | in the range 0 (none) to 100 (all server memory is stolen node memory)."; 31 | 32 | percent pct 33 | default = 60 34 | help = 35 | "Percentage of the last 10 observations with at least threshold 36 | percent of total server memory which is stolen node memory."; 37 | 38 | string rule 39 | default = "High mssql stolen node memory" 40 | modify = no 41 | display = no; 42 | 43 | string action_expand 44 | default = "%v%mem@%h" 45 | modify = no 46 | display = no; 47 | 48 | string email_expand 49 | default = "host: %h mssql stolen node memory: %v%" 50 | display = no 51 | modify = no; 52 | 53 | # 54 | # --- DO NOT MODIFY THIS FILE --- see pmieconf(5) 55 | -------------------------------------------------------------------------------- /tests/tests_verify_auth.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test authentication 4 | hosts: all 5 | vars: 6 | __test_uname: pcptest 7 | __test_pswd: t;dlen;dle 8 | 9 | # yamllint disable rule:line-length 10 | roles: 11 | - role: performancecopilot.metrics.keyserver 12 | - role: performancecopilot.metrics.pcp 13 | vars: 14 | pcp_accounts: 15 | - {user: "{{ __test_uname }}", sasluser: "{{ __test_uname }}", saslpassword: "{{ __test_pswd }}"} 16 | # yamllint enable rule:line-length 17 | 18 | pre_tasks: 19 | - name: Skip test if not supported by platform 20 | meta: end_host 21 | when: (ansible_distribution in ['RedHat', 'CentOS'] and 22 | ansible_distribution_major_version | int < 8) or 23 | ansible_distribution not in ['Fedora', 'RedHat', 'CentOS'] 24 | 25 | - name: Save state of services 26 | import_tasks: get_services_state.yml 27 | 28 | tasks: 29 | - name: Restart PMCD 30 | # noqa command-instead-of-module 31 | shell: systemctl restart pmcd && sleep 5 32 | changed_when: false 33 | 34 | - name: Check if SASL works 35 | include_tasks: "{{ item }}" 36 | loop: 37 | - check_sasl.yml 38 | 39 | - name: Check headers for ansible_managed, fingerprint 40 | include_tasks: check_header.yml 41 | vars: 42 | __fingerprint: "performancecopilot:ansible-pcp" 43 | loop: 44 | - "{{ __pcp_pmcd_defaults_path }}" 45 | - "{{ __pcp_pmcd_saslconf_path }}" 46 | - "{{ __pcp_pmlogger_defaults_path }}" 47 | - "{{ __pcp_pmlogger_timers_path }}" 48 | loop_control: 49 | loop_var: __file 50 | 51 | post_tasks: 52 | - name: Restore state of services 53 | import_tasks: restore_services_state.yml 54 | -------------------------------------------------------------------------------- /roles/pcp/templates/pmcd.defaults.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | {{ "performancecopilot:ansible-pcp" | comment(prefix="", postfix="") }} 3 | # Environment variables for the pmcd daemon. Refer also to the 4 | # pmcd.options and pmcd.conf files for additional configuration. 5 | 6 | # Behaviour regarding listening on external-facing interfaces; 7 | # unset PMCD_LOCAL to allow connections from remote hosts. 8 | # A value of 0 permits remote connections, 1 permits local only. 9 | PMCD_LOCAL={{ pcp_pmcd_localonly }} 10 | 11 | # Max length to which the queue of pending connections may grow 12 | # A value of 5 is the default. 13 | # PMCD_MAXPENDING=5 14 | 15 | # Default behaviour regarding pmcd's approach to starting PMDAs; 16 | # In cases where pmdaroot is available, setting this variable to 17 | # 1, offloads starting and stopping of agents to pmdaroot. This 18 | # allows pmcd to not require a restart when starting a new PMDA. 19 | PMCD_ROOT_AGENT=1 20 | 21 | # Default behaviour regarding pmcd's approach to re-starting any 22 | # unresponsive PMDAs; this should only be used with pmdaroot and 23 | # PMCD_ROOT_AGENT=1 as it allows pmcd to attempt to automatically 24 | # restart any exited PMDA that it detects (which usually requires 25 | # privileges not available to pmcd itself). 26 | PMCD_RESTART_AGENTS=1 27 | 28 | # Default timeout for waiting on pmcd to accept connections; any 29 | # longer than this value and the rc scripts report it as failed. 30 | # The value is a PCPIntro(1) interval in units of seconds and it 31 | # will be passed directly to the pmcd_wait(1) utility. 32 | # PMCD_WAIT_TIMEOUT=60 33 | 34 | # Mode for pmcd to initialize the NSS certificate database when using 35 | # secure connections. The default for pmcd is "readonly", as set here. 36 | # If set to "readwrite" but fails, it will fallback and attempt readonly. 37 | PCP_NSS_INIT_MODE=readonly 38 | -------------------------------------------------------------------------------- /roles/bpftrace/README.md: -------------------------------------------------------------------------------- 1 | # performancecopilot.metrics.bpftrace 2 | 3 | Installs and configures [bpftrace](https://github.com/iovisor/bpftrace) metrics from the [Performance Co-Pilot](https://pcp.io/) toolkit. 4 | 5 | ## Requirements 6 | 7 | Uses features of PCP v5.1 and later, and makes use of Cyrus SASL (Simple Authentication Security Layer) SCRAM (Salted Challenge Response Authentication) for authentication. 8 | 9 | ## Role Variables 10 | 11 | ```yaml 12 | bpftrace_metrics_provider: pcp 13 | ``` 14 | 15 | The metrics collector to use to provide metrics. 16 | 17 | This can be either set to 'none' for local bpftrace package installation only. 18 | The default value 'pcp' configures bpftrace for use with Performance Co-Pilot. 19 | 20 | ```yaml 21 | bpftrace_users: 22 | - {user: metrics} 23 | ``` 24 | 25 | Local user accounts that are allowed to load new bpftrace scripts. These accounts will be able to load eBPF code into the running kernel, which is a privileged operation. The mandatory value for the variable is an array of dictionaries containing account names under the 'user' key. Other authentication mechanisms can share these dictionaries, e.g. for remote [pmcd(1)](http://man7.org/linux/man-pages/man1/pmcd.1.html) authentication with PCP using SASL. 26 | 27 | ## Dependencies 28 | 29 | None. 30 | 31 | ## Example Playbooks 32 | 33 | Make bpftrace metrics available to PCP analysis tools, and allow the local *grafana* and *metrics* users to create new metrics from bpftrace scripts. 34 | 35 | ```yaml 36 | - hosts: monitoring 37 | roles: 38 | - role: performancecopilot.metrics.bpftrace 39 | vars: 40 | bpftrace_users: 41 | - {user: 'grafana'} 42 | - {user: 'metrics', sasluser: 'metrics', saslpassword: 'p4ssw0rd'} 43 | ``` 44 | 45 | ## License 46 | 47 | MIT 48 | 49 | ## Author Information 50 | 51 | An official role for PCP, maintained by the PCP developers 52 | -------------------------------------------------------------------------------- /roles/spark/README.md: -------------------------------------------------------------------------------- 1 | # performancecopilot.metrics.spark 2 | 3 | Installs and configures [Apache Spark](https://spark.apache.org/) metrics from the [Performance Co-Pilot](https://pcp.io/) toolkit, and optional exporting of PCP metrics to Spark. 4 | 5 | ## Requirements 6 | 7 | Uses features of PCP v5.2.1 and later. 8 | 9 | ## Role Variables 10 | 11 | ### spark_metrics_agent: true 12 | 13 | Collect metrics from a Spark executor. 14 | 15 | ### spark_metrics_agent_url: `http://localhost:4040/metrics/executors/prometheus` 16 | 17 | URL for the Prometheus (OpenMetrics) endpoint in the Spark UI. This depends on the PrometheusServlet in the Spark UI, which is enabled via configuration parameter: spark.ui.prometheus.enabled=true (the default is false). This role does not configure Spark itself, only PCP, so this must be already established before this role is used. 18 | 19 | ### spark_export_metrics: false 20 | 21 | Enable exporting of PCP metrics metadata and values to Spark via pcp2spark(1). 22 | 23 | ### spark_export_interval: 60 24 | 25 | Sets the sampling interval for exporting metric values to Spark, in seconds. 26 | 27 | ### spark_export_server: '127.0.0.1' 28 | 29 | Address on which pcp2spark(1) will listen for connections from an Apache Spark worker thread. 30 | 31 | ### spark_export_port: 44325 32 | 33 | Specify the port for pcp2spark(1) to listen on. 34 | 35 | ## Dependencies 36 | 37 | None. 38 | 39 | ## Example Playbooks 40 | 41 | Make local Spark executor metrics available to PCP analysis tools. 42 | 43 | ```yaml 44 | - hosts: monitoring 45 | roles: 46 | - role: performancecopilot.metrics.spark 47 | ``` 48 | 49 | Setup export of PCP metrics to a Spark worker thread. 50 | 51 | ```yaml 52 | - hosts: monitoring 53 | roles: 54 | - role: performancecopilot.metrics.spark 55 | vars: 56 | spark_export_port: 44388 57 | ``` 58 | 59 | ## License 60 | 61 | MIT 62 | 63 | ## Author Information 64 | 65 | An official role for PCP, maintained by the PCP developers 66 | -------------------------------------------------------------------------------- /tests/tests_verify_mssql.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test installation and configuration of MSSQL agent 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.keyserver 8 | - role: performancecopilot.metrics.mssql 9 | - role: performancecopilot.metrics.pcp 10 | vars: 11 | pcp_optional_agents: ['mssql'] 12 | 13 | pre_tasks: 14 | - name: Skip test if not supported by platform 15 | meta: end_host 16 | when: (ansible_distribution in ['RedHat'] and 17 | (ansible_facts['distribution_version'] is version('8.4', '<'))) or 18 | ansible_distribution not in ['Fedora', 'RedHat'] or 19 | ansible_architecture not in ['x86_64'] 20 | 21 | - name: Save state of services 22 | import_tasks: get_services_state.yml 23 | 24 | - name: Determine if system is ostree and set flag 25 | when: not __ansible_pcp_is_ostree is defined 26 | block: 27 | - name: Check if system is ostree 28 | stat: 29 | path: /run/ostree-booted 30 | register: __ostree_booted_stat 31 | 32 | - name: Set flag to indicate system is ostree 33 | set_fact: 34 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 35 | 36 | - name: Ensure python3-pyodbc is installed 37 | package: 38 | name: python3-pyodbc 39 | state: present 40 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 41 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 42 | 43 | tasks: 44 | - name: Check MSSQL functionality 45 | include_tasks: "{{ item }}" 46 | loop: 47 | - check_mssql.yml 48 | 49 | - name: Check headers for ansible_managed, fingerprint 50 | include_tasks: check_header.yml 51 | vars: 52 | __fingerprint: "performancecopilot:ansible-pcp" 53 | __file: "{{ __mssql_conf }}" 54 | 55 | post_tasks: 56 | - name: Restore state of services 57 | import_tasks: restore_services_state.yml 58 | -------------------------------------------------------------------------------- /roles/mssql/README.md: -------------------------------------------------------------------------------- 1 | # performancecopilot.metrics.mssql 2 | 3 | Installs and configures Microsoft [SQL Server](https://docs.microsoft.com/en-us/sql/) metrics from the [Performance Co-Pilot](https://pcp.io/) toolkit. 4 | 5 | ## Requirements 6 | 7 | Requires a SQL Server 2017 (or later) database server, and Python ODBC software [pyodbc](https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/). This role does *not* install or configure those components, rather it configures PCP to extract metrics from SQL Server using them. 8 | 9 | The SQL Server metrics are available from PCP v5.2 and later. 10 | 11 | ## Role Variables 12 | 13 | ### mssql_agent_trusted: true 14 | 15 | Connect to SQL Server using [Windows Authentication mode](https://docs.microsoft.com/en-us/sql/relational-databases/security/choose-an-authentication-mode?view=sql-server-ver15#connecting-through-windows-authentication) 16 | 17 | ### mssql_agent_username: sa 18 | 19 | Connect to SQL server using [SQL Server Authentication mode](https://docs.microsoft.com/en-us/sql/relational-databases/security/choose-an-authentication-mode?view=sql-server-ver15#connecting-through-sql-server-authentication). This is mutually exclusive with the mssql_agent_trusted authentication mode. 20 | 21 | ### mssql_agent_password: admin 22 | 23 | Sets the pass phrase associated with mssql_agent_username, for use when connecting with SQL Server Authentication mode (only). 24 | 25 | ### mssql_agent_timeout: 2 26 | 27 | Close the connection to SQL Server if a response is not received within this number of seconds. Subsequent requests will result in attempts to reestablish a connection. 28 | 29 | ## Dependencies 30 | 31 | None. 32 | 33 | ## Example Playbooks 34 | 35 | Setup PCP SQL Server metrics using Windows Authentication mode. 36 | 37 | ```yaml 38 | - hosts: monitoring 39 | roles: 40 | - role: performancecopilot.metrics.mssql 41 | vars: 42 | mssql_agent_timeout: 5 43 | ``` 44 | 45 | Setup PCP SQL Server metrics using SQL Server Authentication. 46 | 47 | ```yaml 48 | - hosts: monitoring 49 | roles: 50 | - role: performancecopilot.metrics.mssql 51 | vars: 52 | mssql_agent_trusted: false 53 | mssql_agent_username: sa 54 | mssql_agent_password: admin 55 | ``` 56 | 57 | ## License 58 | 59 | MIT 60 | 61 | ## Author Information 62 | 63 | An official role for PCP, maintained by the PCP developers 64 | -------------------------------------------------------------------------------- /roles/elasticsearch/README.md: -------------------------------------------------------------------------------- 1 | # performancecopilot.metrics.elasticsearch 2 | 3 | Installs and configures [Elasticsearch](https://www.elastic.co/elasticsearch) metrics from the [Performance Co-Pilot](https://pcp.io/) toolkit, and optional exporting of PCP metrics to Elasticsearch. 4 | 5 | ## Requirements 6 | 7 | Uses features of PCP v5.2.1 and later. 8 | 9 | ## Role Variables 10 | 11 | ### elasticsearch_agent: true 12 | 13 | Collect metrics from the local Elasticsearch server. 14 | 15 | ### elasticsearch_agent_port: 9200 16 | 17 | Connect on given socket port for Elasticsearch metric collection. 18 | 19 | ### elasticsearch_agent_authname: '' 20 | 21 | Sets the HTTP request username for Elasticsearch metric collection. 22 | 23 | ### elasticsearch_agent_password: '' 24 | 25 | Sets the HTTP request password for Elasticsearch metric collection. 26 | 27 | ### elasticsearch_export_metrics: false 28 | 29 | Enable exporting of PCP metrics metadata and values to Elasticsearch. 30 | 31 | ### elasticsearch_export_interval: 60 32 | 33 | Sets the sampling interval for exporting metric values to Elasticsearch, in seconds. 34 | 35 | ### elasticsearch_export_server: `http://localhost:9200` 36 | 37 | Elasticsearch server URL for PCP metric metadata and value exporting. 38 | 39 | ### elasticsearch_export_index: pcp 40 | 41 | Elasticsearch index to use for PCP metric names. 42 | 43 | ### elasticsearch_export_hostid: [] 44 | 45 | Specify the Elasticsearch host-id for measurements, default is the PCP metrics source hostname. 46 | 47 | ### elasticsearch_export_type: pcp-metric 48 | 49 | Specify the Elasticsearch search type for measurements. 50 | 51 | ## Dependencies 52 | 53 | None. 54 | 55 | ## Example Playbooks 56 | 57 | Make local Elasticsearch metrics available to PCP analysis tools. 58 | 59 | ```yaml 60 | - hosts: monitoring 61 | roles: 62 | - role: performancecopilot.metrics.elasticsearch 63 | vars: 64 | elasticsearch_agent_port: 9200 65 | ``` 66 | 67 | Setup export of PCP metrics to a remote Elasticsearch server. 68 | 69 | ```yaml 70 | - hosts: monitoring 71 | roles: 72 | - role: performancecopilot.metrics.elasticsearch 73 | vars: 74 | elasticsearch_export_server: 'http://elastic.example.com:9200' 75 | elasticsearch_export_authname: metrics 76 | elasticsearch_export_password: 'xxxxxxx' 77 | ``` 78 | 79 | ## License 80 | 81 | MIT 82 | 83 | ## Author Information 84 | 85 | An official role for PCP, maintained by the PCP developers 86 | -------------------------------------------------------------------------------- /roles/pcp/tasks/pmlogger.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | - name: Ensure metric log location is configured 5 | lineinfile: 6 | path: "{{ __pcp_conf }}" 7 | regexp: '^PCP_ARCHIVE_DIR=' 8 | line: PCP_ARCHIVE_DIR={{ pcp_archive_dir }} 9 | register: __pcp_register_changed_log_location 10 | notify: Restart pmproxy 11 | 12 | - name: Ensure performance metric logging is configured 13 | template: 14 | src: pmlogger.defaults.j2 15 | dest: "{{ __pcp_pmlogger_defaults_path }}" 16 | mode: "0644" 17 | register: __pcp_register_changed_config_pmlogger 18 | 19 | - name: Ensure performance metric logging retention period is set 20 | template: 21 | src: pmlogger.timers.j2 22 | dest: "{{ __pcp_pmlogger_timers_path }}" 23 | mode: "0644" 24 | register: __pcp_register_changed_logging_retention_period 25 | notify: Restart pmlogger 26 | 27 | - name: Enable performance metric logging for targeted hosts (with control.d) 28 | template: 29 | src: pmlogger.controld.j2 30 | dest: "{{ __pcp_pmlogger_control_d_path }}/{{ item }}" 31 | mode: "0644" 32 | loop: "{{ pcp_target_hosts | default([]) }}" 33 | register: __pcp_register_changed_targeted_hosts_controld 34 | notify: Restart pmlogger 35 | when: 36 | - not pcp_single_control | d(false) | bool 37 | - pcp_target_hosts | d([]) | length > 0 38 | 39 | - name: Enable performance metric logging for targeted hosts (single control) 40 | template: 41 | src: pmlogger.control.j2 42 | dest: "{{ __pcp_pmlogger_control_path }}" 43 | mode: "0644" 44 | register: __pcp_register_changed_targeted_hosts_single 45 | when: 46 | - pcp_single_control | d(true) | bool 47 | - pcp_target_hosts | d([]) | length > 0 48 | 49 | - name: Set variable to do pmlogger restart if needed 50 | set_fact: 51 | __pcp_restart_pmlogger: "{{ 52 | __pcp_register_changed_log_location is changed or 53 | __pcp_register_changed_config_pmlogger is changed or 54 | __pcp_register_changed_logging_retention_period is changed or 55 | __pcp_register_changed_targeted_hosts_controld is changed or 56 | __pcp_register_changed_targeted_hosts_single is changed }}" 57 | 58 | - name: Ensure performance metric logging is running and enabled on boot 59 | service: 60 | name: pmlogger 61 | state: "{{ 'started' if __pcp_is_booted else omit }}" 62 | enabled: true 63 | when: not __pcp_restart_pmlogger | bool 64 | 65 | - name: Ensure performance metric logging is restarted and enabled on boot 66 | service: 67 | name: pmlogger 68 | state: "{{ 'restarted' if __pcp_is_booted else omit }}" 69 | enabled: true 70 | when: __pcp_restart_pmlogger | bool 71 | -------------------------------------------------------------------------------- /roles/bpftrace/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Set platform/version specific variables 5 | include_vars: "{{ item }}" 6 | loop: 7 | - "{{ role_path }}/vars/default.yml" 8 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml" 9 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml" 10 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" 11 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml" 12 | when: item is file 13 | # yamllint enable rule:line-length 14 | 15 | - name: Determine if system is ostree and set flag 16 | when: not __ansible_pcp_is_ostree is defined 17 | block: 18 | - name: Check if system is ostree 19 | stat: 20 | path: /run/ostree-booted 21 | register: __ostree_booted_stat 22 | 23 | - name: Set flag to indicate system is ostree 24 | set_fact: 25 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 26 | 27 | - name: Establish bpftrace package names 28 | set_fact: 29 | __bpftrace_packages_extra: "{{ __bpftrace_packages + 30 | __bpftrace_packages_extra }}" 31 | when: 32 | - bpftrace_metrics_provider == 'pcp' 33 | - __bpftrace_packages_pcp | d([]) | length > 0 34 | 35 | - name: Establish bpftrace metrics package names 36 | set_fact: 37 | __bpftrace_packages_extra: "{{ __bpftrace_packages_pcp + 38 | __bpftrace_packages_extra }}" 39 | when: 40 | - bpftrace_metrics_provider == 'pcp' 41 | - __bpftrace_packages_pcp | d([]) | length > 0 42 | 43 | - name: Install needed bpftrace metrics packages 44 | package: 45 | name: "{{ __bpftrace_packages_extra }}" 46 | state: present 47 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 48 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 49 | when: __bpftrace_packages_extra | d([]) | length > 0 50 | 51 | - name: Extract allowed bpftrace user accounts 52 | set_fact: 53 | __bpftrace_usernames: "{{ __bpftrace_usernames }},{{ item.user }}" 54 | when: item.user is defined 55 | with_items: "{{ bpftrace_users }}" 56 | 57 | - name: Ensure PCP bpftrace configuration directory exists 58 | file: 59 | path: "{{ __bpftrace_conf_dir }}" 60 | state: directory 61 | mode: "0755" 62 | when: bpftrace_metrics_provider == 'pcp' 63 | 64 | - name: Ensure PCP bpftrace agent is configured 65 | template: 66 | src: bpftrace.conf.j2 67 | dest: "{{ __bpftrace_conf }}" 68 | mode: "0600" 69 | follow: true 70 | when: bpftrace_metrics_provider == 'pcp' 71 | -------------------------------------------------------------------------------- /roles/pcp/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Set platform/version specific variables 5 | include_vars: "{{ item }}" 6 | loop: 7 | - "{{ role_path }}/vars/default.yml" 8 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml" 9 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml" 10 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" 11 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml" 12 | when: item is file 13 | # yamllint enable rule:line-length 14 | 15 | - name: Determine if system is ostree and set flag 16 | when: not __ansible_pcp_is_ostree is defined 17 | block: 18 | - name: Check if system is ostree 19 | stat: 20 | path: /run/ostree-booted 21 | register: __ostree_booted_stat 22 | 23 | - name: Set flag to indicate system is ostree 24 | set_fact: 25 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 26 | 27 | - name: Determine if host is booted 28 | when: __pcp_is_booted is not defined 29 | block: 30 | - name: Run systemctl 31 | # noqa command-instead-of-module 32 | command: systemctl is-system-running 33 | register: __is_system_running 34 | changed_when: false 35 | check_mode: false 36 | failed_when: false 37 | 38 | - name: Require installed systemd 39 | fail: 40 | msg: "Error: This role requires systemd to be installed." 41 | when: '"No such file or directory" in __is_system_running.msg | d("")' 42 | 43 | - name: Set flag to indicate that systemd runtime operations are available 44 | set_fact: 45 | __pcp_is_booted: "{{ __is_system_running.stdout != 'offline' }}" 46 | 47 | - name: Install Performance Co-Pilot packages 48 | package: 49 | name: "{{ __pcp_packages + __pcp_packages_extra + pcp_optional_packages }}" 50 | state: present 51 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 52 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 53 | 54 | - name: Install authentication packages 55 | package: 56 | name: "{{ __pcp_sasl_packages }}" 57 | state: present 58 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 59 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 60 | when: 61 | - __pcp_sasl_packages | d([]) | length > 0 62 | - pcp_accounts | d([]) | length > 0 63 | 64 | - name: Include pmcd 65 | include_tasks: pmcd.yml 66 | 67 | - name: Include pmie 68 | include_tasks: pmie.yml 69 | 70 | - name: Include pmlogger 71 | include_tasks: pmlogger.yml 72 | 73 | - name: Include pmproxy 74 | include_tasks: pmproxy.yml 75 | when: pcp_rest_api | d(false) | bool 76 | -------------------------------------------------------------------------------- /roles/mssql/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Set platform/version specific variables 5 | include_vars: "{{ item }}" 6 | loop: 7 | - "{{ role_path }}/vars/default.yml" 8 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml" 9 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml" 10 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" 11 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml" 12 | when: item is file 13 | # yamllint enable rule:line-length 14 | 15 | - name: Determine if system is ostree and set flag 16 | when: not __ansible_pcp_is_ostree is defined 17 | block: 18 | - name: Check if system is ostree 19 | stat: 20 | path: /run/ostree-booted 21 | register: __ostree_booted_stat 22 | 23 | - name: Set flag to indicate system is ostree 24 | set_fact: 25 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 26 | 27 | - name: Establish SQL Server metrics package names 28 | set_fact: 29 | __mssql_packages_extra: "{{ __mssql_packages_pcp }}" 30 | when: mssql_metrics_provider == 'pcp' 31 | 32 | - name: Install needed SQL Server metrics packages 33 | package: 34 | name: "{{ __mssql_packages_extra }}" 35 | state: present 36 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 37 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 38 | when: __mssql_packages_extra | d([]) | length > 0 39 | 40 | - name: Ensure PCP SQL Server agent configuration directory exists 41 | file: 42 | path: "{{ __mssql_conf_dir }}" 43 | state: directory 44 | mode: "0755" 45 | when: mssql_metrics_provider == 'pcp' 46 | 47 | - name: Ensure PCP SQL Server agent is configured 48 | template: 49 | src: mssql.conf.j2 50 | dest: "{{ __mssql_conf }}" 51 | follow: true 52 | mode: "0600" 53 | when: mssql_metrics_provider == 'pcp' 54 | 55 | - name: Ensure SQL Server performance rule group directory exists 56 | file: 57 | path: "{{ __mssql_pmieconf_path }}" 58 | state: directory 59 | owner: root 60 | group: root 61 | mode: "0755" 62 | when: mssql_metrics_provider == 'pcp' 63 | 64 | - name: Ensure SQL Server performance rule group link directory exists 65 | file: 66 | path: "{{ __mssql_pmieconf_link_path }}" 67 | state: directory 68 | owner: root 69 | group: root 70 | mode: "0755" 71 | when: mssql_metrics_provider == 'pcp' 72 | 73 | - name: Ensure SQL Server performance rules are installed for targeted hosts 74 | copy: 75 | src: "files/{{ item }}" 76 | dest: "{{ __mssql_pmieconf_path }}/{{ item }}" 77 | owner: root 78 | group: root 79 | mode: "0644" 80 | loop: "{{ __mssql_pmieconf_rules | default([]) }}" 81 | when: mssql_metrics_provider == 'pcp' 82 | 83 | - name: Ensure SQL Server rules symlinks have been created for targeted hosts 84 | file: 85 | src: "{{ __mssql_pmieconf_path }}/{{ item }}" 86 | dest: "{{ __mssql_pmieconf_link_path }}/{{ item }}" 87 | state: link 88 | force: true 89 | loop: "{{ __mssql_pmieconf_rules | default([]) }}" 90 | when: mssql_metrics_provider == 'pcp' 91 | -------------------------------------------------------------------------------- /tests/tests_verify_fullstack.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | - name: Test the full PCP/Grafana stack 4 | hosts: all 5 | 6 | roles: 7 | - role: performancecopilot.metrics.pcp 8 | vars: 9 | pcp_rest_api: true 10 | pcp_pmproxy_localonly: 1 11 | - role: performancecopilot.metrics.keyserver 12 | - role: performancecopilot.metrics.grafana 13 | 14 | pre_tasks: 15 | - name: Skip test if not supported by platform 16 | meta: end_host 17 | when: (ansible_distribution in ['RedHat', 'CentOS'] and 18 | ansible_distribution_major_version | int < 8) or 19 | ansible_distribution not in ['Fedora', 'RedHat', 'CentOS'] 20 | 21 | - name: Save state of services 22 | import_tasks: get_services_state.yml 23 | 24 | tasks: 25 | - name: Check if all services work 26 | include_tasks: "{{ item }}" 27 | loop: 28 | - check_pcp.yml 29 | - check_pmlogger.yml 30 | - check_pmie.yml 31 | - check_keyserver.yml 32 | - check_pmproxy.yml 33 | - check_grafana.yml 34 | - check_grafana_pcp.yml 35 | 36 | - name: Check pmie config files 37 | # noqa no-handler 38 | when: __pcp_register_changed_target_hosts_controld is changed 39 | block: 40 | - name: Find pmie config files 41 | find: 42 | paths: 43 | - "{{ __pcp_pmie_control_d_path }}" 44 | register: __check_pmie_control_d 45 | 46 | - name: Check pmie.d headers for ansible_managed, fingerprint 47 | include_tasks: check_header.yml 48 | vars: 49 | __fingerprint: "performancecopilot:ansible-pcp" 50 | loop: "{{ __check_pmie_control_d.files | map(attribute='path') }}" 51 | loop_control: 52 | loop_var: __file 53 | 54 | - name: Check pmlogger config files 55 | # noqa no-handler 56 | when: __pcp_register_changed_targeted_hosts_controld is changed 57 | block: 58 | - name: Find pmlogger config files 59 | find: 60 | paths: 61 | - "{{ __pcp_pmlogger_control_d_path }}" 62 | register: __check_pmlogger_control_d 63 | 64 | - name: Check pmlogger.d headers for ansible_managed, fingerprint 65 | include_tasks: check_header.yml 66 | vars: 67 | __fingerprint: "performancecopilot:ansible-pcp" 68 | loop: "{{ __check_pmlogger_control_d.files | map(attribute='path') }}" 69 | loop_control: 70 | loop_var: __file 71 | 72 | - name: Check pmproxy headers for ansible_managed, fingerprint 73 | include_tasks: check_header.yml 74 | vars: 75 | __fingerprint: "performancecopilot:ansible-pcp" 76 | __file: "{{ __pcp_pmproxy_defaults_path }}" 77 | 78 | - name: Check pmie headers for ansible_managed, fingerprint 79 | include_tasks: check_header.yml 80 | vars: 81 | __fingerprint: "performancecopilot:ansible-pcp" 82 | __file: "{{ __pcp_pmie_control_path }}" 83 | # noqa no-handler 84 | when: __pcp_register_changed_target_hosts_single is changed 85 | 86 | - name: Check pmlogger headers for ansible_managed, fingerprint 87 | include_tasks: check_header.yml 88 | vars: 89 | __fingerprint: "performancecopilot:ansible-pcp" 90 | __file: "{{ __pcp_pmlogger_control_path }}" 91 | # noqa no-handler 92 | when: __pcp_register_changed_targeted_hosts_single is changed 93 | 94 | post_tasks: 95 | - name: Restore state of services 96 | import_tasks: restore_services_state.yml 97 | -------------------------------------------------------------------------------- /roles/keyserver/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Set platform/version specific variables 5 | include_vars: "{{ item }}" 6 | loop: 7 | - "{{ role_path }}/vars/default.yml" 8 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml" 9 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}_{{ ansible_facts['architecture'] }}.yml" 10 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml" 11 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['architecture'] }}.yml" 12 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" 13 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}_{{ ansible_facts['architecture'] }}.yml" 14 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml" 15 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}_{{ ansible_facts['architecture'] }}.yml" 16 | when: item is file 17 | # yamllint enable rule:line-length 18 | 19 | - name: Determine if system is ostree and set flag 20 | when: not __ansible_pcp_is_ostree is defined 21 | block: 22 | - name: Check if system is ostree 23 | stat: 24 | path: /run/ostree-booted 25 | register: __ostree_booted_stat 26 | 27 | - name: Set flag to indicate system is ostree 28 | set_fact: 29 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 30 | 31 | - name: Determine if host is booted 32 | # noqa command-instead-of-module 33 | command: systemctl is-system-running 34 | register: __is_system_running 35 | changed_when: false 36 | check_mode: false 37 | failed_when: false 38 | 39 | - name: Require installed systemd 40 | fail: 41 | msg: "Error: This role requires systemd to be installed." 42 | when: '"No such file or directory" in __is_system_running.msg | d("")' 43 | 44 | - name: Set flag to indicate that systemd runtime operations are available 45 | set_fact: 46 | __keyserver_is_booted: "{{ __is_system_running.stdout != 'offline' }}" 47 | 48 | - name: Install key server packages 49 | package: 50 | name: "{{ __keyserver_packages + __keyserver_packages_extra }}" 51 | state: present 52 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 53 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 54 | 55 | - name: Ensure key server configuration directory exists 56 | file: 57 | path: "{{ __keyserver_conf_path }}" 58 | state: directory 59 | owner: "{{ __keyserver_name }}" 60 | group: root 61 | mode: "0750" 62 | 63 | # yamllint disable rule:line-length 64 | - name: Ensure key server is configured 65 | template: 66 | src: "{{ item }}" 67 | dest: "{{ __keyserver_conf_path }}/{{ __keyserver_conf_file }}" 68 | mode: "0640" 69 | owner: "{{ __keyserver_name }}" 70 | group: root 71 | with_first_found: 72 | - "{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}_keyserver.conf.j2" 73 | - "{{ ansible_facts['distribution'] }}_keyserver.conf.j2" 74 | - "{{ __keyserver_name }}.conf.j2" 75 | notify: Restart key server 76 | # yamllint enable rule:line-length 77 | 78 | - name: Ensure key server configuration symlink exists 79 | file: 80 | src: "{{ __keyserver_conf_path }}/{{ __keyserver_conf_file }}" 81 | dest: "{{ __keyserver_conf_link }}/{{ __keyserver_conf_file }}" 82 | state: link 83 | force: true 84 | 85 | - name: Ensure key server service is running and enabled on boot 86 | service: 87 | name: "{{ __keyserver_name }}" 88 | state: "{{ 'started' if __keyserver_is_booted else omit }}" 89 | enabled: true 90 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ansible Collection - performancecopilot.metrics 2 | 3 | ![CI Testing](https://github.com/performancecopilot/ansible-pcp/workflows/tox/badge.svg) 4 | [![Mailing List](https://img.shields.io/badge/Mailing%20List-pcp-blue.svg)](https://groups.io/g/pcp) 5 | [![Slack Team](https://img.shields.io/badge/Slack-pcp-blue.svg)](https://h7zo83mvt1.execute-api.us-west-2.amazonaws.com/Express/) 6 | [![IRC #pcp](https://img.shields.io/badge/IRC-pcp-blue.svg)](https://web.libera.chat/#pcp) 7 | [![Github Release](https://img.shields.io/github/release/performancecopilot/ansible-pcp.svg)](https://github.com/performancecopilot/ansible-pcp/releases/latest) 8 | 9 | A collection containing roles for Performance Co-Pilot (PCP) 10 | and related software, such as Valkey/Redis and Grafana. 11 | 12 | The collection is arranged as follows: 13 | 14 | - performancecopilot.metrics.pcp 15 | 16 | A role for core PCP capabilities, configuring live performance 17 | analysis with a large base set of metrics from the kernel and 18 | system services, as well as data recording and rule inference. 19 | 20 | - performancecopilot.metrics.grafana 21 | 22 | A role for configuring a local Grafana server, providing web 23 | frontend visuals for Performance Co-Pilot metrics, both live 24 | and historically. 25 | Data sources for Vector (live), Valkey/Redis (historical) and 26 | interactive bpftrace (eBPF) scripts can be configured by this 27 | role. The PCP REST API service (from the core PCP role) must 28 | be configured in order to use this role. 29 | 30 | - performancecopilot.metrics.keyserver 31 | 32 | A role for configuring a local key server (Valkey/Redis) that 33 | is suitable for use with a Performance Co-Pilot installation 34 | (for single or many hosts) with fast, scalable metric queries. 35 | 36 | - performancecopilot.metrics.repository 37 | 38 | A role configuring an additional PCP packaging repository - 39 | for installation of the latest (upstream) releases of the PCP 40 | packages from the Performance Co-Pilot development community. 41 | 42 | - performancecopilot.metrics.bpftrace 43 | 44 | A role that extends the core PCP role, providing metrics from 45 | bpftrace scripts (using the Linux kernel eBPF facilities). 46 | Configuring authentication of a local user capable of running 47 | bpftrace scripts via the PCP agent is a key task of this role. 48 | 49 | - performancecopilot.metrics.elasticsearch 50 | 51 | A role that extends the core PCP role, providing metrics from 52 | a live ElasticSearch instance for PCP analysis - or exporting 53 | of PCP metric values (and meta-data) to ElasticSearch for the 54 | indexing and querying of performance data. 55 | 56 | - performancecopilot.metrics.mssql 57 | 58 | A role that extends the core PCP role, providing metrics from 59 | a SQL Server database. Configuring authentication of the PCP 60 | mssql metric agent is a key task of this role. 61 | 62 | - performancecopilot.metrics.postfix 63 | 64 | A role that extends the core PCP role, providing metrics from 65 | a Postfix mail server. 66 | 67 | - performancecopilot.metrics.spark 68 | 69 | A role that extends the core PCP role, exporting metrics from 70 | PCP into Apache Spark for further analysis. 71 | 72 | 73 | ## Instructions for creating an ansible-pcp release: 74 | 75 | ### On GitHub 76 | 77 | 1. Pull down the performancecopilot org upstream ansible-pcp repo 78 | 2. Bump the version to X.Y.Z in `galaxy.yml` 79 | 3. `git add galaxy.yml` 80 | 4. `git commit -m "Bump version to X.Y.Z ..."` 81 | 5. `git tag -m vX.Y.Z vX.Y.Z` 82 | 6. `git push && git push --tags` 83 | 7. Navigate to the github web interface 84 | 8. Create a new release for the tag vX.Y.Z and set the title to X.Y.Z 85 | 86 | ### Ansible Galaxy 87 | 88 | Still in the performancecopilot ansible-pcp repo: 89 | 90 | 1. Remove the old `*.tar.gz` file if present 91 | 2. `ansible-galaxy collection build` 92 | 3. Navigate to https://galaxy.ansible.com/ui/namespaces/performancecopilot/ 93 | 4. Click "upload collection" and upload the `tar.gz` file just created with the `ansible-galaxy collection build` command 94 | 95 | -------------------------------------------------------------------------------- /.commitlintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parserPreset: 'conventional-changelog-conventionalcommits', 3 | rules: { 4 | 'body-leading-blank': [1, 'always'], 5 | 'body-max-line-length': [2, 'always', 100], 6 | 'footer-leading-blank': [1, 'always'], 7 | 'footer-max-line-length': [2, 'always', 100], 8 | 'header-max-length': [2, 'always', 100], 9 | 'subject-case': [ 10 | 2, 11 | 'never', 12 | ['start-case', 'pascal-case', 'upper-case'], 13 | ], 14 | 'subject-empty': [2, 'never'], 15 | 'subject-full-stop': [2, 'never', '.'], 16 | 'type-case': [2, 'always', 'lower-case'], 17 | 'type-empty': [2, 'never'], 18 | 'type-enum': [ 19 | 2, 20 | 'always', 21 | [ 22 | 'build', 23 | 'chore', 24 | 'ci', 25 | 'docs', 26 | 'feat', 27 | 'fix', 28 | 'perf', 29 | 'refactor', 30 | 'revert', 31 | 'style', 32 | 'test', 33 | 'tests', 34 | ], 35 | ], 36 | }, 37 | prompt: { 38 | questions: { 39 | type: { 40 | description: "Select the type of change that you're committing", 41 | enum: { 42 | feat: { 43 | description: 'A new feature', 44 | title: 'Features', 45 | emoji: '✨', 46 | }, 47 | fix: { 48 | description: 'A bug fix', 49 | title: 'Bug Fixes', 50 | emoji: '🐛', 51 | }, 52 | docs: { 53 | description: 'Documentation only changes', 54 | title: 'Documentation', 55 | emoji: '📚', 56 | }, 57 | style: { 58 | description: 59 | 'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)', 60 | title: 'Styles', 61 | emoji: '💎', 62 | }, 63 | refactor: { 64 | description: 65 | 'A code change that neither fixes a bug nor adds a feature', 66 | title: 'Code Refactoring', 67 | emoji: '📦', 68 | }, 69 | perf: { 70 | description: 'A code change that improves performance', 71 | title: 'Performance Improvements', 72 | emoji: '🚀', 73 | }, 74 | test: { 75 | description: 'Adding missing tests or correcting existing tests', 76 | title: 'Tests', 77 | emoji: '🚨', 78 | }, 79 | tests: { 80 | description: 'Adding missing tests or correcting existing tests', 81 | title: 'Tests', 82 | emoji: '🚨', 83 | }, 84 | build: { 85 | description: 86 | 'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)', 87 | title: 'Builds', 88 | emoji: '🛠', 89 | }, 90 | ci: { 91 | description: 92 | 'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)', 93 | title: 'Continuous Integrations', 94 | emoji: '⚙️', 95 | }, 96 | chore: { 97 | description: "Other changes that don't modify src or test files", 98 | title: 'Chores', 99 | emoji: '♻️', 100 | }, 101 | revert: { 102 | description: 'Reverts a previous commit', 103 | title: 'Reverts', 104 | emoji: '🗑', 105 | }, 106 | }, 107 | }, 108 | scope: { 109 | description: 110 | 'What is the scope of this change (e.g. component or file name)', 111 | }, 112 | subject: { 113 | description: 114 | 'Write a short, imperative tense description of the change', 115 | }, 116 | body: { 117 | description: 'Provide a longer description of the change', 118 | }, 119 | isBreaking: { 120 | description: 'Are there any breaking changes?', 121 | }, 122 | breakingBody: { 123 | description: 124 | 'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself', 125 | }, 126 | breaking: { 127 | description: 'Describe the breaking changes', 128 | }, 129 | isIssueAffected: { 130 | description: 'Does this change affect any open issues?', 131 | }, 132 | issuesBody: { 133 | description: 134 | 'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself', 135 | }, 136 | issues: { 137 | description: 'Add issue references (e.g. "fix #123", "re #123".)', 138 | }, 139 | }, 140 | }, 141 | }; 142 | -------------------------------------------------------------------------------- /roles/spark/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Set platform/version specific variables 5 | include_vars: "{{ item }}" 6 | loop: 7 | - "{{ role_path }}/vars/default.yml" 8 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml" 9 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml" 10 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" 11 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml" 12 | when: item is file 13 | # yamllint enable rule:line-length 14 | 15 | - name: Determine if system is ostree and set flag 16 | when: not __ansible_pcp_is_ostree is defined 17 | block: 18 | - name: Check if system is ostree 19 | stat: 20 | path: /run/ostree-booted 21 | register: __ostree_booted_stat 22 | 23 | - name: Set flag to indicate system is ostree 24 | set_fact: 25 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 26 | 27 | - name: Establish Spark metrics package names 28 | set_fact: 29 | __spark_packages_extra: "{{ __spark_packages_extra + 30 | __spark_packages_pcp }}" 31 | when: 32 | - spark_metrics_provider == 'pcp' 33 | - spark_metrics_agent | d(false) | bool 34 | 35 | - name: Establish Spark metrics export package names 36 | set_fact: 37 | __spark_packages_extra: "{{ __spark_packages_extra + 38 | __spark_packages_export_pcp }}" 39 | when: 40 | - spark_metrics_provider == 'pcp' 41 | - spark_export_metrics | bool 42 | 43 | - name: Install needed Spark metrics packages 44 | package: 45 | name: "{{ __spark_packages_extra }}" 46 | state: present 47 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 48 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 49 | when: __spark_packages_extra | d([]) | length > 0 50 | 51 | - name: Ensure PCP OpenMetrics agent is configured for Spark 52 | template: 53 | src: spark.url.j2 54 | dest: "{{ __spark_metrics_conf }}" 55 | mode: "0644" 56 | when: 57 | - spark_metrics_provider == 'pcp' 58 | - spark_metrics_agent | d(false) | bool 59 | - "'pcp-pmda-openmetrics' in __spark_packages_pcp" 60 | 61 | - name: Ensure PCP OpenMetrics agent is enabled with Spark endpoint 62 | file: 63 | src: "{{ __spark_metrics_conf }}" 64 | dest: "{{ __spark_metrics_symlink }}" 65 | state: link 66 | when: 67 | - spark_metrics_provider == 'pcp' 68 | - spark_metrics_agent | d(false) | bool 69 | - "'pcp-pmda-openmetrics' in __spark_packages_pcp" 70 | 71 | - name: Ensure correct service path for ostree systems 72 | when: 73 | - __ansible_pcp_is_ostree | d(false) 74 | - __spark_service_path != "/etc/systemd/system" 75 | set_fact: 76 | __spark_service_path: /etc/systemd/system 77 | 78 | - name: Ensure PCP Spark export service exists 79 | template: 80 | src: pcp2spark.service.j2 81 | dest: "{{ __spark_service_path }}/pcp2spark.service" 82 | mode: "0600" 83 | when: 84 | - spark_metrics_provider == 'pcp' 85 | - spark_export_metrics | d(false) | bool 86 | 87 | - name: Determine if host is booted 88 | # noqa command-instead-of-module 89 | command: systemctl is-system-running 90 | register: __system_running 91 | changed_when: false 92 | check_mode: false 93 | failed_when: false 94 | 95 | - name: Require installed systemd 96 | fail: 97 | msg: "Error: This role requires systemd to be installed." 98 | when: '"No such file or directory" in __system_running.msg | d("")' 99 | 100 | - name: Ensure PCP Spark export is running and enabled on boot 101 | service: 102 | name: pcp2spark 103 | state: "{{ 'started' if __system_running.stdout != 'offline' else omit }}" 104 | enabled: true 105 | # A given Spark server may be running remotely or presently down 106 | # but since a playbook has explicitly asked us for it, we end up 107 | # having to install our service ignoring any errors. 108 | ignore_errors: true # noqa ignore-errors 109 | when: 110 | - spark_metrics_provider == 'pcp' 111 | - spark_export_metrics | d(false) | bool 112 | -------------------------------------------------------------------------------- /roles/grafana/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Set platform/version specific variables 5 | include_vars: "{{ item }}" 6 | loop: 7 | - "{{ role_path }}/vars/default.yml" 8 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml" 9 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml" 10 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" 11 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml" 12 | when: item is file 13 | # yamllint enable rule:line-length 14 | 15 | - name: Determine if system is ostree and set flag 16 | when: not __ansible_pcp_is_ostree is defined 17 | block: 18 | - name: Check if system is ostree 19 | stat: 20 | path: /run/ostree-booted 21 | register: __ostree_booted_stat 22 | 23 | - name: Set flag to indicate system is ostree 24 | set_fact: 25 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 26 | 27 | - name: Determine if host is booted 28 | # noqa command-instead-of-module 29 | command: systemctl is-system-running 30 | register: __is_system_running 31 | changed_when: false 32 | check_mode: false 33 | failed_when: false 34 | 35 | - name: Require installed systemd 36 | fail: 37 | msg: "Error: This role requires systemd to be installed." 38 | when: '"No such file or directory" in __is_system_running.msg | d("")' 39 | 40 | - name: Set flag to indicate that systemd runtime operations are available 41 | set_fact: 42 | __grafana_is_booted: "{{ __is_system_running.stdout != 'offline' }}" 43 | 44 | - name: Install Grafana packages 45 | package: 46 | name: "{{ __grafana_packages + __grafana_packages_extra }}" 47 | state: present 48 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 49 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 50 | 51 | - name: Get package facts now that Grafana is installed 52 | package_facts: 53 | 54 | - name: Get Grafana version number from installed packages 55 | set_fact: 56 | grafana_version: "{{ ansible_facts.packages.grafana[0].version }}" 57 | 58 | - name: Template Grafana v8 and earlier configuration 59 | template: 60 | src: grafana_7.ini.j2 61 | dest: "{{ __grafana_conf }}" 62 | mode: "0640" 63 | notify: Restart grafana 64 | when: grafana_version is version('9.0.0', '<') 65 | 66 | - name: Template Grafana v9 and later configuration 67 | template: 68 | src: grafana_9.ini.j2 69 | dest: "{{ __grafana_conf }}" 70 | mode: "0640" 71 | notify: Restart grafana 72 | when: grafana_version is version('9.0.0', '>=') 73 | 74 | - name: Ensure Grafana configuration directory exists 75 | file: 76 | path: "{{ __grafana_provisioning_path }}/datasources" 77 | state: directory 78 | group: grafana 79 | owner: root 80 | mode: "0750" 81 | 82 | - name: Ensure Grafana service is configured with datasources 83 | template: 84 | src: grafana-pcp-datasources.yaml.j2 85 | dest: "{{ __grafana_provisioning_path }}/datasources/grafana-pcp.yaml" 86 | mode: "0644" 87 | notify: Restart grafana 88 | 89 | - name: Ensure graphing service is running and enabled on boot 90 | service: 91 | name: grafana-server 92 | state: "{{ 'started' if __grafana_is_booted else omit }}" 93 | enabled: true 94 | 95 | # yamllint disable rule:line-length 96 | - name: Ensure graphing service settings are configured by HTTP POST 97 | uri: 98 | url: "http://{{ __grafana_user }}:{{ __grafana_password }}@{{ __grafana_server }}/api/plugins/performancecopilot-pcp-app/settings" 99 | force_basic_auth: true 100 | headers: 101 | Content-Type: application/json 102 | method: POST 103 | src: files/grafana-pcp-settings.json 104 | when: grafana_version is version('7.5.0', '<') 105 | # yamllint enable rule:line-length 106 | 107 | - name: Ensure graphing service settings are configured by provisioning 108 | copy: 109 | src: files/grafana-pcp-provisioning.yaml 110 | dest: "{{ __grafana_provisioning_path }}/plugins/grafana-pcp.yaml" 111 | owner: root 112 | group: grafana 113 | mode: "0640" 114 | when: grafana_version is version('7.5.0', '>=') 115 | -------------------------------------------------------------------------------- /roles/elasticsearch/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | # yamllint disable rule:line-length 4 | - name: Set platform/version specific variables 5 | include_vars: "{{ item }}" 6 | loop: 7 | - "{{ role_path }}/vars/default.yml" 8 | - "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml" 9 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml" 10 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" 11 | - "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml" 12 | when: item is file 13 | # yamllint enable rule:line-length 14 | 15 | - name: Determine if system is ostree and set flag 16 | when: not __ansible_pcp_is_ostree is defined 17 | block: 18 | - name: Check if system is ostree 19 | stat: 20 | path: /run/ostree-booted 21 | register: __ostree_booted_stat 22 | 23 | - name: Set flag to indicate system is ostree 24 | set_fact: 25 | __ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" 26 | 27 | - name: Establish Elasticsearch metrics package names 28 | set_fact: 29 | __elasticsearch_packages_extra: "{{ __elasticsearch_packages_extra + 30 | __elasticsearch_packages_pcp }}" 31 | when: 32 | - elasticsearch_metrics_provider == 'pcp' 33 | - elasticsearch_agent | d(false) | bool 34 | 35 | - name: Establish Elasticsearch metrics export package names 36 | set_fact: 37 | __elasticsearch_packages_extra: "{{ __elasticsearch_packages_extra + 38 | __elasticsearch_packages_export_pcp }}" 39 | when: 40 | - elasticsearch_metrics_provider == 'pcp' 41 | - elasticsearch_export_metrics | d(false) | bool 42 | 43 | - name: Install needed Elasticsearch metrics packages 44 | package: 45 | name: "{{ __elasticsearch_packages_extra }}" 46 | state: present 47 | use: "{{ (__ansible_pcp_is_ostree | d(false)) | 48 | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" 49 | when: __elasticsearch_packages_extra | d([]) | length > 0 50 | 51 | - name: Ensure PCP Elasticsearch agent configuration directory exists 52 | file: 53 | path: "{{ __elasticsearch_conf_dir }}" 54 | state: directory 55 | mode: "0755" 56 | when: elasticsearch_metrics_provider == 'pcp' 57 | 58 | - name: Ensure PCP Elasticsearch agent is configured 59 | template: 60 | src: elasticsearch.conf.j2 61 | dest: "{{ __elasticsearch_conf }}" 62 | follow: true 63 | mode: "0600" 64 | when: 65 | - elasticsearch_metrics_provider == 'pcp' 66 | - elasticsearch_agent | d(false) | bool 67 | 68 | - name: Ensure correct service path for ostree systems 69 | when: 70 | - __ansible_pcp_is_ostree | d(false) 71 | - __elasticsearch_service_path != "/etc/systemd/system" 72 | set_fact: 73 | __elasticsearch_service_path: /etc/systemd/system 74 | 75 | - name: Ensure PCP Elasticsearch export service exists 76 | template: 77 | src: pcp2elasticsearch.service.j2 78 | dest: "{{ __elasticsearch_service_path }}/pcp2elasticsearch.service" 79 | mode: "0600" 80 | when: 81 | - elasticsearch_metrics_provider == 'pcp' 82 | - elasticsearch_export_metrics | d(false) | bool 83 | 84 | - name: Determine if host is booted 85 | # noqa command-instead-of-module 86 | command: systemctl is-system-running 87 | register: __system_running 88 | changed_when: false 89 | check_mode: false 90 | failed_when: false 91 | 92 | - name: Require installed systemd 93 | fail: 94 | msg: "Error: This role requires systemd to be installed." 95 | when: '"No such file or directory" in __system_running.msg | d("")' 96 | 97 | - name: Ensure PCP Elasticsearch export is running and enabled on boot 98 | service: 99 | name: pcp2elasticsearch 100 | state: "{{ 'started' if __system_running.stdout != 'offline' else omit }}" 101 | enabled: true 102 | ignore_errors: true # noqa ignore-errors 103 | # Elasticsearch server may be running remotely or presently down 104 | # but since a playbook has explicitly asked us for it, we end up 105 | # having to install our service ignoring any errors. 106 | when: 107 | - elasticsearch_metrics_provider == 'pcp' 108 | - elasticsearch_export_metrics | d(false) | bool 109 | -------------------------------------------------------------------------------- /roles/pcp/tasks/pmcd.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | - name: List optional metric collection agents to be enabled 5 | debug: 6 | msg: "NeedInstall agent: {{ item }} from {{ pcp_optional_agents }}" 7 | loop: "{{ pcp_optional_agents | default([]) }}" 8 | 9 | - name: Extract metric collection configuration file content 10 | command: "cat {{ __pcp_pmcd_conf }}" 11 | register: pmcd_conf 12 | changed_when: false 13 | 14 | - name: Ensure optional metric collection agents are enabled 15 | file: 16 | path: "{{ __pcp_agents_path }}/{{ item }}/.NeedInstall" 17 | mode: u=rw,g=r,o=r 18 | state: touch 19 | loop: "{{ pcp_optional_agents | default([]) }}" 20 | when: pmcd_conf.stdout.find(item) == -1 21 | register: __pcp_register_changed_optional_agents 22 | 23 | - name: Ensure explicit metric label path exists 24 | file: 25 | path: "{{ __pcp_explicit_labels_path }}" 26 | state: directory 27 | mode: "0755" 28 | owner: root 29 | group: root 30 | 31 | - name: Ensure implicit metric label path exists 32 | file: 33 | path: "{{ __pcp_implicit_labels_path }}" 34 | state: directory 35 | mode: "0755" 36 | owner: root 37 | group: root 38 | 39 | - name: Ensure any explicit metric labels are configured 40 | template: 41 | src: pmcd.explicit.labels.j2 42 | dest: "{{ __pcp_explicit_labels_path }}/ansible-managed" 43 | mode: "0644" 44 | register: __pcp_register_changed_explicit_labels 45 | 46 | - name: Ensure any implicit metric labels are configured 47 | template: 48 | src: pmcd.implicit.labels.j2 49 | dest: "{{ __pcp_implicit_labels_path }}/ansible-managed" 50 | mode: "0644" 51 | register: __pcp_register_changed_implicit_labels 52 | 53 | - name: Ensure performance metric collector is configured 54 | template: 55 | src: pmcd.defaults.j2 56 | dest: "{{ __pcp_pmcd_defaults_path }}" 57 | mode: "0644" 58 | register: __pcp_register_changed_defaults_config 59 | 60 | - name: Ensure performance metric collector system accounts are configured 61 | user: 62 | name: "{{ item.user }}" 63 | system: true 64 | when: item.user is defined 65 | with_items: "{{ pcp_accounts }}" 66 | 67 | # yamllint disable rule:line-length 68 | - name: Ensure performance metric collector SASL accounts are configured 69 | shell: | 70 | set -eu 71 | if set -o | grep -q pipefail; then 72 | set -o pipefail # pipefail not supported on debian, some ubuntu 73 | fi 74 | if ! sasldblistusers2 -f "{{ __pcp_pmcd_sasldb_path }}" | grep -q "^{{ item.sasluser }}@"; then 75 | echo "Creating new {{ item.sasluser }} user in {{ __pcp_pmcd_sasldb_path }}" 76 | echo "{{ item.saslpassword }}" | saslpasswd2 -a pmcd "{{ item.sasluser }}" 77 | chown root:pcp "{{ __pcp_pmcd_sasldb_path }}" 78 | chmod 640 "{{ __pcp_pmcd_sasldb_path }}" 79 | fi 80 | register: ensure_sasl_configured 81 | changed_when: "'Creating new SASL account' in ensure_sasl_configured.stdout" 82 | when: item.sasluser is defined 83 | with_items: "{{ pcp_accounts }}" 84 | # yamllint enable rule:line-length 85 | 86 | - name: Ensure performance metric collector authentication is configured 87 | template: 88 | src: pmcd.sasl2.conf.j2 89 | dest: "{{ __pcp_pmcd_saslconf_path }}" 90 | mode: "0644" 91 | register: __pcp_register_changed_authentication 92 | when: pcp_accounts | d([]) | length > 0 93 | 94 | - name: Set variable to do pmcd restart if needed 95 | set_fact: 96 | __pcp_restart_pmcd: "{{ 97 | __pcp_register_changed_optional_agents is changed or 98 | __pcp_register_changed_explicit_labels is changed or 99 | __pcp_register_changed_implicit_labels is changed or 100 | __pcp_register_changed_defaults_config is changed or 101 | (__pcp_register_changed_authentication is defined and 102 | __pcp_register_changed_authentication is changed) }}" 103 | 104 | # yamllint disable rule:line-length 105 | - name: Report performance metric collector restart state 106 | debug: 107 | msg: 108 | - "optional_agents: {{ __pcp_register_changed_optional_agents is changed }}" 109 | - "explicit_labels: {{ __pcp_register_changed_explicit_labels is changed }}" 110 | - "implicit_labels: {{ __pcp_register_changed_implicit_labels is changed }}" 111 | - "defaults_config: {{ __pcp_register_changed_defaults_config is changed }}" 112 | - "authentication: {{ (__pcp_register_changed_authentication is defined and __pcp_register_changed_authentication is changed) }}" 113 | - "restart_pmcd: {{ __pcp_restart_pmcd | bool }}" 114 | # yamllint enable rule:line-length 115 | 116 | - name: Ensure performance metric collector is running and enabled on boot 117 | service: 118 | name: pmcd 119 | state: "{{ 'started' if __pcp_is_booted else omit }}" 120 | enabled: true 121 | when: not __pcp_restart_pmcd | bool 122 | 123 | - name: Ensure performance metric collector is restarted and enabled on boot 124 | service: 125 | name: pmcd 126 | state: "{{ 'restarted' if __pcp_is_booted else omit }}" 127 | enabled: true 128 | when: __pcp_restart_pmcd | bool 129 | -------------------------------------------------------------------------------- /roles/pcp/tasks/pmie.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | --- 3 | 4 | - name: Ensure extra performance rule group directories exist 5 | file: 6 | path: "{{ __pcp_pmieconf_path }}/{{ item }}" 7 | state: directory 8 | owner: root 9 | group: root 10 | mode: "0755" 11 | loop: "{{ __pcp_pmieconf_groups | default([]) }}" 12 | register: __pcp_register_changed_group_dir 13 | 14 | - name: Ensure extra performance rule group link directories exist 15 | file: 16 | path: "{{ __pcp_pmieconf_link_path }}/{{ item }}" 17 | state: directory 18 | owner: root 19 | group: root 20 | mode: "0755" 21 | loop: "{{ __pcp_pmieconf_groups | default([]) }}" 22 | register: __pcp_register_changed_group_link_dir 23 | 24 | - name: Ensure extra performance rules are installed for targeted hosts 25 | copy: 26 | src: "files/{{ item }}" 27 | dest: "{{ __pcp_pmieconf_path }}/{{ item }}" 28 | owner: root 29 | group: root 30 | mode: "0644" 31 | loop: "{{ __pcp_pmieconf_rules | default([]) }}" 32 | register: __pcp_register_changed_rules_for_hosts 33 | 34 | - name: Ensure performance rule actions are installed for targeted hosts 35 | set_fact: 36 | local_pmie: "default" 37 | 38 | - name: Check if global pmie webhook action is configured 39 | lineinfile: 40 | state: absent 41 | path: "{{ __pcp_pmie_config_path }}/config.{{ item }}" 42 | regexp: "//.*global webhook_action = yes" 43 | check_mode: true 44 | changed_when: false 45 | register: __pcp_global_webhook_action_status 46 | loop: "{{ pcp_target_hosts + [local_pmie] }}" 47 | when: 48 | - pcp_pmie_endpoint | length > 0 49 | 50 | - name: Configure global webhook action 51 | # yamllint disable rule:line-length 52 | command: "pmieconf -f {{ __pcp_pmie_config_path }}/config.{{ item.item }} modify global webhook_action yes" 53 | loop: "{{ __pcp_global_webhook_action_status.results }}" 54 | changed_when: 55 | - pcp_pmie_endpoint | length > 0 56 | - item.found | d(-1) <= 0 57 | when: 58 | - pcp_pmie_endpoint | length > 0 59 | - item.found | d(-1) <= 0 60 | register: __pcp_register_changed_actions_for_hosts 61 | # yamllint enable rule:line-length 62 | 63 | - name: Check if global webhook endpoint is configured 64 | lineinfile: 65 | state: absent 66 | path: "{{ __pcp_pmie_config_path }}/config.{{ item }}" 67 | regexp: "//.*global webhook_endpoint = \"{{ pcp_pmie_endpoint }}\"" 68 | check_mode: true 69 | changed_when: false 70 | register: __pcp_global_webhook_endpoint_status 71 | loop: "{{ pcp_target_hosts + [local_pmie] }}" 72 | 73 | - name: Configure global webhook endpoint 74 | # yamllint disable rule:line-length 75 | command: "pmieconf -f {{ __pcp_pmie_config_path }}/config.{{ item.item }} modify global webhook_endpoint {{ pcp_pmie_endpoint }}" 76 | loop: "{{ __pcp_global_webhook_endpoint_status.results }}" 77 | changed_when: 78 | - pcp_pmie_endpoint | length > 0 79 | - item.found | d(-1) <= 0 80 | when: 81 | - pcp_pmie_endpoint | length > 0 82 | - item.found | d(-1) <= 0 83 | register: __pcp_register_changed_actions_for_hosts 84 | # yamllint enable rule:line-length 85 | 86 | - name: Ensure extra rules symlinks have been created for targeted hosts 87 | file: 88 | src: "{{ __pcp_pmieconf_path }}/{{ item }}" 89 | dest: "{{ __pcp_pmieconf_link_path }}/{{ item }}" 90 | state: link 91 | force: true 92 | loop: "{{ __pcp_pmieconf_rules | default([]) }}" 93 | register: __pcp_register_changed_symlinks_for_hosts 94 | 95 | - name: Enable performance metric inference for targeted hosts (with control.d) 96 | template: 97 | src: pmie.controld.j2 98 | dest: "{{ __pcp_pmie_control_d_path }}/{{ item }}" 99 | mode: "0644" 100 | loop: "{{ pcp_target_hosts | default([]) }}" 101 | register: __pcp_register_changed_target_hosts_controld 102 | when: 103 | - not pcp_single_control | d(false) | bool 104 | - pcp_target_hosts | d([]) | length > 0 105 | 106 | - name: Enable performance metric inference for targeted hosts (single control) 107 | template: 108 | src: pmie.control.j2 109 | dest: "{{ __pcp_pmie_control_path }}" 110 | mode: "0644" 111 | register: __pcp_register_changed_target_hosts_single 112 | when: 113 | - pcp_single_control | d(true) | bool 114 | - pcp_target_hosts | d([]) | length > 0 115 | 116 | - name: Set variable to do pmie restart if needed 117 | set_fact: 118 | __pcp_restart_pmie: "{{ 119 | __pcp_register_changed_group_dir is changed or 120 | __pcp_register_changed_group_link_dir is changed or 121 | __pcp_register_changed_rules_for_hosts is changed or 122 | __pcp_register_changed_actions_for_hosts is changed or 123 | __pcp_register_changed_symlinks_for_hosts is changed or 124 | __pcp_register_changed_target_hosts_controld is changed or 125 | __pcp_register_changed_target_hosts_single is changed }}" 126 | 127 | - name: Ensure performance metric inference is running and enabled on boot 128 | service: 129 | name: pmie 130 | state: "{{ 'started' if __pcp_is_booted else omit }}" 131 | enabled: true 132 | when: not __pcp_restart_pmie | bool 133 | 134 | - name: Ensure performance metric inference is restarted and enabled on boot 135 | service: 136 | name: pmie 137 | state: "{{ 'restarted' if __pcp_is_booted else omit }}" 138 | enabled: true 139 | when: __pcp_restart_pmie | bool 140 | -------------------------------------------------------------------------------- /roles/pcp/README.md: -------------------------------------------------------------------------------- 1 | # performancecopilot.metrics.pcp 2 | 3 | Installs and configures the [Performance Co-Pilot](https://pcp.io/) toolkit. 4 | 5 | ## Requirements 6 | 7 | Uses features of PCP v5 and later. 8 | 9 | ## Role Variables 10 | 11 | ### pcp_rest_api: true 12 | 13 | Enable the PCP REST APIs and log discovery via the [pmproxy(1)](http://man7.org/linux/man-pages/man1/pmproxy.1.html) service. Default: false. 14 | 15 | ### pcp_pmlogger_interval: 60 16 | 17 | Default logging interval for [pmlogger(1)](http://man7.org/linux/man-pages/man1/pmlogger.1.html) archives for logging groups that do not set an explicit sampling interval. 18 | 19 | ### pcp_pmlogger_discard: 14 20 | 21 | After some period, old PCP archives are discarded. This period is 14 days by default, but may be changed using this variable. Some special values are recognized for the period, namely '0' to keep no archives beyond the current one, and 'forever' or never to prevent any archives being discarded. Note that the semantics of discard are that it is measured from the time of last modification of each archive, and not from the current day. 22 | 23 | ### pcp_archive_dir: /var/log/pcp/pmlogger 24 | 25 | Default location for [pmlogger(1)](http://man7.org/linux/man-pages/man1/pmlogger.1.html) archives, per-host directories containing daily performance metric archives will be created here when pmlogger is enabled. When [pmproxy(1)](http://man7.org/linux/man-pages/man1/pmproxy.1.html) is running with archive discovery enabled, it monitors this location. 26 | 27 | ### pcp_target_hosts: [] 28 | 29 | An optional list of remote hostnames for which metric recording and inference rules should be installed, to be monitored from the host running the playbook. By default, all performance rules evaluating to true will be logged to the local system log (for both the local host and remote hosts in the target hosts list), and daily archives will be created below *pcp_archive_dir*/*hostname* locally, again for each host listed in the target hosts list. 30 | 31 | ### pcp_pmie_endpoint: '' 32 | 33 | Send inference events to the given webhook endpoint (URL) from [pmie(1)](http://man7.org/linux/man-pages/man1/pmie.1.html) performance rules. The default is to log these events into the local system log only. 34 | 35 | ### pcp_single_control: 0 36 | 37 | Specifies whether the pcp_target_hosts configuration file(s) for pmie and pmlogger are in control.d form (the default) or in the single file form where /*etc*/*pcp*/*pmlogger*/*control* and /*etc*/*pcp*/*pmie*/*control* are used to setup the target hosts list for monitoring. 38 | 39 | ### pcp_pmcd_localonly: 0 40 | 41 | Enable remote host connections to the [pmcd(1)](http://man7.org/linux/man-pages/man1/pmcd.1.html) service. This affects most PMAPI client tools accessing live data such as including *pmlogger*, *pmchart*, *pmrep*, *pmie*, *pcp-dstat*, and so on 42 | 43 | ### pcp_pmproxy_localonly: 0 44 | 45 | Enable remote host connections to the [pmproxy(1)](http://man7.org/linux/man-pages/man1/pmproxy.1.html) service. This affects client tools using the REST API such as [grafana-pcp](https://grafana-pcp.readthedocs.io/) and PMAPI client tools using the protocol proxying features of *pmproxy*. 46 | 47 | ### pcp_pmlogger_localonly: 1 48 | 49 | Enable remote host connections to the [pmlogger(1)](http://man7.org/linux/man-pages/man1/pmlogger.1.html) service. This affects the optional [pmlc(1)](http://man7.org/linux/man-pages/man1/pmlc.1.html) utility. 50 | 51 | ### pcp_optional_agents: [] 52 | 53 | Additional performance metrics domain agents (PMDAs) that should be installed, beyond the default set, to enable additional metrics. The array provided should contain shortened names for each PMDA to be enabled, such as "kvm". 54 | 55 | ### pcp_optional_packages: [] 56 | 57 | Additional PCP packages that should be installed, beyond the default set, to enable additional metrics, export to alternate data sinks, and so on. 58 | 59 | ```yaml 60 | pcp_explicit_labels: 61 | environment: production 62 | 63 | pcp_implicit_labels: 64 | deployment: 2020-08-17 65 | commitid: efbd2a331 66 | ``` 67 | 68 | Additional metadata can be associated with performance metrics from the [pmcd(1)](http://man7.org/linux/man-pages/man1/pmcd.1.html) service. These are typically name=value pairs. Explicit labels will be used in calculating time series identifiers seen by the [pmseries(1)](http://man7.org/linux/man-pages/man1/pmseries.1.html) command and [grafana-pcp](https://grafana-pcp.readthedocs.io/en/latest/index.html), and implicit labels will not. 69 | 70 | ```yaml 71 | pcp_accounts: 72 | - {user: metrics, sasluser: metrics, saslpassword: p4ssw0rd} 73 | - {sasluser: nathans, saslpassword: "adm1n!"} 74 | ``` 75 | 76 | Configures access to system resources for accounts used by PCP. The *user* setting configures a local user (system) account. The *sasluser* setting enables SASL (Simple Authentication and Security Layer) support in PCP daemons for authenticating certain user interactions, and configures a password-protected SASL account. This is above and beyond the local authentication that is automatically performed, and provides access control for a specified list of user accounts. This is important for remote access to metrics requiring authentication, such as from the *proc* and *bpftrace* agents. 77 | 78 | ## Dependencies 79 | 80 | None. 81 | 82 | ## Example Playbooks 83 | 84 | Basic PCP setup with monitoring suited for a single host. 85 | 86 | ```yaml 87 | - hosts: all 88 | roles: 89 | - role: performancecopilot.metrics.pcp 90 | vars: 91 | pcp_pmlogger_interval: 10 92 | # NOTE: No openmetrics on EL7 93 | pcp_optional_agents: [dm, nfsclient, openmetrics] 94 | pcp_explicit_labels: 95 | environment: production 96 | ``` 97 | 98 | Central PCP setup for monitoring of several remote hosts. 99 | 100 | ```yaml 101 | - hosts: monitoring 102 | roles: 103 | - role: performancecopilot.metrics.pcp 104 | vars: 105 | pcp_pmlogger_interval: 10 106 | pcp_pmlogger_discard: 5 107 | pcp_target_hosts: [slip, slop, slap] 108 | pcp_rest_api: true 109 | ``` 110 | 111 | ## License 112 | 113 | MIT 114 | 115 | ## Author Information 116 | 117 | Official role for PCP, maintained by the PCP developers 118 | -------------------------------------------------------------------------------- /.markdownlint.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Default state for all rules 3 | default: true 4 | 5 | # Path to configuration file to extend 6 | extends: null 7 | 8 | # MD001/heading-increment/header-increment - Heading levels should only increment by one level at a time 9 | MD001: true 10 | 11 | # MD002/first-heading-h1/first-header-h1 - First heading should be a top-level heading 12 | MD002: 13 | # Heading level 14 | level: 1 15 | 16 | # MD003/heading-style/header-style - Heading style 17 | MD003: 18 | # Heading style 19 | style: "consistent" 20 | 21 | # MD004/ul-style - Unordered list style 22 | MD004: 23 | # List style 24 | style: "consistent" 25 | 26 | # MD005/list-indent - Inconsistent indentation for list items at the same level 27 | MD005: true 28 | 29 | # MD006/ul-start-left - Consider starting bulleted lists at the beginning of the line 30 | MD006: true 31 | 32 | # MD007/ul-indent - Unordered list indentation 33 | MD007: 34 | # Spaces for indent 35 | indent: 2 36 | # Whether to indent the first level of the list 37 | start_indented: false 38 | # Spaces for first level indent (when start_indented is set) 39 | start_indent: 2 40 | 41 | # MD009/no-trailing-spaces - Trailing spaces 42 | MD009: 43 | # Spaces for line break 44 | br_spaces: 2 45 | # Allow spaces for empty lines in list items 46 | list_item_empty_lines: false 47 | # Include unnecessary breaks 48 | strict: false 49 | 50 | # MD010/no-hard-tabs - Hard tabs 51 | MD010: 52 | # Include code blocks 53 | code_blocks: true 54 | # Fenced code languages to ignore 55 | ignore_code_languages: [] 56 | # Number of spaces for each hard tab 57 | spaces_per_tab: 1 58 | 59 | # MD011/no-reversed-links - Reversed link syntax 60 | MD011: true 61 | 62 | # MD012/no-multiple-blanks - Multiple consecutive blank lines 63 | MD012: 64 | # Consecutive blank lines 65 | maximum: 1 66 | 67 | # Modified for LSR 68 | # GFM does not limit line length 69 | # MD013/line-length - Line length 70 | MD013: false 71 | # # Number of characters 72 | # # line_length: 80 73 | # line_length: 999 74 | # # Number of characters for headings 75 | # heading_line_length: 80 76 | # # Number of characters for code blocks 77 | # code_block_line_length: 80 78 | # # Include code blocks 79 | # code_blocks: true 80 | # # Include tables 81 | # tables: true 82 | # # Include headings 83 | # headings: true 84 | # # Include headings 85 | # headers: true 86 | # # Strict length checking 87 | # strict: false 88 | # # Stern length checking 89 | # stern: false 90 | 91 | # MD014/commands-show-output - Dollar signs used before commands without showing output 92 | MD014: true 93 | 94 | # MD018/no-missing-space-atx - No space after hash on atx style heading 95 | MD018: true 96 | 97 | # MD019/no-multiple-space-atx - Multiple spaces after hash on atx style heading 98 | MD019: true 99 | 100 | # MD020/no-missing-space-closed-atx - No space inside hashes on closed atx style heading 101 | MD020: true 102 | 103 | # MD021/no-multiple-space-closed-atx - Multiple spaces inside hashes on closed atx style heading 104 | MD021: true 105 | 106 | # MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines 107 | MD022: 108 | # Blank lines above heading 109 | lines_above: 1 110 | # Blank lines below heading 111 | lines_below: 1 112 | 113 | # MD023/heading-start-left/header-start-left - Headings must start at the beginning of the line 114 | MD023: true 115 | 116 | # MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content 117 | MD024: true 118 | 119 | # MD025/single-title/single-h1 - Multiple top-level headings in the same document 120 | MD025: 121 | # Heading level 122 | level: 1 123 | # RegExp for matching title in front matter 124 | front_matter_title: "^\\s*title\\s*[:=]" 125 | 126 | # MD026/no-trailing-punctuation - Trailing punctuation in heading 127 | MD026: 128 | # Punctuation characters not allowed at end of headings 129 | punctuation: ".,;:!。,;:!" 130 | 131 | # MD027/no-multiple-space-blockquote - Multiple spaces after blockquote symbol 132 | MD027: true 133 | 134 | # MD028/no-blanks-blockquote - Blank line inside blockquote 135 | MD028: true 136 | 137 | # MD029/ol-prefix - Ordered list item prefix 138 | MD029: 139 | # List style 140 | style: "one_or_ordered" 141 | 142 | # MD030/list-marker-space - Spaces after list markers 143 | MD030: 144 | # Spaces for single-line unordered list items 145 | ul_single: 1 146 | # Spaces for single-line ordered list items 147 | ol_single: 1 148 | # Spaces for multi-line unordered list items 149 | ul_multi: 1 150 | # Spaces for multi-line ordered list items 151 | ol_multi: 1 152 | 153 | # MD031/blanks-around-fences - Fenced code blocks should be surrounded by blank lines 154 | MD031: 155 | # Include list items 156 | list_items: true 157 | 158 | # MD032/blanks-around-lists - Lists should be surrounded by blank lines 159 | MD032: true 160 | 161 | # MD033/no-inline-html - Inline HTML 162 | MD033: 163 | # Allowed elements 164 | allowed_elements: [] 165 | 166 | # MD034/no-bare-urls - Bare URL used 167 | MD034: true 168 | 169 | # MD035/hr-style - Horizontal rule style 170 | MD035: 171 | # Horizontal rule style 172 | style: "consistent" 173 | 174 | # MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading 175 | MD036: 176 | # Punctuation characters 177 | punctuation: ".,;:!?。,;:!?" 178 | 179 | # MD037/no-space-in-emphasis - Spaces inside emphasis markers 180 | MD037: true 181 | 182 | # MD038/no-space-in-code - Spaces inside code span elements 183 | MD038: true 184 | 185 | # MD039/no-space-in-links - Spaces inside link text 186 | MD039: true 187 | 188 | # MD040/fenced-code-language - Fenced code blocks should have a language specified 189 | MD040: 190 | # List of languages 191 | allowed_languages: [] 192 | # Require language only 193 | language_only: false 194 | 195 | # MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading 196 | MD041: 197 | # Heading level 198 | level: 1 199 | # RegExp for matching title in front matter 200 | front_matter_title: "^\\s*title\\s*[:=]" 201 | 202 | # MD042/no-empty-links - No empty links 203 | MD042: true 204 | 205 | # Modified for LSR 206 | # Disabling, we do not need this 207 | # MD043/required-headings/required-headers - Required heading structure 208 | MD043: false 209 | # # List of headings 210 | # headings: [] 211 | # # List of headings 212 | # headers: [] 213 | # # Match case of headings 214 | # match_case: false 215 | 216 | # MD044/proper-names - Proper names should have the correct capitalization 217 | MD044: 218 | # List of proper names 219 | names: [] 220 | # Include code blocks 221 | code_blocks: true 222 | # Include HTML elements 223 | html_elements: true 224 | 225 | # MD045/no-alt-text - Images should have alternate text (alt text) 226 | MD045: true 227 | 228 | # MD046/code-block-style - Code block style 229 | MD046: 230 | # Block style 231 | style: "consistent" 232 | 233 | # MD047/single-trailing-newline - Files should end with a single newline character 234 | MD047: true 235 | 236 | # MD048/code-fence-style - Code fence style 237 | MD048: 238 | # Code fence style 239 | style: "consistent" 240 | 241 | # MD049/emphasis-style - Emphasis style should be consistent 242 | MD049: 243 | # Emphasis style should be consistent 244 | style: "consistent" 245 | 246 | # MD050/strong-style - Strong style should be consistent 247 | MD050: 248 | # Strong style should be consistent 249 | style: "consistent" 250 | 251 | # MD051/link-fragments - Link fragments should be valid 252 | MD051: true 253 | 254 | # MD052/reference-links-images - Reference links and images should use a label that is defined 255 | MD052: true 256 | 257 | # MD053/link-image-reference-definitions - Link and image reference definitions should be needed 258 | MD053: 259 | # Ignored definitions 260 | ignored_definitions: 261 | - "//" 262 | --------------------------------------------------------------------------------