Skip to content

Commit

Permalink
feat(metrics): ✨ Add new electric eel systemd metrics (#66)
Browse files Browse the repository at this point in the history
* feat(metrics): ✨ add systemd service metrics

* docs: 📝 update readme with supported versions and add help wanted
  • Loading branch information
Supporterino authored Nov 11, 2024
1 parent 9c2027d commit 4750aa1
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 8 deletions.
8 changes: 8 additions & 0 deletions METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`|<ul><li>`pod` the pod name</li><li>`direction` the direction of network traffic</li></ul>|`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`|<ul><li>`service` name of systemd service</li><li>`op` kind of operation</li></ul>|`ops/s`|Number of operations on I/O.|
|`services_io`|<ul><li>`service` name of systemd service</li><li>`op` kind of operation</li></ul>|`kilobits/s`|I/O amount per service.|
|`services_mem`|`service` name of systemd service|`MiB`|Memory usage per service.|
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->
## Roadmap
Expand All @@ -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 -->
## 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)|


<!-- GETTING STARTED -->
Expand Down
56 changes: 56 additions & 0 deletions graphite_mapping.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
################################################
Expand Down

0 comments on commit 4750aa1

Please sign in to comment.