Skip to content

feat: alert on log and telemetry failures - #4891

Merged
damacus merged 3 commits into
mainfrom
codex/independent-log-alerts
Nov 24, 2026
Merged

damacus merged 3 commits into
mainfrom
codex/independent-log-alerts

Conversation

@damacus

@damacus damacus commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Adds warnings for repeated Forgejo mirror failures, sustained CloudNativePG metrics collection errors and unavailable UniFi telemetry. The existing paused Grafana radio rules remain unchanged.

The existing log collection pipeline gap is documented: Vector has no ServiceMonitor and the Loki canary is disabled. RustFS recovery events need further investigation before choosing an alert threshold.

The Loki queries were exercised against synthetic logs on Docker Desktop and matched recent live failure patterns. Prometheus rule fixtures cover fresh, stale and missing UniFi telemetry; routing was checked with inert receivers. End-to-end notification delivery remains to be verified after deployment.


Devin Review

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
@@ data.home-ops.yaml @@
# v1/ConfigMap/monitoring/loki-alert-rules
! ± value change in multiline text (one insert, no deletions)
  groups:
    - name: home-ops-log-failures
      interval: 1m
      rules:
+       - alert: ForgejoMirrorRepeatedFailures
+         expr: |
+           sum by (namespace, app) (
+             count_over_time(
+               {app="forgejo"}
+               |= "SyncMirrors"
+               |~ "failed to update mirror repository( wiki)?:"
+               [30m]
+             )
+           ) >= 3
+         for: 5m
+         labels:
+           severity: warning
+           alertgroup: home-ops-logs
+         annotations:
+           summary: "Forgejo repeatedly failed to update repository mirrors"
+           description: "At least three mirror fetch failures occurred in thirty minutes and the condition persisted for five minutes. Check Forgejo logs for the affected mirrors and verify upstream access."
+       - alert: CloudNativePGMetricsCollectionFailing
+         expr: |
+           sum by (namespace, app, pod) (
+             count_over_time(
+               {app="postgresql"}
+               |= "Error collecting user query"
+               [5m]
+             )
+           ) >= 3
+         for: 10m
+         labels:
+           severity: warning
+           alertgroup: home-ops-logs
+         annotations:
+           summary: "CloudNativePG metrics collection is failing on {{ $labels.pod }}"
+           description: "At least three user query collection errors per five-minute window persisted for ten minutes. Check the exporter logs and monitoring query permissions for this instance."
        - alert: FrigateCameraRepeatedFailures
          expr: |
            sum by (namespace, app, camera) (
              count_over_time(
  
  [39 lines unchanged)]
  
            alertgroup: home-ops-logs
          annotations:
            summary: "{{ $labels.app }} reported a storage failure on {{ $labels.node }}"
            description: "An application reported a full, read-only or failing filesystem in the last ten minutes. Check its volume, node storage and recent writes."

@@ spec.values.controllers.app.replicas @@
# helm.toolkit.fluxcd.io/v2/HelmRelease/network/unifi-release-announcer
! ± value change
- 0
+ 1

@@ spec.groups @@
# monitoring.coreos.com/v1/PrometheusRule/monitoring/miscellaneous-rules
! + one list entry added:
+ - name: default-namespace
+   rules:
+   - alert: DefaultNamespacePodPresent
+     annotations:
+       description: "A pod has existed in the default namespace for five minutes. Check whether a workload was deployed without its intended namespace."
+       summary: "Pod {{ $labels.pod }} is in the default namespace"
+     expr: "count by (namespace, pod) (kube_pod_info{namespace=\"default\"}) > 0"
+     for: 5m
+     labels:
+       severity: warning
+   - alert: DefaultNamespacePersistentVolumeClaimPresent
+     annotations:
+       description: "A persistent volume claim has existed in the default namespace for five minutes. Identify its owner and data before moving or removing it."
+       summary: "Persistent volume claim {{ $labels.persistentvolumeclaim }} is in the default namespace"
+     expr: "count by (namespace, persistentvolumeclaim) (kube_persistentvolumeclaim_info{namespace=\"default\"}) > 0"
+     for: 5m
+     labels:
+       severity: warning

@@ spec.replicas @@
# apps/v1/Deployment/network/unifi-release-announcer
! ± value change
- 0
+ 1

@@ (root level) @@
# kustomize.toolkit.fluxcd.io/v1/Kustomization/flux-system/unifi-release-announcer
! - one document removed:
- apiVersion: kustomize.toolkit.fluxcd.io/v1
- kind: Kustomization
- metadata:
-   name: unifi-release-announcer
-   namespace: flux-system
-   labels:
-     kustomize.toolkit.fluxcd.io/name: cluster-apps
-     kustomize.toolkit.fluxcd.io/namespace: flux-system
- spec:
-   decryption:
-     provider: sops
-     secretRef:
-       name: sops-age
-   interval: 30m
-   path: ./kubernetes/apps/default/unifi-release-announcer/app
-   postBuild:
-     substituteFrom:
-     - name: cluster-settings
-       kind: ConfigMap
-       optional: true
-   prune: true
-   retryInterval: 1m
-   sourceRef:
-     name: home-kubernetes
-     kind: GitRepository
-   targetNamespace: default
-   timeout: 5m
-   wait: true

@@ (root level) @@
# helm.toolkit.fluxcd.io/v2/HelmRelease/default/unifi-release-announcer
! - one document removed:
- apiVersion: helm.toolkit.fluxcd.io/v2
- kind: HelmRelease
- metadata:
-   name: unifi-release-announcer
-   namespace: default
-   labels:
-     kustomize.toolkit.fluxcd.io/name: unifi-release-announcer
-     kustomize.toolkit.fluxcd.io/namespace: flux-system
- spec:
-   chart:
-     spec:
-       version: "5.3.0"
-       chart: app-template
-       sourceRef:
-         name: bjw-s
-         kind: HelmRepository
-         namespace: flux-system
-   install:
-     remediation:
-       retries: 3
-   interval: 30m
-   uninstall:
-     keepHistory: false
-   upgrade:
-     cleanupOnFail: true
-     remediation:
-       retries: 3
-       strategy: uninstall
-   values:
-     controllers:
-       app:
-         containers:
-           app:
-             resources:
-               limits:
-                 cpu: 1000m
-                 memory: 100M
-               requests:
-                 cpu: 10m
-                 memory: 32Mi
-             image:
-               repository: ghcr.io/damacus/unifi-release-announcer
-               tag: "0.3.0@sha256:71397b18bc253a4132b873fe30b42fc9e3ab5b294e2beb66a8cc5d9dd2eaf81e"
-             securityContext:
-               allowPrivilegeEscalation: false
-               capabilities:
-                 drop:
-                 - ALL
-               readOnlyRootFilesystem: true
-               runAsGroup: 1000
-               runAsNonRoot: true
-               runAsUser: 1000
-               seccompProfile:
-                 type: RuntimeDefault
-             env:
-             - name: TAGS
-               value: "unifi-drive,unifi-network,unifi-protect"
-             - name: DISCORD_BOT_TOKEN
-               valueFrom:
-                 secretKeyRef:
-                   name: unifi-release-announcer
-                   key: DISCORD_BOT_TOKEN
-             - name: DISCORD_CHANNEL_ID
-               valueFrom:
-                 secretKeyRef:
-                   name: unifi-release-announcer
-                   key: DISCORD_CHANNEL_ID
-         replicas: 1
-         strategy: Recreate
-     defaultPodOptions:
-       automountServiceAccountToken: false
-       imagePullSecrets:
-       - name: ghcr-credentials
-       terminationGracePeriodSeconds: 35
-     persistence:
-       cache:
-         accessMode: ReadWriteOnce
-         globalMounts:
-         - path: /cache
-         size: 10m

@@ (root level) @@
# external-secrets.io/v1/ExternalSecret/default/unifi-release-announcer
! - one document removed:
- apiVersion: external-secrets.io/v1
- kind: ExternalSecret
- metadata:
-   name: unifi-release-announcer
-   namespace: default
-   labels:
-     kustomize.toolkit.fluxcd.io/name: unifi-release-announcer
-     kustomize.toolkit.fluxcd.io/namespace: flux-system
- spec:
-   data:
-   - remoteRef:
-       key: unifi-release-announcer
-       property: DISCORD_BOT_TOKEN
-     secretKey: DISCORD_BOT_TOKEN
-   - remoteRef:
-       key: unifi-release-announcer
-       property: DISCORD_CHANNEL_ID
-     secretKey: DISCORD_CHANNEL_ID
-   secretStoreRef:
-     name: onepassword-connect
-     kind: ClusterSecretStore
-   target:
-     name: unifi-release-announcer
-     template:
-       engineVersion: v2

@@ (root level) @@
# v1/ServiceAccount/default/unifi-release-announcer
! - one document removed:
- apiVersion: v1
- kind: ServiceAccount
- metadata:
-   name: unifi-release-announcer
-   namespace: default
-   labels:
-     app.kubernetes.io/instance: unifi-release-announcer
-     app.kubernetes.io/managed-by: Helm
-     app.kubernetes.io/name: unifi-release-announcer
-     helm.toolkit.fluxcd.io/name: unifi-release-announcer
-     helm.toolkit.fluxcd.io/namespace: default

@@ (root level) @@
# v1/PersistentVolumeClaim/default/unifi-release-announcer
! - one document removed:
- apiVersion: v1
- kind: PersistentVolumeClaim
- metadata:
-   name: unifi-release-announcer
-   namespace: default
-   labels:
-     app.kubernetes.io/instance: unifi-release-announcer
-     app.kubernetes.io/managed-by: Helm
-     app.kubernetes.io/name: unifi-release-announcer
-     helm.toolkit.fluxcd.io/name: unifi-release-announcer
-     helm.toolkit.fluxcd.io/namespace: default
- spec:
-   resources:
-     requests:
-       storage: 10m
-   accessModes:
-   - ReadWriteOnce

@@ (root level) @@
# apps/v1/Deployment/default/unifi-release-announcer
! - one document removed:
- apiVersion: apps/v1
- kind: Deployment
- metadata:
-   name: unifi-release-announcer
-   namespace: default
-   labels:
-     app.kubernetes.io/controller: app
-     app.kubernetes.io/instance: unifi-release-announcer
-     app.kubernetes.io/managed-by: Helm
-     app.kubernetes.io/name: unifi-release-announcer
-     helm.toolkit.fluxcd.io/name: unifi-release-announcer
-     helm.toolkit.fluxcd.io/namespace: default
- spec:
-   replicas: 1
-   revisionHistoryLimit: 3
-   selector:
-     matchLabels:
-       app.kubernetes.io/controller: app
-       app.kubernetes.io/instance: unifi-release-announcer
-       app.kubernetes.io/name: unifi-release-announcer
-   strategy:
-     type: Recreate
-   template:
-     metadata:
-       labels:
-         app.kubernetes.io/controller: app
-         app.kubernetes.io/instance: unifi-release-announcer
-         app.kubernetes.io/name: unifi-release-announcer
-     spec:
-       automountServiceAccountToken: false
-       containers:
-       - name: app
-         image: "ghcr.io/damacus/unifi-release-announcer:0.3.0@sha256:71397b18bc253a4132b873fe30b42fc9e3ab5b294e2beb66a8cc5d9dd2eaf81e"
-         resources:
-           limits:
-             cpu: 1000m
-             memory: 100M
-           requests:
-             cpu: 10m
-             memory: 32Mi
-         volumeMounts:
-         - name: cache
-           mountPath: /cache
-         securityContext:
-           allowPrivilegeEscalation: false
-           capabilities:
-             drop:
-             - ALL
-           readOnlyRootFilesystem: true
-           runAsGroup: 1000
-           runAsNonRoot: true
-           runAsUser: 1000
-           seccompProfile:
-             type: RuntimeDefault
-         env:
-         - name: TAGS
-           value: "unifi-drive,unifi-network,unifi-protect"
-         - name: DISCORD_BOT_TOKEN
-           valueFrom:
-             secretKeyRef:
-               name: unifi-release-announcer
-               key: DISCORD_BOT_TOKEN
-         - name: DISCORD_CHANNEL_ID
-           valueFrom:
-             secretKeyRef:
-               name: unifi-release-announcer
-               key: DISCORD_CHANNEL_ID
-       dnsPolicy: ClusterFirst
-       enableServiceLinks: false
-       hostIPC: false
-       hostNetwork: false
-       hostPID: false
-       imagePullSecrets:
-       - name: ghcr-credentials
-       serviceAccountName: unifi-release-announcer
-       terminationGracePeriodSeconds: 35
-       volumes:
-       - name: cache
-         persistentVolumeClaim:
-           claimName: unifi-release-announcer

@@ (root level) @@
# monitoring.coreos.com/v1/PrometheusRule/monitoring/unpoller
! + one document added:
+ apiVersion: monitoring.coreos.com/v1
+ kind: PrometheusRule
+ metadata:
+   name: unpoller
+   namespace: monitoring
+   labels:
+     app.kubernetes.io/name: unpoller
+     kustomize.toolkit.fluxcd.io/name: unpoller
+     kustomize.toolkit.fluxcd.io/namespace: flux-system
+ spec:
+   groups:
+   - name: unpoller
+     rules:
+     - alert: UnpollerCollectionUnavailable
+       annotations:
+         description: "No UnPoller target has reported a successful scrape, fresh controller cache and radio metrics for five minutes. Check the exporter, controller connectivity and API credentials."
+         summary: "UnPoller has no fresh UniFi radio telemetry"
+       expr: |
+         absent(
+           (up{job="unpoller"} == 1)
+           and on (job, instance) (
+             (unpoller_prometheus_cache_age_seconds{job="unpoller"} >= 0)
+             and (unpoller_prometheus_cache_age_seconds{job="unpoller"} < 90)
+           )
+           and on (job, instance) unpoller_device_radio_channel_utilization_total_ratio{job="unpoller"}
+         )
+         
+       for: 5m
+       labels:
+         severity: warning

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 3 potential issues.

Devin Review

@damacus
damacus merged commit 71f90c5 into main Nov 24, 2026
16 checks passed
@damacus
damacus deleted the codex/independent-log-alerts branch November 24, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant