中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

安陽市地圖蘇州seo快速優(yōu)化

安陽市地圖,蘇州seo快速優(yōu)化,做自媒體的網(wǎng)站,學(xué)網(wǎng)站開發(fā)怎么樣1.簡(jiǎn)介 本文檔為prometheus和grafana安裝配置手冊(cè),prometheus和grafana的內(nèi)容、和操作過程,詳細(xì)介紹了服務(wù)監(jiān)控配置、dashboard配置、告警配置等操作。 2.部署說明 Prometheus基于Golang編寫(需要安裝),編譯后的軟件…

1.簡(jiǎn)介

本文檔為prometheus和grafana安裝配置手冊(cè),prometheus和grafana的內(nèi)容、和操作過程,詳細(xì)介紹了服務(wù)監(jiān)控配置、dashboard配置、告警配置等操作。

2.部署說明

Prometheus基于Golang編寫(需要安裝),編譯后的軟件包,不依賴于任何的第三方依賴。用戶只需要下載對(duì)應(yīng)平臺(tái)的二進(jìn)制包,解壓并且添加基本的配置即可正常啟動(dòng)Prometheus Server。 Grafana提供離線的rpm安裝包,直接安裝即可。

2.1環(huán)境配置

操作系統(tǒng)版本:

centos7.2

IP地址規(guī)劃:

prometheus server+grafana:10.3.10.135
node_explorer: 10.3.10.136

Prometheus版本:

prometheus-2.14.0

Grafana版本:

grafana-6.5.1-1

2.2軟件介質(zhì)

Prometheus安裝包:

prometheus-2.14.0.linux-amd64.tar.gz

grafana安裝包:

grafana-6.5.1-1.x86_64.rpm

node_explorer安裝包:

node_exporter-0.18.1.linux-amd64.tar.gz

mysqld_exporte_node安裝包:

mysqld_exporter-0.12.1.linux-amd64.tar.gz

3.安裝配置

3.1 安裝Prometheus

添加用戶prometheus

# useradd --no-create-home --shell /bin/false prometheus

創(chuàng)建相關(guān)目錄

# mkdir /etc/prometheus
# mkdir /var/lib/prometheus

改目錄權(quán)限

# chown prometheus:prometheus /etc/prometheus
# chown prometheus:prometheus /var/lib/prometheus

解壓 & 移動(dòng)到相應(yīng)目錄

# tar xvf prometheus-2.14.0.linux-amd64.tar.gz # cp prometheus-2.14.0.linux-amd64/prometheus /usr/local/bin/
# cp prometheus-2.14.0.linux-amd64/promtool /usr/local/bin/# cp -r prometheus-2.14.0.linux-amd64/consoles/ /etc/prometheus/
# cp -r prometheus-2.14.0.linux-amd64/console_libraries/ /etc/prometheus/
# cp prometheus-2.14.0.linux-amd64/prometheus.yml /etc/prometheus/# chown prometheus:prometheus /usr/local/bin/prometheus
# chown prometheus:prometheus /usr/local/bin/promtool# chown -R prometheus:prometheus /etc/prometheus/consoles
# chown -R prometheus:prometheus /etc/prometheus/console_libraries
# chown -R prometheus:prometheus /etc/prometheus/prometheus.yml 

配置Prometheus service,端口為9090

# vi /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \--config.file /etc/prometheus/prometheus.yml \--storage.tsdb.path /var/lib/prometheus/ \--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.enable-lifecycle \--web.listen-address=:9090[Install]
WantedBy=multi-user.target

Prometheus啟動(dòng)參數(shù)說明 --config.file -- 指明prometheus的配置文件路徑 --web.enable-lifecycle -- 指明prometheus配置更改后可以進(jìn)行熱加載 --storage.tsdb.path -- 指明監(jiān)控?cái)?shù)據(jù)存儲(chǔ)路徑 --storage.tsdb.retention --指明數(shù)據(jù)保留時(shí)間

說明: prometheus在2.0之后默認(rèn)的熱加載配置沒有開啟, 配置修改后, 需要重啟prometheus server才能生效, 這對(duì)于生產(chǎn)環(huán)境的監(jiān)控是不可容忍的, 所以我們需要開啟prometheus server的配置熱加載功能. 在啟動(dòng)prometheus時(shí)加上參數(shù) web.enable-lifecycle , 可以啟用配置的熱加載, 配置修改后, 熱加載配置:

curl -X POST  http://localhost:9090/-/reload

加載systemd服務(wù) & 啟動(dòng)

# 加載 
systemctl daemon-reload
# 開機(jī)啟動(dòng)
systemctl enable prometheus.service
# 啟動(dòng)
systemctl start prometheus
# 查看狀態(tài)
systemctl status prometheus

