How to Monitor Your Fiber Framework API with Vigilmon (Go Uptime Monitoring)
Fiber is an Express-inspired web framework for Go — fast, with a developer-friendly API. If you're running a Fiber API in production, you need external uptime monitoring to know when something goes wrong.
This guide shows you how to add a health endpoint to Fiber and connect it to Vigilmon for free, multi-region monitoring.
Why You Need External Monitoring for Fiber Apps
Your Fiber server can fail silently:
- The process exits and the supervisor doesn't notice
- An upstream database goes down and requests hang
- Your TLS certificate expired and HTTPS connections fail
- A deployment pushed a broken binary
External monitoring catches all of these by making real HTTP requests from outside your infrastructure.
Step 1: Add a Health Route to Your Fiber App
package main
import (
"github.com/gofiber/fiber/v2"
)
func main() {
app := fiber.New()
// Health endpoint
app.Get("/health", func(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"status": "ok",
})
})
app.Listen(":3000")
}
For a more thorough health check:
app.Get("/health", func(c *fiber.Ctx) error {
// Check database
if err := db.Ping(); err != nil {
return c.Status(fiber.StatusServiceUnavailable).JSON(fiber.Map{
"status": "error",
"database": "unreachable",
})
}
return c.JSON(fiber.Map{
"status": "ok",
"database": "ok",
})
})
Step 2: Use Fiber's Built-In Monitor (Optional)
Fiber ships with a middleware for internal metrics:
import "github.com/gofiber/fiber/v2/middleware/monitor"
app.Get("/metrics", monitor.New())
This gives you CPU, memory, and request stats. It's useful for internal dashboards, but it's NOT a substitute for external uptime monitoring — Vigilmon makes HTTP requests from the outside.
Step 3: Protect Health Endpoints from Rate Limiting
If you use the Fiber limiter middleware, exclude the health route:
import "github.com/gofiber/fiber/v2/middleware/limiter"
app.Use(func(c *fiber.Ctx) error {
if c.Path() == "/health" {
return c.Next()
}
return limiter.New()(c)
})
Step 4: Connect to Vigilmon
- Sign up at vigilmon.online
- Add a new HTTP monitor
- Enter:
https://your-fiber-api.com/health - Check interval: 60 seconds
- Expected status: 200
- Regions: pick 2-3 for redundancy
- Set up email or Slack alerts
Vigilmon starts checking immediately and alerts you within ~60 seconds of downtime.
Monitoring Multiple Fiber Services
For a microservices architecture:
# Monitor each service independently
https://users.api.example.com/health
https://orders.api.example.com/health
https://auth.api.example.com/health
Group them under one project in Vigilmon for a combined status view.
Docker Health Check
FROM golang:1.22 AS builder
WORKDIR /app
COPY . .
RUN go build -o main .
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y curl
COPY --from=builder /app/main .
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \n CMD curl -f http://localhost:3000/health || exit 1
CMD ["./main"]
Summary
- Add
app.Get("/health", ...)to your Fiber application - Return
fiber.StatusOK(200) when your service is healthy - Check real dependencies (database, cache) inside the handler
- Connect the URL to Vigilmon — free plan covers most use cases
Fiber is built for speed. Make sure you know the instant it stops running.
Top comments (0)