Containerizing things.
ci/woodpecker/push/woodpecker Pipeline failed
Details
ci/woodpecker/push/woodpecker Pipeline failed
Details
This commit is contained in:
parent
dd2c809177
commit
0bbdf1af02
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4
main.go
4
main.go
|
@ -58,6 +58,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
log.Println("Fetching and monitoring containers...")
|
||||||
err := fetchAndMonitorContainers()
|
err := fetchAndMonitorContainers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error in fetching and monitoring containers: %v", err)
|
log.Printf("Error in fetching and monitoring containers: %v", err)
|
||||||
|
@ -72,6 +73,7 @@ func fetchAndMonitorContainers() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
log.Printf("Fetched %d containers\n", len(containers))
|
||||||
|
|
||||||
for _, container := range containers {
|
for _, container := range containers {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
|
@ -87,6 +89,7 @@ func fetchAndMonitorContainers() error {
|
||||||
Info: container,
|
Info: container,
|
||||||
LastChecked: time.Now().Add(-interval),
|
LastChecked: time.Now().Add(-interval),
|
||||||
}
|
}
|
||||||
|
log.Printf("Started monitoring container %s (%s) with interval %s\n", container.Name, container.ID, container.Interval)
|
||||||
}
|
}
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
}
|
}
|
||||||
|
@ -106,6 +109,7 @@ func fetchAndMonitorContainers() error {
|
||||||
if time.Since(mc.LastChecked) >= interval {
|
if time.Since(mc.LastChecked) >= interval {
|
||||||
mc.LastChecked = time.Now()
|
mc.LastChecked = time.Now()
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
|
log.Printf("Checking container %s (%s)\n", mc.Info.Name, mc.Info.ID)
|
||||||
checkAndNotify(mc.Info)
|
checkAndNotify(mc.Info)
|
||||||
} else {
|
} else {
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
|
|
Loading…
Reference in New Issue