下載prometheus https://prometheus.io/download/ tar xvfz prometheus-*.tar.gz cd prometheus-* mv prometheus-* /usr/local/prometheus
添加開機自啓動 vim /usr/lib/systemd/system/prometheus [Unit] Description=https://prometheus.io [Service] Restart=on-failure ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml [Install] WantedBy=multi-user.target chmod +x /usr/lib/systemd/system/prometheus
systemctl start prometheus systemctl enable prometheus
瀏覽:vim
http://ip:9090bash
出現問題:時間不一致(以下相似)服務器
Warning! Detected 457.83 seconds time difference between your browser and the server. Prometheus relies on accurate time and time drift might cause unexpected query results.
解決辦法:ide
我本身吧服務器時間同步至 time1.aliyun.comspa
ntpdate time1.aliyun.comserver
而後把電腦的時間也同步至time1.aliyun.com 便可解決blog
l global:全局配置ip
l alerting:告警配置get
l rule_files:告警規則同步
l scrape_configs:配置數據源,稱爲target,每一個target用job_name命名。又分爲靜態配置和服務發現