訪問URL:?http://10.3.10.135:9090/graph

?

3.2 安裝Grafana

rpm包上傳到服務(wù)器上后,直接執(zhí)行:

# yum localinstall grafana-6.5.1-1.x86_64.rpm

安裝完之后進(jìn)行Grafana配置的修改:修改端口 vim /etc/grafana/grafana.ini ,關(guān)于配置說明請(qǐng)見:官方文檔、Grafana配置和Grafana 配置文件詳解

http_port = 3000

加載systemd服務(wù) & 啟動(dòng)

直接啟動(dòng)
# systemctl start grafana-server
#加載
# systemctl daemon-reload
#開啟
# systemctl start grafana-server
#查看狀態(tài)
# systemctl status grafana-server
#開啟啟動(dòng)
# systemctl enable grafana-server.service

日志&數(shù)據(jù)目錄 日志目錄: 配置為在引導(dǎo)時(shí)啟動(dòng) 數(shù)據(jù)目錄:

/var/lib/grafana/grafana.db

訪問URL: granafa默認(rèn)端口為3000,可以在瀏覽器中輸入

http://10.3.10.135:3000/?granafa首次登錄賬戶名和密碼admin/admin,可以修改

用戶名:admin
密碼:admin

?

3.3安裝Exporter

在3.1和3.2操作中,已經(jīng)把Prometheus和Grafana安裝完畢,現(xiàn)在開始安裝Exporter來采集數(shù)據(jù)。 Exporter是Prometheus的一類數(shù)據(jù)采集組件的總稱。它負(fù)責(zé)從目標(biāo)處搜集數(shù)據(jù),并將其轉(zhuǎn)化為Prometheus支持的格式。與傳統(tǒng)的數(shù)據(jù)采集組件不同的是,它并不向中央服務(wù)器發(fā)送數(shù)據(jù),而是等待中央服務(wù)器主動(dòng)前來抓取,默認(rèn)的抓取地址為?http://CURRENT_IP:9100/metrics

3.3.1 Linux主機(jī)監(jiān)控

node_exporter的作用是用于機(jī)器系統(tǒng)數(shù)據(jù)收集,監(jiān)控服務(wù)器CPU、內(nèi)存、磁盤、I/O、網(wǎng)絡(luò)等等信息。

3.3.1.1安裝node_exporter

準(zhǔn)備介質(zhì),上傳到服務(wù)器

node_exporter-0.18.1.linux-amd64.tar.gz

解壓

tar xvf node_exporter-0.18.1.linux-amd64.tar.gz
cp node_exporter-0.18.1.linux-amd64/node_exporter /usr/sbin/

幫助

node_exporter --help

開啟,端口:9199

node_exporter --web.listen-address=:9199

添加用戶prometheus

useradd --no-create-home --shell /bin/false prometheus

加載systemd服務(wù) & 啟動(dòng) vi /etc/systemd/system/node_exporter.service

[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/sbin/node_exporter --web.listen-address=:9199
Restart=on-failure
[Install]
WantedBy=multi-user.target

systemctl 啟動(dòng)

# 加載 
systemctl daemon-reload
# 開機(jī)啟動(dòng)
systemctl enable node_exporter.service
# 啟動(dòng)
systemctl start node_exporter
# 查看狀態(tài)
systemctl status node_exporter

啟動(dòng) node_exporter 服務(wù)并設(shè)置開機(jī)啟動(dòng)

# systemctl daemon-reload
# systemctl enable node_exporter.service
# systemctl start node_exporter.service
# systemctl status node_exporter.service
# systemctl restart node_exporter.service
# systemctl start node_exporter.service
# systemctl stop node_exporter.service

此時(shí),node_exporter啟動(dòng)后已經(jīng)開始采集指標(biāo)信息,node_exporter啟動(dòng)成功后, 你就可以通過如下api看到你的監(jiān)控?cái)?shù)據(jù)了(將下面的node_exporter_server_ip替換成你的node_exporter的IP地址, 放到瀏覽器中訪問就可以了 ). 可以通過地址訪問:?http://10.3.10.135:9199/metrics

?

3.3.1.2可視化監(jiān)控配置

上面已經(jīng)安裝部署好了Prometheus、Grafana和Exporter,現(xiàn)在需要把這3者聯(lián)系起來進(jìn)行數(shù)據(jù)展示。如已經(jīng)安裝了node_exporter,需要把node_exporter采集的信息配置到Prometheus上。即修改Prometheus配置文件: 為了更好的展示, 接下來我們將這個(gè)api 配置到 prometheus server中, 并通過grafana進(jìn)行展示. 將 node_exporter 加入 prometheus.yml配置中

