From 4750aa10526d9ffdbdd61a7b95f6ce0afb6918b9 Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 11 Nov 2024 09:38:35 +0100 Subject: [PATCH] feat(metrics): :sparkles: Add new electric eel systemd metrics (#66) * feat(metrics): :sparkles: add systemd service metrics * docs: :memo: update readme with supported versions and add help wanted --- METRICS.md | 8 +++++++ README.md | 14 +++++------ graphite_mapping.conf | 56 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 8 deletions(-) diff --git a/METRICS.md b/METRICS.md index c488ef8..b69aa06 100644 --- a/METRICS.md +++ b/METRICS.md @@ -138,3 +138,11 @@ Both memeory statistics from TrueNAS are exported on the onside the physical mem |`k3s_pod_mem`|`pod` the pod name|`bytes`|The number of bytes of memory this pod is using.| |`k3s_pod_net`||`bytes`|The number of bytes in/out of the pod over the network interface.| +## systemd services + +|Metric name|Labels|Unit|Description| +|-----------|------|----|-----------| +|`services_cpu`|`service` name of systemd service|`percent`|Percent of cpu usage per service. 100% = 1 core| +|`services_iops`||`ops/s`|Number of operations on I/O.| +|`services_io`||`kilobits/s`|I/O amount per service.| +|`services_mem`|`service` name of systemd service|`MiB`|Memory usage per service.| \ No newline at end of file diff --git a/README.md b/README.md index 4048035..ce9edf3 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ The goal of this small repository is to provide you with a new `graphite_mapping * [graphite_exporter](https://github.com/prometheus/graphite_exporter) * [grafana](https://github.com/grafana/grafana) -* [TrueNAS Scale 23.10](https://www.truenas.com/truenas-scale/) +* [TrueNAS Scale 24.10](https://www.truenas.com/truenas-scale/) ## Roadmap @@ -50,20 +50,18 @@ The goal of this small repository is to provide you with a new `graphite_mapping - [x] Multiple dashboards with pictures - [x] Convert all metrics to prometheus metrics without catch all rules - [x] Unify all metrics to a similar schema +- [ ] Add UPS metrics (Help wanted!) -See the [open issues]([https://github.com/github_username/repo_name](https://github.com/Supporterino/truenas-graphite-to-prometheus)/issues) for a full list of proposed features (and known issues). +See the [open issues](https://github.com/Supporterino/truenas-graphite-to-prometheus/issues) for a full list of proposed features (and known issues). ## Supported Versions Those are the supported and tested versions of TrueNAS in combination with this exporter. Feel free to create a PR with a tested flag if you use a version not mentioned here. |TrueNAS Version|Supported|Tested| |---------------|---------|------| -|23.10.0|:grey_question: (should work)|:x:| -|23.10.1|:white_check_mark:|:white_check_mark: by [@Supporterino](https://www.github.com/Supporterino)| -|23.10.2|:white_check_mark:|:white_check_mark: by [@Supporterino](https://www.github.com/Supporterino)| -|24.04.0|:white_check_mark:|:white_check_mark: by [@Supporterino](https://www.github.com/Supporterino)| -|24.04.1|:white_check_mark:|:white_check_mark: by [@Supporterino](https://www.github.com/Supporterino)| -|24.04.2|:white_check_mark:|:white_check_mark: by [@Supporterino](https://www.github.com/Supporterino)| +|23.10.x|:white_check_mark:|:white_check_mark: by [@Supporterino](https://www.github.com/Supporterino)| +|24.04.x|:white_check_mark:|:white_check_mark: by [@Supporterino](https://www.github.com/Supporterino)| +|24.10.x|:white_check_mark:|:white_check_mark: by [@Supporterino](https://www.github.com/Supporterino)| diff --git a/graphite_mapping.conf b/graphite_mapping.conf index 34f0cae..1e3539f 100644 --- a/graphite_mapping.conf +++ b/graphite_mapping.conf @@ -28,6 +28,62 @@ mappings: instance: "${1}" kind: "${2}" +################################################ +# service mapping +################################################ + +- match: 'truenas\.(.*)\.services\.cpu\.(.*)' + match_type: "regex" + name: "services_cpu" + labels: + job: "truenas" + instance: "${1}" + service: "${2}" + +- match: 'truenas\.(.*)\.services\.io_ops_read\.(.*)' + match_type: "regex" + name: "services_iops" + labels: + job: "truenas" + instance: "${1}" + op: "read" + service: "${2}" + +- match: 'truenas\.(.*)\.services\.io_ops_write\.(.*)' + match_type: "regex" + name: "services_iops" + labels: + job: "truenas" + instance: "${1}" + op: "write" + service: "${2}" + +- match: 'truenas\.(.*)\.services\.io_read\.(.*)' + match_type: "regex" + name: "services_io" + labels: + job: "truenas" + instance: "${1}" + op: "read" + service: "${2}" + +- match: 'truenas\.(.*)\.services\.io_write\.(.*)' + match_type: "regex" + name: "services_io" + labels: + job: "truenas" + instance: "${1}" + op: "write" + service: "${2}" + +- match: 'truenas\.(.*)\.services\.mem_usage\.(.*)' + match_type: "regex" + name: "services_mem" + labels: + job: "truenas" + instance: "${1}" + service: "${2}" + ################################################ # disk smart metrics ################################################