buluma.collectd

Ansible-Rolle collectd

Installieren und konfigurieren Sie collectd auf Ihrem System.

GitHub Version Probleme Pull-Anfragen Downloads
github Version Issues PullRequests Ansible Role

Beispiel-Playbook

Dieses Beispiel stammt aus molecule/default/converge.yml und wird bei jedem Push, jeder Pull-Anfrage und jedem Release getestet.

---
- name: converge
  hosts: all
  become: true
  gather_facts: true
  vars:
    collectd_plugin_logging: logfile
    collectd_basic_plugins:
      - cpu
      - interface
      - load
      - memory
    collectd_plugins:
      - name: df
        config: |
          MountPoint "/proc"
          MountPoint "/dev"
          MountPoint "/\/docker\/containers\//"
          MountPoint "/\/docker\/devicemapper\//"
          MountPoint "/\/docker\/plugins\//"
          MountPoint "/\/docker\/overlay\//"
          MountPoint "/\/docker\/overlay2\//"
          MountPoint "/\/docker\/netns\//"
          FSType "overlay"
          FSType "proc"
          FSType "tmpfs"
          IgnoreSelected true
          ReportInodes true
      - name: disk
        config: |
          Disk "/^hd"
          IgnoreSelected true
      - name: interface
        config: |
          Interface "lo"
          Interface "/veth.*/"
          IgnoreSelected true
      - name: swap
        config: |
          ReportByDevice false
          ReportBytes true
      - name: write_http
        config: |
          <Node "test">
            URL "127.0.0.1:8080/test.collectd"
            Format "JSON"
            StoreRates true
          </Node>
      - name: postgresql
        config: |
          <Query tickets>
            Statement "SELECT count(t.id) AS count FROM tickets t WHERE t.closed is null;"
            <Result>
              Type gauge
              InstancePrefix "tickets"
              ValuesFrom "count"
            </Result>
          </Query>
          <Database "test">
            Host "psql-database.hostname.com"
            Port "5432"
            User "my_psqladminuser"
            Password "my_passwd"
            SSLMode "prefer"
            Query tickets
          </Database>
  pre_tasks:
    - name: Aktualisieren des apt-Caches.
      apt: update_cache=true cache_valid_time=600
      when: ansible_os_family == 'Debian'
  roles:
    - role: buluma.collectd

Der Computer muss vorbereitet werden. Im CI erfolgt dies mithilfe von molecule/default/prepare.yml:

---
- name: prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: buluma.bootstrap
    - role: buluma.epel

Siehe auch eine vollständige Erklärung und Beispiel zur Verwendung dieser Rollen.

Rollenvariablen

Die Standardwerte der Variablen sind in defaults/main.yml festgelegt:

---
# Standarddatei für collectd

collectd_conf_hostname: "{{ ansible_hostname }}"
collectd_conf_fqdnlookup: "false"
collectd_conf_basedir: /var/lib/collectd
collectd_conf_pidfile: /var/run/collectd.pid
collectd_conf_typesdb: /usr/share/collectd/types.db

collectd_conf_autoloadplugin: "false"
collectd_conf_collectinternalstats: "false"

collectd_conf_interval: 10
collectd_conf_maxreadinterval: 86400
collectd_conf_timeout: 2
collectd_conf_readthreads: 5
collectd_conf_writethreads: 5

collectd_conf_include_dir: /etc/collectd.d
collectd_conf_fnmatch_filters:
  - "*.conf"

collectd_conf_extra: ~

#### Protokollierungs Konfiguration

collectd_plugin_logging: syslog

collectd_plugin_logging_directory: "/var/log/collectd"

collectd_plugin_logfile_loglevel: "info"
collectd_plugin_logfile_file: "{{ collectd_plugin_logging_directory }}/collectd.log"
collectd_plugin_logfile_timestamp: "true"
collectd_plugin_logfile_printseverity: "false"

collectd_plugin_logstash_loglevel: "info"
collectd_plugin_logstash_file: "{{ collectd_plugin_logging_directory }}/collectd.json.log"

collectd_plugin_syslog_loglevel: "info"
# collectd_plugin_syslog_notifylevel: ""

# Verwenden Sie 'collectd_basic_plugins', um Plugins zu aktivieren, die keine zusätzliche
# Konfiguration erfordern.
collectd_basic_plugins:
  - cpu
  - interface
  - load
  - memory
  # - aggregation
  # ...

# Verwenden Sie 'collectd_plugins', um Plugins zu aktivieren, die eine zusätzliche Konfiguration erfordern.
collectd_plugins: []
# Beispiele:
#  - name: example
#    interval: 120 # Sekunden
#    flush_interval: 600 # Sekunden
#    flush_timeout:
#    config: |4
#      Something: true
#      <Nested block>
#        NestedKey: "value"
#      </Nested>
#  - name: write_http
#    config: |4
#      <Node "oms">
#         URL "127.0.0.1:26000/oms.collectd"
#         Format "JSON"
#         StoreRates true
#      </Node>
#  - name: postgresql
#    config: |4
#      <Query tickets>
#          Statement "SELECT count(t.id) AS count FROM tickets t WHERE t.closed is null;"
#          <Result>
#            Type gauge
#            InstancePrefix "tickets"
#            ValuesFrom "count"
#          </Result>
#      </Query>
#      <Database "test">
#        Host "psql-database.hostname.com"
#        Port "5432"
#        User "my_psqladminuser"
#        Password "my_passwd"
#        SSLMode "prefer"
#        Query tickets
#      </Database>

Anforderungen

Status der verwendeten Rollen

Die folgenden Rollen werden verwendet, um ein System vorzubereiten. Sie können Ihr System auch anders vorbereiten.

Anforderung GitHub Version
buluma.bootstrap Ansible Molecule Version
buluma.epel Ansible Molecule Version

Kontext

Diese Rolle ist Teil vieler kompatibler Rollen. Weitere Informationen finden Sie in der Dokumentation dieser Rollen.

Hier ist eine Übersicht über verwandte Rollen:

abhängigkeiten

Kompatibilität

Diese Rolle wurde auf diesen Container-Images getestet:

Container Tags
Alpine alle
EL 8
Debian bullseye
Fedora alle
opensuse alle
Ubuntu focal, bionic

Die Mindestversion von Ansible, die erforderlich ist, beträgt 2.10. Die Tests wurden durchgeführt für:

  • Die vorherige Version.
  • Die aktuelle Version.
  • Die Entwicklungs-Version.

Wenn Sie Probleme finden, melden Sie diese bitte auf GitHub.

Änderungsprotokoll

Historie der Rolle

Lizenz

Apache-2.0

Autoreninformationen

Shadow Walker

Über das Projekt

Install and configure collectd on your system.

Installieren
ansible-galaxy install buluma.collectd
GitHub Repository
Lizenz
apache-2.0
Downloads
9.2k
Besitzer
DevOps Engineer