Skip to content

Commit

Permalink
feat: use kromgo to get k8s and talos versions
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Buhl <[email protected]>
  • Loading branch information
onedr0p committed Mar 22, 2024
1 parent 03a5b8e commit 0891959
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ _... managed with Flux, Renovate, and GitHub Actions_ 🤖
<div align="center">

[![Discord](https://img.shields.io/discord/673534664354430999?style=for-the-badge&label&logo=discord&logoColor=white&color=blue)](https://discord.gg/home-operations)&nbsp;&nbsp;
[![Talos](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fonedr0p%2Fhome-ops%2Fmain%2F.taskfiles%2FTalos%2FTaskfile.yaml&query=%24.vars.TALOS_VERSION&style=for-the-badge&logo=alby&logoColor=white&label=%20)](https://www.talos.dev/)&nbsp;&nbsp;
[![Kubernetes](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fonedr0p%2Fhome-ops%2Fmain%2F.taskfiles%2FTalos%2FTaskfile.yaml&query=%24.vars.KUBERNETES_VERSION&style=for-the-badge&logo=kubernetes&logoColor=white&label=%20)](https://www.talos.dev/)&nbsp;&nbsp;
[![Talos](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.devbu.io%2Fquery%3Fformat%3Dendpoint%26metric%3Dtalos_version&style=for-the-badge&logo=alby&logoColor=white&label=%20)](https://www.talos.dev/)&nbsp;&nbsp;
[![Kubernetes](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.devbu.io%2Fquery%3Fformat%3Dendpoint%26metric%3Dkubernetes_version&style=for-the-badge&logo=kubernetes&logoColor=white&label=%20)](https://www.talos.dev/)&nbsp;&nbsp;
[![Renovate](https://img.shields.io/github/actions/workflow/status/onedr0p/home-ops/renovate.yaml?branch=main&label=&logo=renovatebot&style=for-the-badge&color=blue)](https://github.com/onedr0p/home-ops/actions/workflows/renovate.yaml)

</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/kashalls/kromgo/main/config.schema.json
metrics:
- name: talos_version
query: node_os_info{cluster="main", name="Talos"}
label: version_id

- name: kubernetes_version
query: kubernetes_build_info{cluster="main", service="kubernetes"}
label: git_version

- name: cluster_node_count
query: count(count by (node) (kube_node_status_condition{kubernetes_node=~"k8s-[0-9]", condition="Ready"}))
query: count(count by (node) (kube_node_status_condition{cluster="main", condition="Ready"}))
colors:
- { color: "green", min: 0, max: 9999 }

- name: cluster_pod_count
query: sum(kube_pod_status_phase{kubernetes_node=~"k8s-[0-9]", phase="Running"})
query: sum(kube_pod_status_phase{cluster="main", phase="Running"})
colors:
- { color: "green", min: 0, max: 9999 }

- name: cluster_cpu_usage
query: round(avg(instance:node_cpu_utilisation:rate5m{kubernetes_node=~"k8s-[0-9]"}) * 100, 0.1)
query: round(avg(instance:node_cpu_utilisation:rate5m{cluster="main"}) * 100, 0.1)
suffix: "%"
colors:
- { color: "green", min: 0, max: 35 }
- { color: "orange", min: 36, max: 75 }
- { color: "red", min: 76, max: 9999 }

- name: cluster_memory_usage
query: round(sum(node_memory_MemTotal_bytes{kubernetes_node=~"k8s-[0-9]"} - node_memory_MemAvailable_bytes{kubernetes_node=~"k8s-[0-9]"}) / sum(node_memory_MemTotal_bytes{kubernetes_node=~"k8s-[0-9]"}) * 100, 0.1)
query: round(sum(node_memory_MemTotal_bytes{cluster="main"} - node_memory_MemAvailable_bytes{cluster="main"}) / sum(node_memory_MemTotal_bytes{cluster="main"}) * 100, 0.1)
suffix: "%"
colors:
- { color: green, min: 0, max: 35 }
Expand All @@ -36,15 +44,15 @@ metrics:
- { color: "red", min: 751, max: 9999 }

- name: cluster_age_days
query: round((time() - min(kube_node_created{kubernetes_node=~"k8s-[0-9]"}) ) / 86400)
query: round((time() - min(kube_node_created{cluster="main"}) ) / 86400)
suffix: "d"
colors:
- { color: "green", min: 0, max: 180 }
- { color: "orange", min: 181, max: 360 }
- { color: "red", min: 361, max: 9999 }

- name: cluster_uptime_days
query: round(avg(node_time_seconds{kubernetes_node=~"k8s-[0-9]"} - node_boot_time_seconds{kubernetes_node=~"k8s-[0-9]"}) / 86400)
query: round(avg(node_time_seconds{cluster="main"} - node_boot_time_seconds{cluster="main"}) / 86400)
suffix: "d"
colors:
- { color: "green", min: 0, max: 180 }
Expand Down

0 comments on commit 0891959

Please sign in to comment.