diff --git a/README.md b/README.md index c59d61a..6ace18b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ Easy ansible role to setup system metrics transmission to `collectd`. Currently only `influxdb` is supported by this role. This ansible role works with -- openSUSE Leap 15.2 +- openSUSE Leap 15.3 +- openSUSE Leap 15.4 ## Role Variables diff --git a/defaults/main.yml b/defaults/main.yml index df5cff6..28fe194 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,6 +16,7 @@ prometheus_port: "9103" enable_disk: true enable_cpu: true +enable_cpufreq: false enable_load: true enable_memory: true enable_swap: true @@ -26,3 +27,6 @@ disk_disks: [] df_disks: [] smart_disk: "" smart_use_serial: true + +report_by_cpu: false +report_by_state: false diff --git a/meta/main.yml b/meta/main.yml index f0ace22..d33426c 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,6 +1,8 @@ --- galaxy_info: author: Felix Niederwanger + role_name: nginx + namespace: collectd description: Configurable collectd installation role company: SUSE issue_tracker_url: https://github.com/GeekOops/geekoops-collectd/issues @@ -15,7 +17,8 @@ galaxy_info: platforms: - name: opensuse versions: - - 15.2 + - 15.3 + - 15.4 galaxy_tags: - collectd diff --git a/molecule/default/Dockerfile.leap15_3 b/molecule/default/Dockerfile.leap15_3 new file mode 100644 index 0000000..f32602a --- /dev/null +++ b/molecule/default/Dockerfile.leap15_3 @@ -0,0 +1,7 @@ +FROM registry.opensuse.org/opensuse/leap:15.3 + +# Install systemd and development tools, clear cache +RUN zypper in -y systemd systemd-sysvinit firewalld python3 python3-firewall curl && rm -rf /var/cache/* && rm -f /etc/machine-id /var/lib/dbus/machine-id + +# Start container with systemd +ENTRYPOINT ["/usr/sbin/init"] diff --git a/molecule/default/Dockerfile.leap15_4 b/molecule/default/Dockerfile.leap15_4 new file mode 100644 index 0000000..ae18e14 --- /dev/null +++ b/molecule/default/Dockerfile.leap15_4 @@ -0,0 +1,7 @@ +FROM registry.opensuse.org/opensuse/leap:15.4 + +# Install systemd and development tools, clear cache +RUN zypper in -y systemd systemd-sysvinit firewalld python3 python3-firewall curl && rm -rf /var/cache/* && rm -f /etc/machine-id /var/lib/dbus/machine-id + +# Start container with systemd +ENTRYPOINT ["/usr/sbin/init"] diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 2c75ded..a72887a 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -4,13 +4,23 @@ dependency: driver: name: docker platforms: - - name: leap15_2 - image: grisu48/leap-ansible - pre_build_image: true + - name: leap15_3 + image: registry.opensuse.org/opensuse/leap:15.3 + dockerfile: Dockerfile.leap15_3 + command: ${MOLECULE_DOCKER_COMMAND:-"/usr/sbin/init"} + privileged: true + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + tmpfs: + - /run + - /tmp + - name: leap15_4 + image: registry.opensuse.org/opensuse/leap:15.4 + dockerfile: Dockerfile.leap15_4 + command: ${MOLECULE_DOCKER_COMMAND:-"/usr/sbin/init"} + privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - capabilities: - - SYS_ADMIN tmpfs: - /run - /tmp @@ -18,7 +28,9 @@ provisioner: name: ansible inventory: host_vars: - leap15_2: + leap15_3: + nodename: "jellyfish" + leap15_4: nodename: "jellyfish" verifier: name: testinfra diff --git a/templates/collectd.conf.j2 b/templates/collectd.conf.j2 index 97a7698..a71ccba 100644 --- a/templates/collectd.conf.j2 +++ b/templates/collectd.conf.j2 @@ -14,7 +14,11 @@ Interval {{ interval }} LoadPlugin syslog LoadPlugin cpu #LoadPlugin cpufreq +{% if enable_cpufreq == true %} +LoadPlugin cpusleep +{% else %} #LoadPlugin cpusleep +{% endif %} {% if enable_df == true %} LoadPlugin df {% else %} @@ -109,8 +113,12 @@ LoadPlugin write_prometheus {% if enable_cpu == true %} + {% if report_by_cpu == true %} ReportByCpu true + {% endif %} + {% if report_by_state == true %} ReportByState true + {% endif %} ValuesPercentage true ReportNumCpu false ReportGuestState false diff --git a/vars/openSUSE Leap_15.3.yml b/vars/openSUSE Leap_15.3.yml index 54841fb..2f0f7ae 100644 --- a/vars/openSUSE Leap_15.3.yml +++ b/vars/openSUSE Leap_15.3.yml @@ -1,3 +1,5 @@ --- +# openSUSE Leap 15.3 specific variables + packages: ['collectd'] collectd_service: "collectd" diff --git a/vars/openSUSE Leap_15.2.yml b/vars/openSUSE Leap_15.4.yml similarity index 57% rename from vars/openSUSE Leap_15.2.yml rename to vars/openSUSE Leap_15.4.yml index 54841fb..c3b8b26 100644 --- a/vars/openSUSE Leap_15.2.yml +++ b/vars/openSUSE Leap_15.4.yml @@ -1,3 +1,5 @@ --- +# openSUSE Leap 15.4 specific variables + packages: ['collectd'] collectd_service: "collectd"