Add Prometheus service
This commit is contained in:
parent
c9cb789708
commit
88371ee4d1
7 changed files with 117 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
# Prometheus Blackbox Expoter
|
||||
# Prometheus Blackbox Exporter
|
||||
|
||||
This playbook can configure [Prometheus Blackbox Exporter](https://github.com/prometheus/blackbox_exporter).
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Prometheus Node Expoter
|
||||
# Prometheus Node Exporter
|
||||
|
||||
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:
|
||||
|
@ -14,8 +15,10 @@ To enable this service, add the following configuration to your `vars.yml` file
|
|||
########################################################################
|
||||
|
||||
prometheus_node_exporter_enabled: true
|
||||
|
||||
prometheus_node_exporter_hostname: mash.example.com
|
||||
prometheus_node_exporter_path_prefix: /metrics/node-exporter
|
||||
|
||||
prometheus_node_exporter_basicauth_user: your_username
|
||||
prometheus_node_exporter_basicauth_password: your password
|
||||
|
||||
|
@ -29,3 +32,5 @@ prometheus_node_exporter_basicauth_password: your password
|
|||
## Usage
|
||||
|
||||
After you installed the node exporter, your node stats will be available on `mash.example.com/metrics/node-exporter` with basic auth credentials you configured
|
||||
|
||||
To integrate Prometheus Node Exporter with a locally installed [Prometheus](prometheus.md) service, see the [Integrating with Prometheus Node Exporter](prometheus.md#integrating-with-prometheus-node-exporter) section of the documentation.
|
||||
|
|
77
docs/services/prometheus.md
Normal file
77
docs/services/prometheus.md
Normal file
|
@ -0,0 +1,77 @@
|
|||
# Prometheus
|
||||
|
||||
[Prometheus](https://prometheus.io/) is a metrics collection and alerting monitoring solution.
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
To enable this service, add the following configuration to your `vars.yml` file and re-run the [installation](../installing.md) process:
|
||||
|
||||
```yaml
|
||||
########################################################################
|
||||
# #
|
||||
# prometheus #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
prometheus_enabled: true
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# /prometheus #
|
||||
# #
|
||||
########################################################################
|
||||
```
|
||||
|
||||
By default, Prometheus is configured to scrape (collect metrics from) its own process. If you wish to disable this behavior, use `prometheus_self_process_scraper_enabled: false`.
|
||||
|
||||
To make Prometheus useful, you'll need to make it scrape one or more hosts by adjusting the configuration.
|
||||
|
||||
|
||||
### Integrating with Prometheus Node Exporter
|
||||
|
||||
If you've installed [Prometheus Node Exporter](prometheus-node-exporter.md) on the same host, you can make Prometheus scrape its metrics with the following **additional configuration**:
|
||||
|
||||
```yaml
|
||||
prometheus_self_node_scraper_enabled: true
|
||||
prometheus_self_node_scraper_static_configs_target: "{{ prometheus_node_exporter_identifier }}:9100"
|
||||
|
||||
# node-exporter runs in another container network, so we need to connect to it.
|
||||
prometheus_container_additional_networks:
|
||||
- "{{ prometheus_node_exporter_container_network }}"
|
||||
```
|
||||
|
||||
To scrape a **remote** Prometheus Node Exporter instance, do not use `prometheus_self_node_scraper_*`, but rather follow the [Scraping any other exporter service](#scraping-any-other-exporter-service) guide below.
|
||||
|
||||
|
||||
### Scraping any other exporter service
|
||||
|
||||
To inject your own scrape configuration, use the `prometheus_config_scrape_configs_additional` variable that's part of the [ansible-role-prometheus](https://github.com/mother-of-all-self-hosting/ansible-role-prometheus) Ansible role.
|
||||
|
||||
Example **additional** configuration:
|
||||
|
||||
```yaml
|
||||
prometheus_config_scrape_configs_additional:
|
||||
- job_name: some_job
|
||||
metrics_path: /metrics
|
||||
scrape_interval: 120s
|
||||
scrape_timeout: 120s
|
||||
static_configs:
|
||||
- targets:
|
||||
- some-host:8080
|
||||
|
||||
- job_name: another_job
|
||||
metrics_path: /metrics
|
||||
scrape_interval: 120s
|
||||
scrape_timeout: 120s
|
||||
static_configs:
|
||||
- targets:
|
||||
- another-host:8080
|
||||
```
|
||||
|
||||
If you're scraping others services running in containers over the container network, make sure the Prometheus container is connected to their own network by adjusting `prometheus_container_additional_networks` as demonstrated above for [Integrating with Prometheus Node Exporter](#integrating-with-prometheus-node-exporter).
|
||||
|
||||
|
||||
## Recommended other services
|
||||
|
||||
You may also wish to look into **Grafana** - soon to be supported by this playbook.
|
|
@ -13,6 +13,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](https://prometheus.io/) | A metrics collection and alerting monitoring solution | [Link](services/prometheus.md) |
|
||||
| [Prometheus Node Exporter](https://github.com/prometheus/node_exporter) | Exporter for machine metrics | [Link](services/prometheus-node-exporter.md) |
|
||||
| [Prometheus Blackbox Exporter](https://github.com/prometheus/blackbox_exporter) | Blackbox probing of HTTP/HTTPS/DNS/TCP/ICMP and gRPC endpoints | [Link](services/prometheus-blackbox-exporter.md) |
|
||||
| [Postgres](https://www.postgresql.org) | A powerful, open source object-relational database system | [Link](services/postgres.md) |
|
||||
|
@ -37,4 +38,3 @@
|
|||
| Name | Description |
|
||||
| ------------------------------ | ------------------------------------- |
|
||||
| [Garage](https://garagehq.deuxfleurs.fr/), by absorbing [garage-docker-ansible-deploy](https://github.com/moan0s/garage-docker-ansible-deploy) | Open-source distributed object storage service tailored for self-hosting |
|
||||
| [Prometheus](https://prometheus.io/)| Monitoring system and time series database |
|
||||
|
|
|
@ -97,6 +97,8 @@ devture_systemd_service_manager_services_list_auto: |
|
|||
+
|
||||
([{'name': (peertube_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'peertube']}] if peertube_enabled else [])
|
||||
+
|
||||
([{'name': (prometheus_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'metrics', 'prometheus']}] if prometheus_enabled else [])
|
||||
+
|
||||
([{'name': (prometheus_blackbox_exporter_identifier + '.service'), 'priority': 500, 'groups': ['mash', 'metrics', 'prometheus-blackbox-exporter']}] if prometheus_blackbox_exporter_enabled else [])
|
||||
+
|
||||
([{'name': (prometheus_node_exporter_identifier + '.service'), 'priority': 500, 'groups': ['mash', 'metrics', 'prometheus-node-exporter']}] if prometheus_node_exporter_enabled else [])
|
||||
|
@ -728,6 +730,29 @@ peertube_systemd_required_services_list: |
|
|||
########################################################################
|
||||
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# prometheus #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
prometheus_enabled: false
|
||||
|
||||
prometheus_identifier: "{{ mash_playbook_service_identifier_prefix }}prometheus"
|
||||
|
||||
prometheus_base_path: "{{ mash_playbook_base_path }}/prometheus"
|
||||
|
||||
prometheus_uid: "{{ mash_playbook_uid }}"
|
||||
prometheus_gid: "{{ mash_playbook_gid }}"
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# /prometheus #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# prometheus_blackbox_exporter #
|
||||
|
@ -764,6 +789,7 @@ prometheus_blackbox_exporter_container_labels_traefik_tls_certResolver: "{{ devt
|
|||
########################################################################
|
||||
|
||||
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# prometheus_node_exporter #
|
||||
|
|
|
@ -108,6 +108,10 @@
|
|||
name: peertube
|
||||
version: v5.0.1-0
|
||||
|
||||
- src: git+https://github.com/mother-of-all-self-hosting/ansible-role-prometheus.git
|
||||
name: prometheus
|
||||
version: v2.42.0-0
|
||||
|
||||
- src: git+https://github.com/mother-of-all-self-hosting/ansible-role-vaultwarden.git
|
||||
name: vaultwarden
|
||||
version: v1.27.0-2
|
||||
|
|
|
@ -70,7 +70,9 @@
|
|||
|
||||
- role: galaxy/peertube
|
||||
|
||||
- role: galaxy/prometheus
|
||||
- role: galaxy/prometheus_node_exporter
|
||||
- role: galaxy/prometheus_blackbox_exporter
|
||||
|
||||
- role: galaxy/radicale
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue