prometheus安裝部署

什么是prometheus?Prometheus?是由?SoundCloud?開源監(jiān)控告警解決方案,從?2012?年開始編寫代碼,再到?2015?年?github?上開源以來,已經吸引了?9k+?關注,以及很多大公司的使用;2016?年?Prometheus?成為繼?k8s?后,第二名?CNCF(Cloud Native Computing Foundation)?成員。?
主要功能:多維?數(shù)據模型(時序由?metric?名字和?k/v?的?labels?構成)。?
靈活的查詢語句(PromQL)。?
無依賴存儲,支持?local?和?remote?不同模型。?
采用?http?協(xié)議,使用?pull?模式,拉取數(shù)據,簡單易懂。?
監(jiān)控目標,可以采用服務發(fā)現(xiàn)或靜態(tài)配置的方式。?
支持多種統(tǒng)計數(shù)據模型,圖形化友好。?
核心組建:Prometheus Server, 主要用于抓取數(shù)據和存儲時序數(shù)據,另外還提供查詢和?Alert Rule?配置管理。?
client libraries,用于對接?Prometheus Server,?可以查詢和上報數(shù)據。?
push gateway?,用于批量,短期的監(jiān)控數(shù)據的匯總節(jié)點,主要用于業(yè)務數(shù)據匯報等。?
exporters?,部署在客戶端的agent?例如匯報機器數(shù)據的?node_exporter,?匯報?MongoDB?信息的?MongoDB exporter?等等。?
alertmanager?用于告警通知管理的?
基礎架構圖:?
從這個架構圖,也可以看出?Prometheus?的主要模塊包含,?Server, Exporters, Pushgateway, PromQL, Alertmanager, WebUI?等。?
它大致使用邏輯是這樣:?
Prometheus server?定期從靜態(tài)配置的?targets?或者服務發(fā)現(xiàn)的?targets?拉取數(shù)據。?
當新拉取的數(shù)據大于配置內存緩存區(qū)的時候,Prometheus?會將數(shù)據持久化到磁盤(如果使用?remote storage?將持久化到云端)。?
Prometheus?可以配置?rules,然后定時查詢數(shù)據,當條件觸發(fā)的時候,會將?alert?推送到配置的?Alertmanager。?
Alertmanager?收到警告的時候,可以根據配置,聚合,去重,降噪,最后發(fā)送警告。?
可以使用?API,?Prometheus Console?或者?Grafana?查詢和聚合數(shù)據。?
以上內容轉載:https://songjiayang.gitbooks.io/prometheus/content/introduction/what.html?
安裝:prometheus(1)下載安裝包https://prometheus.io/download/ ????至指定目錄如/Download?
shell>gwet ?https://github.com/prometheus/prometheus/releases/download/v2.13.1/prometheus-2.13.1.darwin-amd64.tar.gz?
(2)解壓prometheus?
shell>tar -xvzf ~/Download/prometheus-2.13.1.linux-amd64.tar.gz?
shell>mv prometheus-2.13.1.linux-amd64 ?prometheus?
shell>cd prometheus?
shell>ls ?prometheus?
prometheus ????啟動文件?
prometheus.yml ???配置文件?
data ?存儲文件?
(3)檢查prometheus版本?
shell> ./prometheus ?version?
prometheus, version 2.13.0 (branch: HEAD, revision: 6ea4252299f542669aca11860abc2192bdc7bede) ?build user: ??????root@f30bdad2c3fd ?build date: ??????20191004-11:25:34 ?go version: ??????go1.13.1(4)啟動prometheus server?
shell> ./prometheus ???#正常啟動會輸出很多信息?
level=info ts=2019-10-17T09:29:45.851Z caller=main.go:332 msg="Starting Prometheus" version="(version=2.13.0, branch=HEAD, revision=6ea4252299f542669aca11860abc2192bdc7bede)"(5)查看端口監(jiān)聽,監(jiān)聽端口9090?
shell>netstat ?-tunlp | grep prometheus?
tcp6 ??????0 ?????0 :::9090 ????????????????:::* ???????????????????LISTEN ?????31879/./prometheus ??
(6)通過web訪問http://IP:9090?
(7)以服務的方式啟動?
shell>vim ?/etc/systemd/system/prometheus.service?
[Unit]Description=Prometheus Monitoring SystemDocumentation=Prometheus Monitoring System[Service]ExecStart=/Download/prometheus/prometheus \ ?--config.file /Download/prometheus/prometheus.yml \ ?--web.listen-address=:9090[Install]WantedBy=multi-user.targetshell> systemctl daemon-reload?
shell> systemctl enable prometheus?
shell> systemctl start prometheus
什么是prometheus?Prometheus?是由?SoundCloud?開源監(jiān)控告警解決方案,從?2012?年開始編寫代碼,再到?2015?年?github?上開源以來,已經吸引了?9k+?關注,以及很多大公司的使用;2016?年?Prometheus?成為繼?k8s?后,第二名?CNCF(Cloud Native Computing Foundation)?成員。?
主要功能:多維?數(shù)據模型(時序由?metric?名字和?k/v?的?labels?構成)。?
靈活的查詢語句(PromQL)。?
無依賴存儲,支持?local?和?remote?不同模型。?
采用?http?協(xié)議,使用?pull?模式,拉取數(shù)據,簡單易懂。?
監(jiān)控目標,可以采用服務發(fā)現(xiàn)或靜態(tài)配置的方式。?
支持多種統(tǒng)計數(shù)據模型,圖形化友好。?
核心組建:Prometheus Server, 主要用于抓取數(shù)據和存儲時序數(shù)據,另外還提供查詢和?Alert Rule?配置管理。?
client libraries,用于對接?Prometheus Server,?可以查詢和上報數(shù)據。?
push gateway?,用于批量,短期的監(jiān)控數(shù)據的匯總節(jié)點,主要用于業(yè)務數(shù)據匯報等。?
exporters?,部署在客戶端的agent?例如匯報機器數(shù)據的?node_exporter,?匯報?MongoDB?信息的?MongoDB exporter?等等。?
alertmanager?用于告警通知管理的?
基礎架構圖:?
從這個架構圖,也可以看出?Prometheus?的主要模塊包含,?Server, Exporters, Pushgateway, PromQL, Alertmanager, WebUI?等。?
它大致使用邏輯是這樣:?
Prometheus server?定期從靜態(tài)配置的?targets?或者服務發(fā)現(xiàn)的?targets?拉取數(shù)據。?
當新拉取的數(shù)據大于配置內存緩存區(qū)的時候,Prometheus?會將數(shù)據持久化到磁盤(如果使用?remote storage?將持久化到云端)。?
Prometheus?可以配置?rules,然后定時查詢數(shù)據,當條件觸發(fā)的時候,會將?alert?推送到配置的?Alertmanager。?
Alertmanager?收到警告的時候,可以根據配置,聚合,去重,降噪,最后發(fā)送警告。?
可以使用?API,?Prometheus Console?或者?Grafana?查詢和聚合數(shù)據。?
以上內容轉載:https://songjiayang.gitbooks.io/prometheus/content/introduction/what.html?
安裝:prometheus(1)下載安裝包https://prometheus.io/download/ ????至指定目錄如/Download?
shell>gwet ?https://github.com/prometheus/prometheus/releases/download/v2.13.1/prometheus-2.13.1.darwin-amd64.tar.gz?
(2)解壓prometheus?
shell>tar -xvzf ~/Download/prometheus-2.13.1.linux-amd64.tar.gz?
shell>mv prometheus-2.13.1.linux-amd64 ?prometheus?
shell>cd prometheus?
shell>ls ?prometheus?
prometheus ????啟動文件?
prometheus.yml ???配置文件?
data ?存儲文件?
(3)檢查prometheus版本?
shell> ./prometheus ?version?
prometheus, version 2.13.0 (branch: HEAD, revision: 6ea4252299f542669aca11860abc2192bdc7bede) ?build user: ??????root@f30bdad2c3fd ?build date: ??????20191004-11:25:34 ?go version: ??????go1.13.1(4)啟動prometheus server?
shell> ./prometheus ???#正常啟動會輸出很多信息?
level=info ts=2019-10-17T09:29:45.851Z caller=main.go:332 msg="Starting Prometheus" version="(version=2.13.0, branch=HEAD, revision=6ea4252299f542669aca11860abc2192bdc7bede)"(5)查看端口監(jiān)聽,監(jiān)聽端口9090?
shell>netstat ?-tunlp | grep prometheus?
tcp6 ??????0 ?????0 :::9090 ????????????????:::* ???????????????????LISTEN ?????31879/./prometheus ??
(6)通過web訪問http://IP:9090?
(7)以服務的方式啟動?
shell>vim ?/etc/systemd/system/prometheus.service?
[Unit]Description=Prometheus Monitoring SystemDocumentation=Prometheus Monitoring System[Service]ExecStart=/Download/prometheus/prometheus \ ?--config.file /Download/prometheus/prometheus.yml \ ?--web.listen-address=:9090[Install]WantedBy=multi-user.targetshell> systemctl daemon-reload?
shell> systemctl enable prometheus?
shell> systemctl start prometheus
了解更多網絡知識關注:http://www.vecloud.com/