Please help: I want to configure Node-RED for monitoring with Prometheus and Node Exporter
The goal is to monitor Node-RED server and Prometheus server and follow if they work correctly, and visual there metrics in Garana.
I am using docker to run Node-RED and Grafana and Prometheus and Node Exporter.
This is docker-compose.yml
:
version: '3'
services:
grafana:
image: grafana/grafana-enterprise
container_name: grafana
ports:
- "3000:3000"
depends_on:
- influxdb
networks:
- iot-network
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_INSTALL_PLUGINS=
volumes:
- grafana_data:/var/lib/grafana
nodered:
image: nodered/node-red:latest
container_name: nodered
ports:
- "1880:1880"
networks:
- iot-network
prometheus:
image: prom/prometheus:latest
container_name: prometheus
ports:
- 9090:9090
command:
- --config.file=/etc/prometheus/prometheus.yml
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
depends_on:
- node_exporter
networks:
- iot-network
node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
ports:
- 9100:9100
command:
- '--path.rootfs=/host'
volumes:
- '/:/host:ro,rslave'
networks:
- iot-network
networks:
iot-network:
driver: bridge
volumes:
grafana_data: {}
and this is prometheus.yml
:
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'prometheus' # no problems, it works
static_configs:
- targets: ['prometheus:9090']
- job_name: 'node_exporter' # no problems, it works
static_configs:
- targets: ['node_exporter:9100']
- job_name: 'nodered' # !!! NOT works !!!
static_configs:
- targets: ['nodered:1880']
- job_name: 'grafana' # no problems, it works
static_configs:
- targets: ['grafana:3000']
the docker-compose.yml
and prometheus.yml
are in the same folder.
then I run docker-compose up
, and create the containers,
but I have problem with Node-RED server:
this image from web interface of prometheus http://localhost:9090/targets :