Skip to content

Instantly share code, notes, and snippets.

@caius
Created January 19, 2024 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caius/c9e54753cb2bc47593d1707a7bcd89a8 to your computer and use it in GitHub Desktop.
Save caius/c9e54753cb2bc47593d1707a7bcd89a8 to your computer and use it in GitHub Desktop.
# .. snip ..
# Lifted from https://grafana.com/docs/grafana-cloud/quickstart/docker-compose-linux/#step-1-create-the-compose-file on 2022-10-07
grafana-node-exporter = {
# https://github.com/prometheus/node_exporter/releases
image = "prom/node-exporter:v1.7.0";
autoStart = true;
extraOptions = [
"--cpus=1"
"--memory=512m"
];
cmd = [
"--path.procfs=/host/proc"
"--path.sysfs=/host/sys"
"--path.rootfs=/rootfs"
"--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)"
];
ports = [
"9100:9100"
];
volumes = [
"/proc:/host/proc:ro"
"/sys:/host/sys:ro"
"/:/rootfs:ro"
];
};
grafana-prometheus = {
# https://github.com/prometheus/prometheus/releases
image = "prom/prometheus:v2.48.1";
autoStart = true;
extraOptions = [
"--cpus=1"
"--memory=512m"
];
cmd = [
"--config.file=/etc/prometheus/prometheus.yml"
"--storage.tsdb.path=/prometheus"
"--web.console.libraries=/etc/prometheus/console_libraries"
"--web.console.templates=/etc/prometheus/consoles"
"--web.enable-lifecycle"
];
ports = [
"9090:9090"
];
volumes = [
"/data/prometheus:/prometheus"
"${prometheusConfigFile}:/etc/prometheus/prometheus.yml"
];
dependsOn = [ "grafana-node-exporter" ];
};
# .. snip ..
global:
scrape_interval: "1m"
scrape_configs:
- job_name: "prometheus"
scrape_interval: "1m"
static_configs:
- targets:
- "localhost:9090"
labels:
instance: "wilde"
- job_name: "node"
static_configs:
- targets:
- "localhost:9100"
labels:
instance: "wilde"
- targets:
- "192.168.1.160:9100"
labels:
instance: "oscar"
remote_write:
- url: "https://prometheus-1234-somewhere.grafana.net/api/prom/push"
basic_auth:
username: "1234"
password: "eylemmein"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment