新聞中心
監(jiān)控系統(tǒng)看這一篇就夠了!Zabbix、Prometheus等常見監(jiān)控教程

成都創(chuàng)新互聯(lián)公司是一家以重慶網(wǎng)站建設(shè)公司、網(wǎng)頁設(shè)計(jì)、品牌設(shè)計(jì)、軟件運(yùn)維、成都網(wǎng)站營銷、小程序App開發(fā)等移動開發(fā)為一體互聯(lián)網(wǎng)公司。已累計(jì)為陽臺護(hù)欄等眾行業(yè)中小客戶提供優(yōu)質(zhì)的互聯(lián)網(wǎng)建站和軟件開發(fā)服務(wù)。
在現(xiàn)代的IT環(huán)境中,監(jiān)控系統(tǒng)是不可或缺的一部分,它們可以幫助我們實(shí)時了解系統(tǒng)的運(yùn)行狀態(tài),及時發(fā)現(xiàn)和解決問題,保證系統(tǒng)的穩(wěn)定運(yùn)行,本文將介紹兩種常見的監(jiān)控系統(tǒng):Zabbix和Prometheus,包括它們的安裝、配置和使用等內(nèi)容。
Zabbix監(jiān)控系統(tǒng)
1、Zabbix簡介
Zabbix是一個開源的網(wǎng)絡(luò)監(jiān)控工具,可以監(jiān)控各種網(wǎng)絡(luò)參數(shù),保證服務(wù)器系統(tǒng)的安全運(yùn)行,它可以監(jiān)控網(wǎng)絡(luò)設(shè)備、服務(wù)器、虛擬機(jī)等各種資源,提供圖形化的報(bào)表,支持多種通知方式。
2、Zabbix的安裝
Zabbix的安裝主要包括安裝Zabbix Server、Zabbix Proxy和Zabbix Agent三個部分。
(1)安裝Zabbix Server
我們需要在服務(wù)器上安裝Zabbix Server,在Ubuntu系統(tǒng)中,可以通過以下命令進(jìn)行安裝:
sudo aptget update sudo aptget install zabbixservermysql zabbixfrontendphp
(2)安裝Zabbix Proxy
Zabbix Proxy是一個中間代理,用于收集來自Zabbix Agent的數(shù)據(jù),在Ubuntu系統(tǒng)中,可以通過以下命令進(jìn)行安裝:
sudo aptget install zabbixproxymysql
(3)安裝Zabbix Agent
Zabbix Agent是一個守護(hù)進(jìn)程,用于收集本地主機(jī)的數(shù)據(jù),在Ubuntu系統(tǒng)中,可以通過以下命令進(jìn)行安裝:
sudo aptget install zabbixagent
3、Zabbix的配置
Zabbix的配置主要包括配置Zabbix Server、Zabbix Proxy和Zabbix Agent。
(1)配置Zabbix Server
我們需要配置Zabbix Server的數(shù)據(jù)庫,在MySQL中創(chuàng)建一個名為zabbix的數(shù)據(jù)庫,并授權(quán)給zabbix用戶,編輯Zabbix Server的配置文件/etc/zabbix/zabbix_server.conf,設(shè)置數(shù)據(jù)庫的連接信息,重啟Zabbix Server。
(2)配置Zabbix Proxy
編輯Zabbix Proxy的配置文件/etc/zabbix/zabbix_proxy.conf,設(shè)置數(shù)據(jù)庫的連接信息,重啟Zabbix Proxy。
(3)配置Zabbix Agent
編輯Zabbix Agent的配置文件/etc/zabbix/zabbix_agentd.conf,設(shè)置Server和Proxy的地址,重啟Zabbix Agent。
Prometheus監(jiān)控系統(tǒng)
1、Prometheus簡介
Prometheus是一個開源的系統(tǒng)監(jiān)控和警報(bào)工具包,它的設(shè)計(jì)目標(biāo)是處理大規(guī)模的服務(wù)和系統(tǒng)監(jiān)控,Prometheus的主要特性包括多維數(shù)據(jù)模型、靈活的查詢語言和高效的存儲策略。
2、Prometheus的安裝
Prometheus的安裝主要包括下載和解壓Prometheus、配置Prometheus和啟動Prometheus三個步驟。
(1)下載和解壓Prometheus
從Prometheus的官方網(wǎng)站下載最新的版本,然后解壓到合適的目錄。
wget https://github.com/prometheus/prometheus/releases/download/v2.30.3/prometheus2.30.3.linuxamd64.tar.gz tar xvfz prometheus2.30.3.linuxamd64.tar.gz cd prometheus2.30.3.linuxamd64
(2)配置Prometheus
編輯Prometheus的配置文件prometheus.yml,設(shè)置數(shù)據(jù)存儲的位置和采集的目標(biāo)。
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
alerting:
alertmanagers: [] # Alertmanager configurations. There must be at least one alertmanager config present. # alertmanager:9093 # If global alertmanager section is not specified, this value will be used as default # See "Alerting" section for more details on alert manager configuration options. # scrape_configs: # By default, Prometheus will scrape itself, as well as any targets in the same job that you have specified in your configuration file (see scrape_configs). # Job name is added as a label job= to any timeseries scraped from this job. # metrics_path defaults to '/metrics' # scheme defaults to 'http'. # static_configs: # targets: ['localhost:9090'] # labels: # region: 'useast1' # group: 'test' # Here are some additional scrape configuration examples: # job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http' # static_configs: # targets: ['localhost:9090'] # labels: # region: 'useast1' # group: 'test' # job_name: 'node_exporter' # metrics_path defaults to '/metrics' # scheme defaults to 'http' # static_configs: # targets: ['localhost:9100'] # labels: # region: 'useast1' # group: 'test' # job_name: 'cadvisor' # metrics_path defaults to '/metrics' # scheme defaults to 'http' # static_configs: # targets: ['localhost:8080'] # labels: # region: 'useast1' # group: 'test' # job_name: 'blackbox' # metrics_path defaults to '/metrics' # scheme defaults to 'http' # static_configs: # targets: ['localhost:9115'] # labels: # region: 'useast1' # group: 'test' # relabel_configs: # Relabel configs to be applied to samples before ingestion into the database. # Below are some example rule configurations to relabel data for Prometheus. See full documentation for available relabeling options and syntax of relabeling expressions in Prometheus configuration files. # relabel_configs: # source_labels: [__address__] # target_label: instance # replace '__address__' with actual source label(s) # action: keep # Other Prometheus configuration options can be found here
網(wǎng)站標(biāo)題:監(jiān)控系統(tǒng)看這一篇就夠了!Zabbix、Prometheus等常見監(jiān)控教程
URL網(wǎng)址:http://m.fisionsoft.com.cn/article/djhdgoj.html


咨詢
建站咨詢