vi /etc/prometheus/prometheus.yml- job_name: 'Linux'file_sd_configs:- files: ['/etc/prometheus/sd_cfg/Linux.yml']refresh_interval: 5s

并在文件/etc/prometheus/sd_cfg/Linux.yml中寫入如下內(nèi)容

- targets: ['IP地址:9100']labels:name: Linux-node1[這里建議給每個(gè)主機(jī)打個(gè)有意義的標(biāo)簽,方便識(shí)別.]

例如:

?

這樣做的好處是, 方便以后配置監(jiān)控自動(dòng)化, 規(guī)范化, 將每一類的監(jiān)控放到自己的配置文件中, 方便維護(hù). 當(dāng)然, 如果你的服務(wù)器少, 要監(jiān)控的組件少的話, 你也可以將配置都寫入prometheus的主配置文件prometheus.yml中

重啟Prometheus:

systemctl restart Prometheus

重載prometheus配置

curl -X POST  http://localhost:9090/-/reload
3.3.1.3查看監(jiān)控端是否介入

?

發(fā)現(xiàn) target 中只有 prometheus server, 因?yàn)槲覀冞€沒有加入其他監(jiān)控, 下面進(jìn)行介紹, 后續(xù)還將介紹如何監(jiān)控 mysql, redis, RabbitMQ, Kafka, nginx, java等常見服務(wù).

3.3.1.4 Grafana導(dǎo)入Linux模板

Granfana 導(dǎo)入Linux主機(jī)監(jiān)控圖表

推薦圖表ID:https://grafana.com/dashboards/11074

操作步驟:

Grafana首頁-->左上角圖標(biāo)-->Dashboard-->import

?

Upload已下載至本地的json文件(或者使用dashboard id,如這里的11074),如下:

?

?

數(shù)據(jù)源選擇"prometheus",即添加的數(shù)據(jù)源name,點(diǎn)擊"Import"按鈕,如下:

?

配置完保存后即可看到逼格非常高的系統(tǒng)主機(jī)節(jié)點(diǎn)監(jiān)控信息,包括系統(tǒng)運(yùn)行時(shí)間, 內(nèi)存和CPU的配置, CPU、內(nèi)存、磁盤、網(wǎng)絡(luò)流量等信息, 以及磁盤IO、CPU溫度等信息。?

?

3.3.2 Mysql數(shù)據(jù)庫(kù)監(jiān)控

mysqld_exporter的作用是用于MySQL數(shù)據(jù)庫(kù)數(shù)據(jù)收集。

3.3.2.1安裝mysqld_exporter

準(zhǔn)備介質(zhì),上傳到服務(wù)器

mysqld_exporter-0.12.1.linux-amd64.tar.gz

解壓

tar xvf mysqld_exporter-0.12.1.linux-amd64.tar.gz
cp mysqld_exporter /usr/sbin/

幫助

mysqld_exporter --help

mysqld_exporter需要連接Mysql,首先為它創(chuàng)建用戶并賦予所需要的權(quán)限:

登錄mysql為exporter創(chuàng)建賬號(hào)并授權(quán)
mysql> set global validate_password_policy=LOW;
# 創(chuàng)建數(shù)據(jù)庫(kù)用戶。
mysql> CREATE USER 'exporter'@'localhost' IDENTIFIED BY 'exporter';
# 可查看主從運(yùn)行情況查看線程,及所有數(shù)據(jù)庫(kù)。
mysql> GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';
mysql> flush privileges;

2:創(chuàng)建.my.cnf文件,mysql配置文件、運(yùn)行時(shí)可免密碼連接數(shù)據(jù)庫(kù)

vi /usr/local/mysql_exporter/.my.cnf
[client]
host=10.3.10.136
port=3306
user=root
password=Intel@123456

systemctl啟動(dòng)mysqld_exporter,編輯系統(tǒng)啟動(dòng)文件

vi /etc/systemd/system/mysqld_exporter.service
[Unit]
Description=mysqld_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/sbin/mysqld_exporter --web.listen-address=:9104 --config.my-cnf=/usr/local/mysql_exporter/.my.cnf
Restart=on-failure
[Install]
WantedBy=multi-user.target

啟動(dòng)

# systemctl daemon-reload
# systemctl enable mysqld_exporter
# systemctl restart mysqld_exporter
# systemctl status mysqld_exporter

也可以直接運(yùn)行:

./mysqld_exporter --config.my-cnf=/usr/local/mysql_exporter/.my.cnf

此時(shí),mysqld_exporter啟動(dòng)后已經(jīng)開始采集指標(biāo)信息,可以通過地址訪問:

http://10.3.10.136:9104/metrics

?

3.3.2.2可視化配置

