feat: scrape Jeannie API metrics from Prometheus
This commit is contained in:
parent
dd89e19e37
commit
c54630685a
|
|
@ -1965,7 +1965,7 @@ resource "helm_release" "prometheus_stack" {
|
|||
prometheusSpec = {
|
||||
nodeSelector = local.prometheus_stack_node_selector
|
||||
retention = var.observability.prometheus.retention
|
||||
additionalScrapeConfigs = yamlencode([
|
||||
additionalScrapeConfigs = yamlencode(concat([
|
||||
{
|
||||
job_name = "rpi-node"
|
||||
static_configs = [
|
||||
|
|
@ -2042,7 +2042,21 @@ resource "helm_release" "prometheus_stack" {
|
|||
}
|
||||
]
|
||||
}
|
||||
])
|
||||
], var.jeannie_api_metrics_token == "" ? [] : [{
|
||||
job_name = "jeannie-api"
|
||||
metrics_path = "/metrics"
|
||||
scheme = "https"
|
||||
static_configs = [{
|
||||
targets = [var.jeannie_api_metrics_target]
|
||||
labels = {
|
||||
host_group = "automation"
|
||||
}
|
||||
}]
|
||||
authorization = {
|
||||
type = "Bearer"
|
||||
credentials = var.jeannie_api_metrics_token
|
||||
}
|
||||
}]))
|
||||
resources = {
|
||||
requests = {
|
||||
cpu = "100m"
|
||||
|
|
|
|||
|
|
@ -254,6 +254,19 @@ variable "jeannie_self_heal_endpoint" {
|
|||
default = "192.168.100.73:18081"
|
||||
}
|
||||
|
||||
variable "jeannie_api_metrics_target" {
|
||||
description = "Host:port scraped by the in-cluster Prometheus for the Debian-hosted Jeannie API metrics endpoint."
|
||||
type = string
|
||||
default = "api.lab2025.duckdns.org:443"
|
||||
}
|
||||
|
||||
variable "jeannie_api_metrics_token" {
|
||||
description = "Bearer token used by Prometheus to scrape the authenticated Jeannie API metrics endpoint."
|
||||
type = string
|
||||
sensitive = true
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "prometheus_stack_node_selector" {
|
||||
description = "Node selector applied to kube-prometheus-stack control workloads so they stay off the control plane."
|
||||
type = map(string)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ The authenticated `GET /metrics` endpoint exposes Prometheus-compatible HTTP
|
|||
request counters, request duration totals, and authentication-failure counts.
|
||||
It is served by the Debian API process, so metrics remain available while
|
||||
Kubernetes is stopped; Prometheus may scrape it when the cluster is healthy.
|
||||
Run the platform pipeline with `JEANNIE_SERVER_TOKEN` set to enable the
|
||||
authenticated `jeannie-api` scrape job in kube-prometheus-stack.
|
||||
|
||||
## Edge API gateway
|
||||
|
||||
|
|
|
|||
|
|
@ -266,6 +266,8 @@ export_homelab_inventory_tf_vars() {
|
|||
export_if_unset TF_VAR_edge_install_dir "${LAB_EDGE_INSTALL_DIR:-}"
|
||||
export_if_unset TF_VAR_server_name "${LAB_DOMAIN:-}"
|
||||
export_if_unset TF_VAR_additional_server_names "${LAB_ADDITIONAL_SERVER_NAMES_JSON:-}"
|
||||
export_if_unset TF_VAR_jeannie_api_metrics_target "${LAB_JEANNIE_API_METRICS_TARGET:-api.${LAB_DOMAIN:-lab2025.duckdns.org}:443}"
|
||||
export_if_unset TF_VAR_jeannie_api_metrics_token "${JEANNIE_SERVER_TOKEN:-${JEANNIE_REMOTE_TOKEN:-}}"
|
||||
export_if_unset TF_VAR_backend_host "${LAB_TRAEFIK_LB_IP:-}"
|
||||
export_if_unset TF_VAR_gitea_backend_host "${LAB_GITEA_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}"
|
||||
export_if_unset TF_VAR_gitea_backend_port "${LAB_GITEA_HTTP_PORT:-}"
|
||||
|
|
|
|||
|
|
@ -227,6 +227,8 @@ export_homelab_inventory_tf_vars() {
|
|||
export_if_unset TF_VAR_edge_install_dir "${LAB_EDGE_INSTALL_DIR:-}"
|
||||
export_if_unset TF_VAR_server_name "${LAB_DOMAIN:-}"
|
||||
export_if_unset TF_VAR_additional_server_names "${LAB_ADDITIONAL_SERVER_NAMES_JSON:-}"
|
||||
export_if_unset TF_VAR_jeannie_api_metrics_target "${LAB_JEANNIE_API_METRICS_TARGET:-api.${LAB_DOMAIN:-lab2025.duckdns.org}:443}"
|
||||
export_if_unset TF_VAR_jeannie_api_metrics_token "${JEANNIE_SERVER_TOKEN:-${JEANNIE_REMOTE_TOKEN:-}}"
|
||||
export_if_unset TF_VAR_backend_host "${LAB_TRAEFIK_LB_IP:-}"
|
||||
export_if_unset TF_VAR_gitea_backend_host "${LAB_DEBIAN_TAILSCALE_IP:-}"
|
||||
export_if_unset TF_VAR_gitea_backend_port "${LAB_GITEA_HTTP_PORT:-}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue