Monitor Background Jobs in Go Fiber Applications
FiberThe Problem
Go Fiber apps running background goroutines for scheduled tasks face the same invisible-failure problem: the web server stays healthy while background work silently stops.
The Solution
Run a cron scheduler alongside Fiber and add CronRabbit pings to each job.
Integration
Use robfig/cron for scheduling and CronRabbit for monitoring. Start both alongside your Fiber server.
Code Examples
Fiber with monitored cron
Gopackage main
import (
"github.com/gofiber/fiber/v2"
"github.com/robfig/cron/v3"
"net/http"
"time"
)
func main() {
client := &http.Client{Timeout: 10 * time.Second}
c := cron.New()
c.AddFunc("0 3 * * *", func() {
client.Get("https://ping.cronrabbit.com/your-id/start")
if err := runNightlyJob(); err != nil {
client.Get("https://ping.cronrabbit.com/your-id/fail")
return
}
client.Get("https://ping.cronrabbit.com/your-id")
})
c.Start()
app := fiber.New()
app.Listen(":3000")
}