Prometheus配置: 修改prometheus.yml加入MySql節(jié)點(diǎn),將mysqld_exporter加入 prometheus.yml配置中

vi /etc/prometheus/prometheus.yml- job_name: 'Mysql'file_sd_configs:- files: ['/etc/prometheus/sd_cfg/Mysql.yml']refresh_interval: 5s

?

并在文件/etc/prometheus/sd_cfg/Mysql.yml中寫入如下內(nèi)容

- targets: ['10.3.10.136:9104']labels:instance: node_exporter_mysql_10.3.10.136

檢查并重啟服務(wù)

promtool check config /etc/prometheus/prometheus.yml

重啟prometheus生效

# systemctl restart prometheus
# systemctl status prometheus
3.3.2.3 查看監(jiān)控端是否介入

?

3.3.2.4 Granfana 導(dǎo)入Mysql 監(jiān)控圖表

Granfana 導(dǎo)入Mysql監(jiān)控圖表

推薦圖表ID:https://grafana.com/dashboards/7362

操作步驟:

Grafana首頁-->左上角圖標(biāo)-->Dashboard-->import

?

Upload已下載至本地的json文件(或者使用dashboard id,如這里的7362),如下:

?

?

數(shù)據(jù)源選擇"prometheus",即添加的數(shù)據(jù)源name,點(diǎn)擊"Import"按鈕,如下:

Mysql監(jiān)控展示

http://www.risenshineclean.com/news/3736.html

相關(guān)文章:

  • 做代練網(wǎng)站能備案營(yíng)銷網(wǎng)絡(luò)推廣哪家好
  • wordpress 韓版 企業(yè)seo模擬點(diǎn)擊
  • 達(dá)州住房和城鄉(xiāng)建設(shè)廳網(wǎng)站中國(guó)十大熱門網(wǎng)站排名
  • 怎么在wordpress建英文網(wǎng)站杭州seo價(jià)格
  • 中山精品網(wǎng)站建設(shè)機(jī)構(gòu)外貿(mào)網(wǎng)站如何推廣優(yōu)化
  • 物流網(wǎng)站建設(shè)公司外貿(mào)谷歌推廣怎么樣
  • 網(wǎng)站程序授權(quán)碼如何聯(lián)系百度人工客服
  • 域名網(wǎng)站可以做多個(gè)品牌產(chǎn)品嗎軟文推廣策劃方案
  • 國(guó)外專門做童裝的網(wǎng)站網(wǎng)絡(luò)營(yíng)銷的概念和含義
  • 長(zhǎng)春網(wǎng)站開發(fā)公司哪家好在線推廣
  • 網(wǎng)站置頂代碼100個(gè)成功營(yíng)銷策劃案例
  • 網(wǎng)站建設(shè)銷售問答seo查詢seo
  • 如何利用網(wǎng)絡(luò)廣告提升營(yíng)銷競(jìng)爭(zhēng)力班級(jí)優(yōu)化大師客服電話
  • 高端響應(yīng)式網(wǎng)站廣告聯(lián)盟平臺(tái)自動(dòng)賺錢
  • h5網(wǎng)站開發(fā)教程企業(yè)網(wǎng)站管理系統(tǒng)怎么操作
  • 丹陽論壇營(yíng)銷網(wǎng)站seo推廣
  • 如何看還在建設(shè)的網(wǎng)站營(yíng)銷軟文
  • 網(wǎng)站建設(shè)一年多少黑科技推廣軟件
  • 網(wǎng)站關(guān)鍵詞修改廣東東莞今日最新消息
  • 網(wǎng)站建設(shè)的公司做銷售惠州百度seo
  • 做網(wǎng)店哪個(gè)網(wǎng)站好seo排名快速
  • sketch做網(wǎng)站怎么建網(wǎng)站賣東西
  • 鄒城網(wǎng)站建設(shè)哪家便宜產(chǎn)品推廣營(yíng)銷方案
  • 專業(yè)的設(shè)計(jì)網(wǎng)站營(yíng)銷軟文的范文
  • 個(gè)人博客網(wǎng)站模板源碼廣州seo推廣服務(wù)
  • 手機(jī)網(wǎng)站開發(fā)蘋果5 鍵盤彈出遮擋網(wǎng)絡(luò)運(yùn)營(yíng)好學(xué)嗎
  • 門戶網(wǎng)站建設(shè)相關(guān)需求百度聯(lián)盟怎么賺錢
  • 做農(nóng)產(chǎn)品網(wǎng)站需要做的準(zhǔn)備谷歌app官方下載
  • http:設(shè)計(jì)家園.comwordpress培訓(xùn)考試優(yōu)化技術(shù)
  • wordpress menu插件seo的流程是怎么樣的