summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-01-15 14:12:32 +0200
committerPaul Buetow <paul@buetow.org>2026-01-15 14:12:32 +0200
commitbcb4bbb3214e106255756c63f9a9f2a16c685444 (patch)
tree16261f08fd9201cd1d6b1bd65cbe6d57f97d0a26
parent11f4b5dfd3607106496c9d81693dd00988f3e3fc (diff)
fix
-rw-r--r--AGENTS.md2
-rw-r--r--Magefile.go9
-rw-r--r--gogios.json1
-rw-r--r--internal/html.go21
-rw-r--r--report.txt19
5 files changed, 32 insertions, 20 deletions
diff --git a/AGENTS.md b/AGENTS.md
index e1f37fe..c60e0ac 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -73,3 +73,5 @@ Run tests before committing changes.
For best practices also follow ~/git/conf/snippets/go/go-projects/go-projects.md if present.
For deployment and testing procedures, see ~/Notes/snippets/go-projects/gogios-deploy-and-test.md
+
+For alert troubleshooting and common issues, see ~/Notes/snippets/go-projects/gogios-troubleshoot-alert.md
diff --git a/Magefile.go b/Magefile.go
index dc7d90b..03cbd97 100644
--- a/Magefile.go
+++ b/Magefile.go
@@ -83,13 +83,10 @@ func Openbsd() error {
// BuildOpenbsd builds the gogios binary for OpenBSD.
func BuildOpenbsd() error {
fmt.Println("Building for OpenBSD...")
- if err := os.Setenv("GOOS", "openbsd"); err != nil {
- return err
- }
- if err := os.Setenv("GOARCH", "amd64"); err != nil {
- return err
- }
+ env := os.Environ()
+ env = append(env, "GOOS=openbsd", "GOARCH=amd64")
cmd := exec.Command("go", "build", "-o", "gogios", "cmd/gogios/main.go")
+ cmd.Env = env
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
diff --git a/gogios.json b/gogios.json
index 12f13aa..70d024b 100644
--- a/gogios.json
+++ b/gogios.json
@@ -1,6 +1,7 @@
{
"EmailTo": "paul",
"EmailFrom": "gogios@buetow.org",
+ "HTMLStatusFile": "./status.html",
"CheckTimeoutS": 10,
"CheckConcurrency": 2,
"Checks": {
diff --git a/internal/html.go b/internal/html.go
index 02c9c49..1c8626a 100644
--- a/internal/html.go
+++ b/internal/html.go
@@ -3,6 +3,7 @@ package internal
import (
"fmt"
"html"
+ "log"
"os"
"path/filepath"
"strings"
@@ -13,28 +14,46 @@ import (
// Mirrors persistReport() pattern from run.go with atomic write.
func persistHTMLReport(state state, subject string, conf config) error {
htmlFile := conf.HTMLStatusFile
+ if htmlFile == "" {
+ log.Println("debug: HTMLStatusFile is empty, skipping HTML report generation")
+ return nil
+ }
+
+ log.Println("debug: HTMLStatusFile set to", htmlFile)
htmlDir := filepath.Dir(htmlFile)
// Auto-create directory if it doesn't exist
// CLAUDE: Only create it when it doesnt exist yet
if err := os.MkdirAll(htmlDir, 0o755); err != nil {
+ log.Println("debug: error creating directory:", err)
return fmt.Errorf("failed to create directory %s: %w", htmlDir, err)
}
+ log.Println("debug: directory ensured at", htmlDir)
tmpFile := htmlFile + ".tmp"
+ log.Println("debug: writing to temp file", tmpFile)
f, err := os.Create(tmpFile)
if err != nil {
+ log.Println("debug: error creating temp file:", err)
return fmt.Errorf("failed to create temp file: %w", err)
}
defer f.Close()
htmlContent := state.htmlReport(subject)
if _, err = f.WriteString(htmlContent); err != nil {
+ log.Println("debug: error writing HTML:", err)
return fmt.Errorf("failed to write HTML: %w", err)
}
+ log.Println("debug: successfully wrote HTML to temp file")
- return os.Rename(tmpFile, htmlFile)
+ err = os.Rename(tmpFile, htmlFile)
+ if err != nil {
+ log.Println("debug: error renaming temp file to final location:", err)
+ return err
+ }
+ log.Println("debug: successfully renamed and persisted HTML report to", htmlFile)
+ return nil
}
// htmlReport generates the complete HTML status page.
diff --git a/report.txt b/report.txt
index ea445f0..bf87cbd 100644
--- a/report.txt
+++ b/report.txt
@@ -1,24 +1,17 @@
-GOGIOS Report [C:2 W:2 U:0 S:0 OK:1]
+GOGIOS Report [C:0 W:0 U:4 S:0 OK:0]
This is the recent Gogios report!
# Alerts with status changed:
-UNKNOWN->CRITICAL: Prometheus: KubeProxyDown: KubeProxyDown [critical]: Target disappeared from Prometheus target discovery.
-UNKNOWN->CRITICAL: Prometheus: KubeSchedulerDown: KubeSchedulerDown [critical]: Target disappeared from Prometheus target discovery.
-
-UNKNOWN->WARNING: Prometheus: TargetDown: TargetDown [warning]: One or more targets are unreachable.
-UNKNOWN->WARNING: Prometheus: Watchdog: Watchdog [none]: An alert that should always be firing to certify that Alertmanager is working properly.
-
-UNKNOWN->OK: localhost ping: OK: localhost is alive
+There were no status changes...
# Unhandled alerts:
-CRITICAL: Prometheus: KubeProxyDown: KubeProxyDown [critical]: Target disappeared from Prometheus target discovery.
-CRITICAL: Prometheus: KubeSchedulerDown: KubeSchedulerDown [critical]: Target disappeared from Prometheus target discovery.
-
-WARNING: Prometheus: TargetDown: TargetDown [warning]: One or more targets are unreachable.
-WARNING: Prometheus: Watchdog: Watchdog [none]: An alert that should always be firing to certify that Alertmanager is working properly.
+UNKNOWN: foo.zone HTTP IPv4:
+UNKNOWN: foo.zone HTTP IPv6:
+UNKNOWN: www.foo.zone HTTP IPv4:
+UNKNOWN: www.foo.zone HTTP IPv6:
# Stale alerts: