1. Create a new file
sudo nano ~/prometheus.yml
Add below lines or copy paste into prometheus file
# A scrape configuration scraping a Node Exporter and the Prometheus server # itself. scrape_configs: # Scrape Prometheus itself every 5 seconds. - job_name: 'prometheus' scrape_interval: 5s
static_configs
: - targets: ['localhost:9090'] # Scrape the Node Exporter every 5 seconds. - job_name: 'node' scrape_interval: 5s
static_configs
: - targets: ['your_server_ip:9100']
2.
docker run -d -p 9090:9090 -v ~/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus
3.
docker ps
4. http://
your_server_ip
:9090/status
ERROR :- state : UNKNOWN
SOLUTION :-
remove -storage.local.memory-chunks=10000