mirror of
https://github.com/rubenhensen/k8scd.git
synced 2026-11-16 22:29:09 +01:00
gatus: also report unhealthy Argo CD apps and CNPG clusters
This commit is contained in:
1 parent
8f1c6a5b6e
commit
389f911823
2 files changed
+40
No files matched your search
@@ -11,6 +11,8 @@
|
|||||||
# younger than 26h (detached volumes are skipped; the recurring job skips
|
# younger than 26h (detached volumes are skipped; the recurring job skips
|
||||||
# them too)
|
# them too)
|
||||||
# - vault-unsealed: all Vault pods report vault-sealed=false
|
# - vault-unsealed: all Vault pods report vault-sealed=false
|
||||||
|
# - argocd-apps: every Argo CD application is Synced and Healthy
|
||||||
|
# - postgres: every CloudNativePG cluster is in a healthy state
|
||||||
#
|
#
|
||||||
# The token is generated by ESO and never leaves the cluster; Gatus reads
|
# The token is generated by ESO and never leaves the cluster; Gatus reads
|
||||||
# it from the same Secret.
|
# it from the same Secret.
|
||||||
@@ -63,6 +65,12 @@ rules:
|
|||||||
- apiGroups: [""]
|
- apiGroups: [""]
|
||||||
resources: ["pods"]
|
resources: ["pods"]
|
||||||
verbs: ["list"]
|
verbs: ["list"]
|
||||||
|
- apiGroups: ["argoproj.io"]
|
||||||
|
resources: ["applications"]
|
||||||
|
verbs: ["list"]
|
||||||
|
- apiGroups: ["postgresql.cnpg.io"]
|
||||||
|
resources: ["clusters"]
|
||||||
|
verbs: ["list"]
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRoleBinding
|
kind: ClusterRoleBinding
|
||||||
@@ -170,6 +178,24 @@ data:
|
|||||||
return f"sealed: {', '.join(sealed)}" if sealed else None
|
return f"sealed: {', '.join(sealed)}" if sealed else None
|
||||||
|
|
||||||
|
|
||||||
|
def argocd():
|
||||||
|
bad = []
|
||||||
|
for a in items("/apis/argoproj.io/v1alpha1/namespaces/argocd/applications"):
|
||||||
|
s = a.get("status", {})
|
||||||
|
sync = s.get("sync", {}).get("status")
|
||||||
|
health = s.get("health", {}).get("status")
|
||||||
|
if sync != "Synced" or health != "Healthy":
|
||||||
|
bad.append(f"{a['metadata']['name']} {sync}/{health}")
|
||||||
|
return "; ".join(bad) or None
|
||||||
|
|
||||||
|
|
||||||
|
def postgres():
|
||||||
|
bad = [f"{c['metadata']['namespace']}/{c['metadata']['name']}: {c.get('status', {}).get('phase')}"
|
||||||
|
for c in items("/apis/postgresql.cnpg.io/v1/clusters")
|
||||||
|
if c.get("status", {}).get("phase") != "Cluster in healthy state"]
|
||||||
|
return "; ".join(bad) or None
|
||||||
|
|
||||||
|
|
||||||
def push(key, error):
|
def push(key, error):
|
||||||
query = {"success": "false" if error else "true"}
|
query = {"success": "false" if error else "true"}
|
||||||
if error:
|
if error:
|
||||||
@@ -185,6 +211,8 @@ data:
|
|||||||
"cluster_velero-weekly": lambda: velero("weekly-backup", 8 * 24 + 2),
|
"cluster_velero-weekly": lambda: velero("weekly-backup", 8 * 24 + 2),
|
||||||
"cluster_longhorn": lambda: longhorn(26),
|
"cluster_longhorn": lambda: longhorn(26),
|
||||||
"cluster_vault-unsealed": vault,
|
"cluster_vault-unsealed": vault,
|
||||||
|
"cluster_argocd-apps": argocd,
|
||||||
|
"cluster_postgres": postgres,
|
||||||
}
|
}
|
||||||
failed_pushes = 0
|
failed_pushes = 0
|
||||||
for key, check in checks.items():
|
for key, check in checks.items():
|
||||||
|
|||||||
@@ -169,3 +169,15 @@ external-endpoints:
|
|||||||
heartbeat:
|
heartbeat:
|
||||||
interval: 3h
|
interval: 3h
|
||||||
alerts: *cluster-alert
|
alerts: *cluster-alert
|
||||||
|
- name: argocd-apps
|
||||||
|
group: cluster
|
||||||
|
token: ${BACKUP_CHECK_TOKEN}
|
||||||
|
heartbeat:
|
||||||
|
interval: 3h
|
||||||
|
alerts: *cluster-alert
|
||||||
|
- name: postgres
|
||||||
|
group: cluster
|
||||||
|
token: ${BACKUP_CHECK_TOKEN}
|
||||||
|
heartbeat:
|
||||||
|
interval: 3h
|
||||||
|
alerts: *cluster-alert
|
||||||
Reference in new issue
Block a user