tomgur / simple-go-http-monitor

Simple HTTP monitor written in Golang. Exposes metrics for Prometheus
2 stars 2 forks source link

Simple HTTP monitor

A Simple HTTP monitor written in Golang that exposes its findings to Prometheus

The monitor reads its target from env vars, and exposes a Summary with quantiles: 0.5, 0.9, 0.99


SETUP

  1. The following env vars can be set for configuring the monitor

Running the monitor without setting variables will Monitor This project's docker hub page once every 10 seconds and expose the metrics on port 9100

  1. Run the monitor (3 options)
    • After exporting all env vars, issue the following command go run monitor.go
    • After exporting all env vars, build the go executable and run it go build monitor.go; ./monitor
    • Build a docker image containing the monitor app and run it docker build -t monitor:1 .; docker run --name monitor --restart always -d -p 9100:9100 -e "scrapePort=9100" -e "subsystem=website" -e "monitorUrl=https://hub.docker.com/repository/docker/tomgurdev/simple-go-http-monitor" -e "monitorInterval=10" -e "componentName=simple_http_monitor_docker_hub" mymonitor:1

Metrics

from Label

When run on an AWS EC2 instance, a label will be added to all metrics from=<availability zone>.

Whne run outside of AWS, the from label will be filled with the outgoing IP address of the server.