This guide uses Docker Compose to run Riemann event stream processor for monitoring.
For Docker installation, see Docker.
mkdir -p /opt/riemann/{config,data}
cd /opt/riemann
Create config/riemann.config:
(let [index (memoize 5000 50000 index)]
(streams
; Log all events
(with :host (fingerprint)
(with :service (fingerprint)
(index)))
; Alert on critical services
(where (and (service "disk-free")
(< 80 (metric)))
(email "admin@example.com"))
; Forward to external systems
; (async-queue!
; :forward
; {:queue-size 1000
; :core-pool-size 1
; :max-pool-size 10}
; (graphite {:host "graphite.example.com"}))))
Create docker-compose.yml:
services:
riemann:
image: atomix/riemann:0.6.4
container_name: riemann
hostname: riemann
ports:
- "5555:5555" ; TCP
- "5555:5555/udp" ; UDP
- "5556:5556" ; WebSocket
volumes:
- ./config/riemann.config:/etc/riemann/riemann.config:ro
- ./data:/var/lib/riemann
environment:
- RIEMANN_CONFIG=/etc/riemann/riemann.config
restart: unless-stopped
docker compose up -d
Check container status:
docker compose ps
View logs:
docker compose logs -f riemann
Test connection:
docker compose exec riemann riemann-client status
docker compose exec riemann riemann-client query "true"
docker compose restart riemann
docker compose down
docker compose pull
docker compose up -d
./data directoryfrom riemann_client.client import Client
with Client('localhost', port=5555) as client:
client.event(service='my-service', metric=1.0, state='ok')
(require '[riemann.client :as r])
(def client (r/riemann-client))
(r/event! client {:service "my-service" :metric 1.0 :state "ok"})
Running containers in production? We help with:
Need help? office@linux-server-admin.com or Contact Us