真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

初玩prometheus-創(chuàng)新互聯(lián)

初玩prometheus

安裝Prometheus Server

因?yàn)镻rometheus是基于GoLang編寫,編譯后的軟件包,不依賴于任何的第三方依賴。用戶只需要下載對應(yīng)平臺的二進(jìn)制包,并解壓添加基本配置即可正常啟動Prometheus server。

目前成都創(chuàng)新互聯(lián)已為上1000+的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)絡(luò)空間、網(wǎng)站運(yùn)營、企業(yè)網(wǎng)站設(shè)計(jì)、吐魯番網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。

二進(jìn)制安裝部署

下載頁面:https://prometheus.io/download/
我們選擇對應(yīng)的下載版本,這里我們下載的是最新版本2.13.0 linux版本,下載地址為:https://github.com/prometheus/prometheus/releases/download/v2.13.0/prometheus-2.13.0.linux-amd64.tar.gz

我們在服務(wù)器上安裝部署:

[root@Prometheus ~]# mkdir /usr/local/prometheus
[root@Prometheus ~]# cd /usr/local/prometheus
[root@Prometheus prometheus]# wget  https://github.com/prometheus/prometheus/releases/download/v2.13.0/prometheus-2.13.0.linux-amd64.tar.gz
[root@Prometheus prometheus]# tar xvf prometheus-2.13.0.linux-amd64.tar.gz
prometheus-2.13.0.linux-amd64/
prometheus-2.13.0.linux-amd64/NOTICE
prometheus-2.13.0.linux-amd64/promtool
prometheus-2.13.0.linux-amd64/consoles/
prometheus-2.13.0.linux-amd64/consoles/prometheus.html
prometheus-2.13.0.linux-amd64/consoles/node-overview.html
prometheus-2.13.0.linux-amd64/consoles/node-cpu.html
prometheus-2.13.0.linux-amd64/consoles/node.html
prometheus-2.13.0.linux-amd64/consoles/index.html.example
prometheus-2.13.0.linux-amd64/consoles/prometheus-overview.html
prometheus-2.13.0.linux-amd64/consoles/node-disk.html
prometheus-2.13.0.linux-amd64/LICENSE
prometheus-2.13.0.linux-amd64/console_libraries/
prometheus-2.13.0.linux-amd64/console_libraries/prom.lib
prometheus-2.13.0.linux-amd64/console_libraries/menu.lib
prometheus-2.13.0.linux-amd64/tsdb
prometheus-2.13.0.linux-amd64/prometheus.yml
prometheus-2.13.0.linux-amd64/prometheus

解壓后同級目錄里面會看到prometheus.yml配置文件

# my global config
global:
  scrape_interval:     15s #抓去采樣數(shù)據(jù)的時間間隔,默認(rèn)15s去被監(jiān)控主機(jī)上采取一次
  evaluation_interval: 15s # 每15秒評估一次規(guī)則。 默認(rèn)值為每1分鐘。 監(jiān)控?cái)?shù)據(jù)規(guī)則的評估頻率(當(dāng)我們設(shè)置硬盤> 80%報(bào)警 這條rule規(guī)則 那個prometheus會默認(rèn)沒15S來執(zhí)行這個rule規(guī)則檢查硬盤使用情況)
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration(如何報(bào)警,報(bào)警信息)
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.()
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090'] #靜態(tài)配置的監(jiān)控主機(jī)

啟動prometheus

[root@Prometheus prometheus-2.13.0.linux-amd64]# ./prometheus --config.file=prometheus.yml
level=info ts=2019-10-11T01:53:36.252Z caller=main.go:296 msg="no time or size retention was set so using the default time retention" duration=15d
level=info ts=2019-10-11T01:53:36.252Z caller=main.go:332 msg="Starting Prometheus" version="(version=2.13.0, branch=HEAD, revision=6ea4252299f542669aca11860abc2192bdc7bede)"
level=info ts=2019-10-11T01:53:36.252Z caller=main.go:333 build_context="(go=go1.13.1, user=root@f30bdad2c3fd, date=20191004-11:25:34)"
level=info ts=2019-10-11T01:53:36.252Z caller=main.go:334 host_details="(Linux 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 Prometheus (none))"
level=info ts=2019-10-11T01:53:36.252Z caller=main.go:335 fd_limits="(soft=1024, hard=4096)"
level=info ts=2019-10-11T01:53:36.252Z caller=main.go:336 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2019-10-11T01:53:36.254Z caller=main.go:657 msg="Starting TSDB ..."
level=info ts=2019-10-11T01:53:36.256Z caller=web.go:450 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2019-10-11T01:53:36.258Z caller=head.go:512 component=tsdb msg="replaying WAL, this may take awhile"
level=info ts=2019-10-11T01:53:36.265Z caller=head.go:560 component=tsdb msg="WAL segment loaded" segment=0 maxSegment=1
level=info ts=2019-10-11T01:53:36.265Z caller=head.go:560 component=tsdb msg="WAL segment loaded" segment=1 maxSegment=1
level=info ts=2019-10-11T01:53:36.267Z caller=main.go:672 fs_type=XFS_SUPER_MAGIC
level=info ts=2019-10-11T01:53:36.267Z caller=main.go:673 msg="TSDB started"
level=info ts=2019-10-11T01:53:36.267Z caller=main.go:743 msg="Loading configuration file" filename=prometheus.yml
level=info ts=2019-10-11T01:53:36.285Z caller=main.go:771 msg="Completed loading of configuration file" filename=prometheus.yml
level=info ts=2019-10-11T01:53:36.285Z caller=main.go:626 msg="Server is ready to receive web requests."

