build / build (push) Successful in 1m43s
- include SMB drop-ins from /etc/samba/smb.conf.d into the generated smb.conf - keep smbd/nfs-server running while other services (/etc/exports.d, drop-ins) share, instead of disabling them when nasmon has no shares of its own - list those shares read-only on /shares - settings: RepoISO URL; poll its /api/integration/status, dashboard card, menu link, alerts for portal down, stale worker, failed jobs, unmounted publications Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
1.7 KiB
Go
55 lines
1.7 KiB
Go
package collect
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"net/http"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
// RepoISO is the health summary of a RepoISO portal running on the same host
|
|
// (GET <url>/api/integration/status). Reachable=false means the API did not answer.
|
|
type RepoISO struct {
|
|
URL string `json:"url"`
|
|
Reachable bool `json:"reachable"`
|
|
Error string `json:"error,omitempty"`
|
|
CheckedAt time.Time `json:"checked_at"`
|
|
Version string `json:"version"`
|
|
WorkerAlive bool `json:"worker_alive"`
|
|
WorkerHeartbeat string `json:"worker_heartbeat"`
|
|
Images int `json:"images"`
|
|
ImagesBytes uint64 `json:"images_bytes"`
|
|
ImagesPending int `json:"images_pending"`
|
|
ImagesError int `json:"images_error"`
|
|
Publications int `json:"publications"`
|
|
PublicationsError int `json:"publications_error"`
|
|
JobsActive int `json:"jobs_active"`
|
|
JobsFailed24h int `json:"jobs_failed_24h"`
|
|
Exports int `json:"exports"`
|
|
}
|
|
|
|
var repoisoClient = &http.Client{Timeout: 5 * time.Second}
|
|
|
|
// FetchRepoISO queries the RepoISO status endpoint; errors are reported in the result.
|
|
func FetchRepoISO(base string) RepoISO {
|
|
base = strings.TrimRight(base, "/")
|
|
r := RepoISO{URL: base, CheckedAt: time.Now()}
|
|
resp, err := repoisoClient.Get(base + "/api/integration/status")
|
|
if err != nil {
|
|
r.Error = err.Error()
|
|
return r
|
|
}
|
|
defer resp.Body.Close()
|
|
if resp.StatusCode != http.StatusOK {
|
|
r.Error = fmt.Sprintf("HTTP %d", resp.StatusCode)
|
|
return r
|
|
}
|
|
if err := json.NewDecoder(resp.Body).Decode(&r); err != nil {
|
|
r.Error = "bad response: " + err.Error()
|
|
return r
|
|
}
|
|
r.URL, r.Reachable, r.Error = base, true, ""
|
|
return r
|
|
}
|