Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added k3s metrics mappings for apps #57

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

Reanmachine
Copy link
Contributor

This change adds mappings to the graphite exporter configuration file that map the k3s metrics into unified prometheus metrics. When running apps in TrueNAS scale the pods are exported by the metrics exporter and can be captured here to get some basic operational details.

❗ The metrics exported are not documented in TrueNAS or k3s in this format, and this poses a problem making sense of the cpu metric.

I've been able to identify that these numbers go up/down in the 100,000 -> 10,000,000 range for a mostly idle system. I suspect they're something like CPU time in... nanoseconds? over some period. I will admit I'm not an expert at system metrics to make a better educated guess.

Example Metrics:

# HELP k3s_pod_cpu Graphite metric k3s_pod_cpu
# TYPE k3s_pod_cpu gauge
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="coredns_59b4f5bbd5_smzb4"} 3.9131e+06
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="csi_nfs_controller_7b74694749_qmcw2"} 2.218731e+06
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="csi_nfs_node_6mn5r"} 3.302392e+06
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="csi_smb_controller_7fbbb8fb6f_n9jrw"} 1.49449e+06
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="csi_smb_node_kf5n9"} 3.265436e+06
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="immich_669bb67c8c_nj976"} 3.869711e+06
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="immich_machinelearning_84588c7fc6_7b7ml"} 2.128128e+06
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="immich_postgres_85744f8847_5sznp"} 1.51312678e+07
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="immich_redis_7978c8949b_7rm9f"} 8.875293e+06
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="jellyfin_8466dbcb4c_gckln"} 744292
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="snapshot_controller_546868dfb4_5rz6q"} 287387
k3s_pod_cpu{instance="nas.home.internal",job="truenas",pod="snapshot_controller_546868dfb4_w6lcn"} 890650
# HELP k3s_pod_mem Graphite metric k3s_pod_mem
# TYPE k3s_pod_mem gauge
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="coredns_59b4f5bbd5_smzb4"} 2.451046e+07
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="csi_nfs_controller_7b74694749_qmcw2"} 8.239514e+07
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="csi_nfs_node_6mn5r"} 4.755456e+07
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="csi_smb_controller_7fbbb8fb6f_n9jrw"} 6.168986e+07
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="csi_smb_node_kf5n9"} 5.264589e+07
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="immich_669bb67c8c_nj976"} 5.581537e+08
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="immich_machinelearning_84588c7fc6_7b7ml"} 3.181404e+08
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="immich_postgres_85744f8847_5sznp"} 1.0461184e+07
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="immich_redis_7978c8949b_7rm9f"} 1.4426112e+07
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="jellyfin_8466dbcb4c_gckln"} 1.6529162e+09
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="snapshot_controller_546868dfb4_5rz6q"} 1.501184e+07
k3s_pod_mem{instance="nas.home.internal",job="truenas",pod="snapshot_controller_546868dfb4_w6lcn"} 1.71991e+07
# HELP k3s_pod_net Graphite metric k3s_pod_net
# TYPE k3s_pod_net gauge
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="coredns_59b4f5bbd5_smzb4"} 1.8815954e+08
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="csi_nfs_controller_7b74694749_qmcw2"} 7.620715e+09
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="csi_nfs_node_6mn5r"} 7.620722e+09
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="csi_smb_controller_7fbbb8fb6f_n9jrw"} 7.6207292e+09
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="csi_smb_node_kf5n9"} 7.620737e+09
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="immich_669bb67c8c_nj976"} 2.031233e+10
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="immich_machinelearning_84588c7fc6_7b7ml"} 3.014143e+09
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="immich_postgres_85744f8847_5sznp"} 3.806235e+08
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="immich_redis_7978c8949b_7rm9f"} 1.7458264e+09
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="jellyfin_8466dbcb4c_gckln"} 3.765717e+09
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="snapshot_controller_546868dfb4_5rz6q"} 8.384338e+07
k3s_pod_net{direction="incoming",instance="nas.home.internal",job="truenas",pod="snapshot_controller_546868dfb4_w6lcn"} 2.992192e+08
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="coredns_59b4f5bbd5_smzb4"} 1.9213308e+08
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="csi_nfs_controller_7b74694749_qmcw2"} 5.014854e+10
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="csi_nfs_node_6mn5r"} 5.014855e+10
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="csi_smb_controller_7fbbb8fb6f_n9jrw"} 5.0148552e+10
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="csi_smb_node_kf5n9"} 5.014856e+10
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="immich_669bb67c8c_nj976"} 4.389022e+09
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="immich_machinelearning_84588c7fc6_7b7ml"} 5.656709e+07
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="immich_postgres_85744f8847_5sznp"} 2.005117e+08
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="immich_redis_7978c8949b_7rm9f"} 6.8871598e+08
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="jellyfin_8466dbcb4c_gckln"} 1.0370508e+09
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="snapshot_controller_546868dfb4_5rz6q"} 1.5547909e+07
k3s_pod_net{direction="outgoing",instance="nas.home.internal",job="truenas",pod="snapshot_controller_546868dfb4_w6lcn"} 1.692172e+08

This change adds mappings to the graphite exporter configuration file that
map the k3s metrics into unified prometheus metrics. When running apps in
TrueNAS scale the pods are exported by the metrics exporter and can be
captured here to get some basic operational details.

The metrics exported are not documented in TrueNAS or k3s in this format, and
this poses a problem making sense of the `cpu` metric.
Copy link
Owner

@Supporterino Supporterino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be adjusted later once ms/ns is determined

@Supporterino Supporterino merged commit 4577d9f into Supporterino:main Sep 25, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants