From 2b45db2de49208b0d78b04ba2eaa1bd2f5b45e8a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 21 Oct 2021 00:47:37 +0200 Subject: fix typo --- .../openwrt/sensors_prometheus-node-exporter.lua | 27 ++++++++++++++++++++++ .../openwrt/sensors_promethues-node-exporter.lua | 27 ---------------------- .../group_vars/chaos-at-home-sensors/vars.yml | 2 +- inventory/host_vars/ch-mon.yml | 2 +- inventory/host_vars/ele-mon.yml | 4 ++-- .../prometheus/alertmanager/defaults/main.yml | 2 +- .../alertmanager/templates/alertmanager.yml.j2 | 12 +++++----- 7 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 files/common/openwrt/sensors_prometheus-node-exporter.lua delete mode 100644 files/common/openwrt/sensors_promethues-node-exporter.lua diff --git a/files/common/openwrt/sensors_prometheus-node-exporter.lua b/files/common/openwrt/sensors_prometheus-node-exporter.lua new file mode 100644 index 00000000..1d32fa0d --- /dev/null +++ b/files/common/openwrt/sensors_prometheus-node-exporter.lua @@ -0,0 +1,27 @@ +local sensors = require "sensors" + +local config, _ = sensors.read_config('/etc/sensors.json') +sensors.setup(config) +local units = { + temperature = "celsius", + humidity = "percent", + pressure = "pascals", + gpio = "status", +} + +local function scrape() + local readings, err = sensors.read(config) + if not readings then return end + + for name, values in pairs(readings) do + labels = { name = name, kind = values._kind_ } + for t, v in pairs(values) do + local unit = units[t] + if unit ~= nil then + metric("sensors_" .. t .. "_" .. unit, "gauge", labels, v) + end + end + end +end + +return { scrape = scrape } diff --git a/files/common/openwrt/sensors_promethues-node-exporter.lua b/files/common/openwrt/sensors_promethues-node-exporter.lua deleted file mode 100644 index 1d32fa0d..00000000 --- a/files/common/openwrt/sensors_promethues-node-exporter.lua +++ /dev/null @@ -1,27 +0,0 @@ -local sensors = require "sensors" - -local config, _ = sensors.read_config('/etc/sensors.json') -sensors.setup(config) -local units = { - temperature = "celsius", - humidity = "percent", - pressure = "pascals", - gpio = "status", -} - -local function scrape() - local readings, err = sensors.read(config) - if not readings then return end - - for name, values in pairs(readings) do - labels = { name = name, kind = values._kind_ } - for t, v in pairs(values) do - local unit = units[t] - if unit ~= nil then - metric("sensors_" .. t .. "_" .. unit, "gauge", labels, v) - end - end - end -end - -return { scrape = scrape } diff --git a/inventory/group_vars/chaos-at-home-sensors/vars.yml b/inventory/group_vars/chaos-at-home-sensors/vars.yml index 3eb16250..fd937723 100644 --- a/inventory/group_vars/chaos-at-home-sensors/vars.yml +++ b/inventory/group_vars/chaos-at-home-sensors/vars.yml @@ -81,7 +81,7 @@ openwrt_mixin: file: "{{ global_files_dir }}/common/openwrt/sensors.module_lua" /usr/lib/lua/prometheus-collectors/sensors.lua: - file: "{{ global_files_dir }}/common/openwrt/sensors_promethues-node-exporter.lua" + file: "{{ global_files_dir }}/common/openwrt/sensors_prometheus-node-exporter.lua" mode: "0755" diff --git a/inventory/host_vars/ch-mon.yml b/inventory/host_vars/ch-mon.yml index 8c353e88..cf570e4d 100644 --- a/inventory/host_vars/ch-mon.yml +++ b/inventory/host_vars/ch-mon.yml @@ -119,7 +119,7 @@ prometheus_server_jobs_extra: | action: drop -promethues_alertmanager_smtp: +prometheus_alertmanager_smtp: smarthost: "{{ network_zones.lan.prefix | ipaddr(network_zones.lan.offsets['ch-prometheus-legacy']) | ipaddr('address') }}:25" from: "noreply@chaos-at-home.org" require_tls: no diff --git a/inventory/host_vars/ele-mon.yml b/inventory/host_vars/ele-mon.yml index 93ed7f48..4ad37bce 100644 --- a/inventory/host_vars/ele-mon.yml +++ b/inventory/host_vars/ele-mon.yml @@ -102,13 +102,13 @@ prometheus_exporter_mikrotik_devices: password: "{{ vault_prometheus_exporter_mikrotik_api_password }}" prometheus_alertmanager_web_route_prefix: /alertmanager/ -promethues_alertmanager_smtp: +prometheus_alertmanager_smtp: smarthost: "mailrelay.chaos-at-home.org:587" from: "noreply@elev8.at" require_tls: yes auth: username: ele-mon - password: "{{ vault_promethues_alertmanager_smtp_auth_password }}" + password: "{{ vault_prometheus_alertmanager_smtp_auth_password }}" prometheus_alertmanager_route: receiver: equinox diff --git a/roles/monitoring/prometheus/alertmanager/defaults/main.yml b/roles/monitoring/prometheus/alertmanager/defaults/main.yml index 6e6e7a5a..ecec1d7c 100644 --- a/roles/monitoring/prometheus/alertmanager/defaults/main.yml +++ b/roles/monitoring/prometheus/alertmanager/defaults/main.yml @@ -2,7 +2,7 @@ prometheus_alertmanager_web_listen_address: 127.0.0.1:9093 # prometheus_alertmanager_web_route_prefix: /alertmanager/ -promethues_alertmanager_smtp: +prometheus_alertmanager_smtp: smarthost: "127.0.0.1:25" from: "noreply@example.com" require_tls: no diff --git a/roles/monitoring/prometheus/alertmanager/templates/alertmanager.yml.j2 b/roles/monitoring/prometheus/alertmanager/templates/alertmanager.yml.j2 index 3c7fb37e..7374dedc 100644 --- a/roles/monitoring/prometheus/alertmanager/templates/alertmanager.yml.j2 +++ b/roles/monitoring/prometheus/alertmanager/templates/alertmanager.yml.j2 @@ -1,12 +1,12 @@ # {{ ansible_managed }} global: - smtp_smarthost: '{{ promethues_alertmanager_smtp.smarthost }}' - smtp_from: '{{ promethues_alertmanager_smtp.from }}' - smtp_require_tls: {{ promethues_alertmanager_smtp.require_tls | ternary('true', 'false') }} -{% if 'auth' in promethues_alertmanager_smtp %} - smtp_auth_username: '{{ promethues_alertmanager_smtp.auth.username }}' - smtp_auth_password: '{{ promethues_alertmanager_smtp.auth.password }}' + smtp_smarthost: '{{ prometheus_alertmanager_smtp.smarthost }}' + smtp_from: '{{ prometheus_alertmanager_smtp.from }}' + smtp_require_tls: {{ prometheus_alertmanager_smtp.require_tls | ternary('true', 'false') }} +{% if 'auth' in prometheus_alertmanager_smtp %} + smtp_auth_username: '{{ prometheus_alertmanager_smtp.auth.username }}' + smtp_auth_password: '{{ prometheus_alertmanager_smtp.auth.password }}' {% endif %} route: -- cgit v1.2.3