# Example
TIP
Chapter in progress...
In this example we have the Prometheus with collected metrics with node_exporter
.
We will track free memory ratio with metrics node_memory_MemAvailable_bytes
and node_memory_MemTotal_bytes
- Create the prometheus config file
prometheus.yml
global:
scrape_interval: 5s
scrape_configs:
- job_name: "node_exporter"
static_configs:
- targets: ["node_exporter:9100"]
- Create the
docker-compose.yml
version: '3'
services:
prometheus:
image: "prom/prometheus:v2.29.2"
volumes:
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
ports:
- "9100:9100"
node_exporter:
image: "prom/node-exporter:v1.2.2"
- Run docker compose
docker-compose up
- Create the balerter config file
balerter.hcl
scripts {
file "demo" {
filename = "script.lua"
}
}
datasources {
prometheus "prom1" {
url = "http://localhost:9100"
}
}
channels {
notify "notify1" {}
}
- Create the balerter script
script.lua
-- @cron */10 * * * * *
local alert = require('alert')
local prom = require('datasource.prometheus.prom1')
alert.error('memalert', 'Foooo!')
Download the Balerter from the releases page (opens new window)
Run the Balerter
balerter -config balerter.hcl