Skip to content

Commit

Permalink
feat(metrics): ✨ add systemd service metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Supporterino committed Nov 11, 2024
1 parent 9c2027d commit f77fe1a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 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.|
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 f77fe1a

Please sign in to comment.