我們直接指定配置文件之后就啟動起來了,但是在實(shí)際工作中我門不會這樣啟動,還會加上如下一些配置參數(shù)

--config.file="/usr/local/prometheus/prometheus.yml"   #啟動的配置文件
--web.listen-address="0.0.0.0:9090"                #監(jiān)聽的地址端口
--web.max-connections=512                          #大連接數(shù)       
--storage.tsdb.path="data/"                        #本地存儲的位置
--storage.tsdb.retention=15d                       #數(shù)據(jù)在本地存儲的時間
--storage.tsdb.no-lockfile                        #不允許在數(shù)據(jù)目錄里面創(chuàng)建鎖文件
--query.timeout=2m                                 #查詢超時時間
--query.max-concurrency=20                         #同時查詢的并發(fā)數(shù)

所以在生產(chǎn)中我們一般這樣啟動prometheus

nohup prometheus --config.file="/usr/local/prometheus/prometheus.yml" --web.listen-address="0.0.0.0:9090" --web.max-connections=512 --storage.tsdb.path="data/" --storage.tsdb.retention=15d --query.timeout=2m --query.max-concurrency=20 &

Docker 安裝部署

在當(dāng)前docker這么方便的情況下,我們肯定要來介紹下通過docker是如何來安裝部署prometheus;

mkdir /usr/local/prometheus/data
chmod 777 /usr/local/prometheus/data
docker run  -id --name prometheus -p 9090:9090 -v /etc/localtime:/etc/localtime:ro  -v /usr/local/prometheus/data:/prometheus_data  -v /usr/local/prometheus/prometheus-2.13.0.linux-amd64/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus --config.file=/etc/prometheus/prometheus.yml --web.listen-address=0.0.0.0:9090 --web.max-connections=512 --storage.tsdb.path=/prometheus_data --storage.tsdb.retention=15d --query.timeout=2m --query.max-concurrency=20

這里講訴一個技巧,當(dāng)我第一次啟動prometheus指定啟動的參數(shù)的時候一致啟動不起來報(bào) 找不到指定的配置文件, 我們直接啟動的時候他都是能啟動的了的,為什么我加上其余的參數(shù)之后,就提示這個呢?百思不得其解,知道我看了prometheus鏡像的dockerfile的時候,我瞬間明白是為什么了,Prometheus_Dockerfile地址

ARG ARCH="amd64"
ARG OS="linux"
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
LABEL maintainer="The Prometheus Authors "

ARG ARCH="amd64"
ARG OS="linux"
COPY .build/${OS}-${ARCH}/prometheus        /bin/prometheus
COPY .build/${OS}-${ARCH}/promtool          /bin/promtool
COPY documentation/examples/prometheus.yml  /etc/prometheus/prometheus.yml
COPY console_libraries/                     /usr/share/prometheus/console_libraries/
COPY consoles/                              /usr/share/prometheus/consoles/

RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/
RUN mkdir -p /prometheus && \
    chown -R nobody:nogroup etc/prometheus /prometheus

USER       nobody
EXPOSE     9090
VOLUME     [ "/prometheus" ]
WORKDIR    /prometheus
ENTRYPOINT [ "/bin/prometheus" ]
CMD        [ "--config.file=/etc/prometheus/prometheus.yml", \
             "--storage.tsdb.path=/prometheus", \
             "--web.console.libraries=/usr/share/prometheus/console_libraries", \
             "--web.console.templates=/usr/share/prometheus/consoles" ]

看到這個dockerfile 前面的我們現(xiàn)在可以不關(guān)心他,主要的就是在最后一行CMD,原來是我們在追加參數(shù)的時候把CMD的參數(shù)給覆蓋掉了,所以找不到配置文件的路徑,我們這個時候再給他加上就OK了。

介紹prometheus web界面

不管我們通過哪種方式來啟動的prometheus service端,我們都通過如下的方式登陸prometheus dashboard界面,登陸方式為http://IP:9090
初玩prometheus

初玩prometheus

初玩prometheus

初玩prometheus

初玩prometheus

初玩prometheus

初玩prometheus

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。


文章題目:初玩prometheus-創(chuàng)新互聯(lián)
當(dāng)前網(wǎng)址:http://weahome.cn/article/cssdjj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部