From cb77b28976220368a88c0f62d1fd4140d9f46481 Mon Sep 17 00:00:00 2001 From: Aine Date: Sat, 18 Mar 2023 00:13:30 +0200 Subject: [PATCH 1/3] Prometheus Node Exporter --- docs/services/prometheus-node-exporter.md | 25 +++++++++++++ docs/supported-services.md | 1 + group_vars/mash_servers | 45 +++++++++++++++++++++++ requirements.yml | 3 ++ setup.yml | 2 + 5 files changed, 76 insertions(+) create mode 100644 docs/services/prometheus-node-exporter.md diff --git a/docs/services/prometheus-node-exporter.md b/docs/services/prometheus-node-exporter.md new file mode 100644 index 0000000..2b2550a --- /dev/null +++ b/docs/services/prometheus-node-exporter.md @@ -0,0 +1,25 @@ +# Prometheus Node Expoter + +This playbook can configure [Prometheus Node Exporter](https://github.com/prometheus/node_exporter). + +## Configuration + +To enable this service, add the following configuration to your `vars.yml` file and re-run the [installation](../installing.md) process: + +```yaml +######################################################################## +# # +# prometheus-node-expoter # +# # +######################################################################## + +prometheus_node_exporter_enabled: true +prometheus_node_exporter_basicauth_user: your_username +prometheus_node_exporter_basicauth_password: your password + +######################################################################## +# # +# /prometheus-node-expoter # +# # +######################################################################## +``` diff --git a/docs/supported-services.md b/docs/supported-services.md index f07bae8..dc80092 100644 --- a/docs/supported-services.md +++ b/docs/supported-services.md @@ -8,6 +8,7 @@ | [Miniflux](https://miniflux.app/) | Minimalist and opinionated feed reader. | [Link](services/miniflux.md) | | [Nextcloud](https://nextcloud.com/) | The most popular self-hosted collaboration solution for tens of millions of users at thousands of organizations across the globe. | [Link](services/nextcloud.md) | | [PeerTube](https://joinpeertube.org/) | A tool for sharing online videos | [Link](services/peertube.md) | +| [Prometheus Node Exporter](https://github.com/prometheus/node_exporter) | Exporter for machine metrics | [Link](services/prometheus-node-exporter.md) | | [Postgres](https://www.postgresql.org) | A powerful, open source object-relational database system | [Link](services/postgres.md) | | [Postgres Backup](https://github.com/prodrigestivill/docker-postgres-backup-local) | A solution for backing up PostgresSQL to local filesystem with periodic backups. | [Link](services/postgres-backup.md) | | [Radicale](https://miniflux.app/) | A Free and Open-Source CalDAV and CardDAV Server (solution for hosting contacts and calendars) | [Link](services/radicale.md) | diff --git a/group_vars/mash_servers b/group_vars/mash_servers index e533118..f386157 100644 --- a/group_vars/mash_servers +++ b/group_vars/mash_servers @@ -12,6 +12,8 @@ devture_systemd_service_manager_services_list_auto: | + ([{'name': (devture_postgres_identifier + '.service'), 'priority': 500, 'groups': ['mash', 'postgres']}] if devture_postgres_enabled else []) + + ([{'name': (prometheus_node_exporter_identifier + '.service'), 'priority': 500, 'groups': ['mash', 'metrics', 'prometheus-node-exporter']}] if prometheus_node_exporter_enabled else []) + + ([{'name': (devture_postgres_backup_identifier + '.service'), 'priority': 5000, 'groups': ['mash', 'backup', 'postgres-backup']}] if devture_postgres_backup_enabled else []) + ([{'name': (devture_container_socket_proxy_identifier + '.service'), 'priority': 2900, 'groups': ['mash', 'reverse-proxies', 'container-socket-proxy']}] if devture_container_socket_proxy_enabled else []) @@ -507,6 +509,49 @@ peertube_systemd_required_services_list: | ######################################################################## +######################################################################## +# # +# prometheus_node_exporter # +# # +######################################################################## + +prometheus_node_exporter_enabled: true +prometheus_node_exporter_uid: "{{ mash_playbook_uid }}" +prometheus_node_exporter_gid: "{{ mash_playbook_gid }}" +prometheus_node_exporter_base_path: "{{ mash_playbook_base_path }}/node-exporter" + +prometheus_node_exporter_basicauth_enabled: true +prometheus_node_exporter_basicauth_user: "{{ '%s' | format(mash_playbook_generic_secret_key) | password_hash('sha512', 'node.user', rounds=655555) | to_uuid }}" +prometheus_node_exporter_basicauth_password: "{{ '%s' | format(mash_playbook_generic_secret_key) | password_hash('sha512', 'node.password', rounds=655555) | to_uuid }}" + +prometheus_node_exporter_container_additional_networks: | + {{ + ([mash_playbook_reverse_proxyable_services_additional_network] if mash_playbook_reverse_proxyable_services_additional_network else []) + }} + +prometheus_node_exporter_container_labels_traefik_enabled: "{{ mash_playbook_traefik_labels_enabled }}" +prometheus_node_exporter_container_labels_traefik_docker_network: "{{ mash_playbook_reverse_proxyable_services_additional_network }}" +prometheus_node_exporter_container_labels_traefik_entrypoints: "{{ devture_traefik_entrypoint_primary }}" +prometheus_node_exporter_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResolver_primary }}" + +prometheus_node_exporter_process_extra_arguments: + - "--collector.disable-defaults" + - "--collector.cpu" + - "--collector.filesystem" + - "--collector.meminfo" + - "--collector.systemd" + - "--collector.uname" +prometheus_node_exporter_container_extra_arguments: + - "--security-opt apparmor=unconfined" + - "--mount type=bind,src=/var/run/dbus/system_bus_socket,dst=/var/run/dbus/system_bus_socket,ro,bind-propagation=rslave" + +######################################################################## +# # +# /prometheus_node_exporter # +# # +######################################################################## + + ######################################################################## # # diff --git a/requirements.yml b/requirements.yml index 7007359..60a8d3f 100644 --- a/requirements.yml +++ b/requirements.yml @@ -54,6 +54,9 @@ - src: git+https://gitlab.com/etke.cc/roles/redis.git version: v7.0.9-0 +- src: git+https://gitlab.com/etke.cc/roles/prometheus_node_exporter.git + version: v1.5.0-3 + - src: git+https://github.com/mother-of-all-self-hosting/ansible-role-vaultwarden.git name: vaultwarden version: v1.27.0-1 diff --git a/setup.yml b/setup.yml index 8e00029..958bd93 100644 --- a/setup.yml +++ b/setup.yml @@ -56,6 +56,8 @@ - role: galaxy/peertube + - role: galaxy/prometheus_node_exporter + - role: galaxy/radicale - role: galaxy/redis From 95cf9dd82f6fa6631baf9f17bec15bdd1cdcdb86 Mon Sep 17 00:00:00 2001 From: Aine <97398200+etkecc@users.noreply.github.com> Date: Sat, 18 Mar 2023 07:46:09 +0000 Subject: [PATCH 2/3] prometheus-node-exporter: Update group_vars/mash_servers Co-authored-by: Slavi Pantaleev --- group_vars/mash_servers | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/group_vars/mash_servers b/group_vars/mash_servers index fc9116b..4df1b2d 100644 --- a/group_vars/mash_servers +++ b/group_vars/mash_servers @@ -526,9 +526,13 @@ peertube_systemd_required_services_list: | ######################################################################## prometheus_node_exporter_enabled: true + +prometheus_node_exporter_identifier: "{{ mash_playbook_service_identifier_prefix }}prometheus-node-exporter" + +prometheus_node_exporter_base_path: "{{ mash_playbook_base_path }}/prometheus-node-exporter" + prometheus_node_exporter_uid: "{{ mash_playbook_uid }}" prometheus_node_exporter_gid: "{{ mash_playbook_gid }}" -prometheus_node_exporter_base_path: "{{ mash_playbook_base_path }}/node-exporter" prometheus_node_exporter_basicauth_enabled: true prometheus_node_exporter_basicauth_user: "{{ '%s' | format(mash_playbook_generic_secret_key) | password_hash('sha512', 'node.user', rounds=655555) | to_uuid }}" From 156360a965e7ed8711ceee8bdcec02ecc0e94a3d Mon Sep 17 00:00:00 2001 From: Aine Date: Sat, 18 Mar 2023 09:46:59 +0200 Subject: [PATCH 3/3] prometheus-node-exporter: disable by default --- group_vars/mash_servers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/group_vars/mash_servers b/group_vars/mash_servers index 4df1b2d..d761f62 100644 --- a/group_vars/mash_servers +++ b/group_vars/mash_servers @@ -525,7 +525,7 @@ peertube_systemd_required_services_list: | # # ######################################################################## -prometheus_node_exporter_enabled: true +prometheus_node_exporter_enabled: false prometheus_node_exporter_identifier: "{{ mash_playbook_service_identifier_prefix }}prometheus-node-exporter"