In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
First, Prometheus is an open source service monitoring system and time series database. :
The official GitHub address is https://github.com/prometheus/prometheus
Official address: https://prometheus.io/
The official topology diagram is as follows
Properties:
High dimensional data model
Custom query language
Visual data display
Efficient storage strategy
Easy to operate and maintain
Provide a variety of client development libraries
Warning and alarm
Data export
Second, install Prometheus (the server environment is Centos7.2, and the server of this experiment is on the same server as the monitored MySQL)
Please turn off SELinux and Firewalld (centos6 is iptables).
Download and install prometheus$ wget https://github.com/prometheus/prometheus/releases/download/v1.7.1/prometheus-1.7.1.linux-amd64.tar.gz$ mkdir / opt/prometheus$ tar zxf prometheus-1.7.1.linux-amd64.tar.gz-C / opt/prometheus-- strip-components=1 edit configuration prometheus.yml file The contents are as follows: global: scrape_interval: 15s evaluation_interval: 15s external_labels: monitor: 'codelab-monitor'rule_files:scrape_configs:-job_name:' prometheus' static_configs:-targets: ['192.168.1.199targets 9090']-job_name: linux static_configs:-targets: [' 192.168.1.199pur9100'] labels: Instance: db1-job_name: mysql static_configs:-targets: ['192.168.1.19909104'] labels: instance: db1 background launches prometheus nohup / opt/prometheus/prometheus-config.file=prometheus.yml & tail-200f nohup.out time= "2017-06-12T11:51:16+08:00" level=info msg= "Starting prometheus (version=1.7.0) Branch=master, revision=bfa37c8ee39d11078662dce16c162a61dccf616c) "source=" main.go:88 "time=" 2017-06-12T11:51:16+08:00 "level=info msg=" Build context (go=go1.8.3, user=root@7a6329cc02bb Date=20170607-09:43:48) "source=" main.go:89 "time=" 2017-06-12T11:51:16+08:00 "level=info msg=" Host details (Linux 3.10.0-327.el7.x86_64 # 1 SMP Thu Nov 19 22:10:57 UTC 2015 x 86 million 64 monitor (none)) "source=" main.go:90 "time=" 2017-06-12T11:51:16+08:00 "level=info msg=" Loading configuration file prometheus.yml "source=" main.go:252 "time=" 2017-06-12T11 : 51VR 1608 00 "level=info msg=" Loading series map and head chunks... " Source= "storage.go:428" time= "2017-06-12T11:51:16+08:00" level=info msg= "2200 series loaded. Source= "storage.go:439" time= "2017-06-12T11:51:16+08:00" level=info msg= "source=" web.go:259 "Prometheus provides a built-in web interface. We can visit it through http://192.168.1.
Under the Status-> Targets page, we can see the two Target we configured, their State
Third, let's install the client client
1 、 Install client$ wget https://github.com/prometheus/node_exporter/releases/download/v0.14.0/node_exporter-0.14.0.linux-amd64.tar.gz$ wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.10.0/mysqld_exporter-0.10.0.linux-amd64.tar.gz$ mkdir / opt/prometheus_exporters$ tar zxf node_exporter-0.14.0.linux-amd64.tar.gz-C / opt/prometheus_ Exporters-strip-components=1 & & tar zxf mysqld_exporter-0.10.0.linux-amd64.tar.gz-C / opt/prometheus_exporters-strip-components=12, Launch os to monitor client nohup / opt/prometheus_exporters/node_exporter & tail-200f nohup.out time= "2017-06-12T11:28:52+08:00" level=info msg= "- hwmon" source= "node_exporter.go:162" time= "2017-06-12T11:28:52+08:00" level=info msg= "- netstat" source= "node_exporter.go:162" time= "2017-06-12T11:28:52+08:00" level=info msg= "- stat" source= "node_exporter.go:162" time= "2017 -06-12T11:28:52+08:00 "level=info msg="-vmstat "source=" node_exporter.go:162 "time=" 2017-06-12T11:28:52+08:00 "level=info source=" node_exporter.go:186 3. Mysqld_exporter needs to connect to MySQL Need to authorize mysql > GRANT REPLICATION CLIENT, PROCESS ON *. * TO 'monitor'@'localhost' identified by' test123' Mysql > GRANT SELECT ON performance_schema.* TO 'monitor'@'localhost' 4 、 Create a .my.cnf file and run mysqld_ exporter [root @ monitor prometheus_exporters] # cat .my.cnf [client] user=monitorpassword=test123 [root@monitor prometheus_exporters] # export DATA_SOURCE_NAME= "monitor:test123@ (monitor:3306) /" # (monitor:3306) / this monitor hostname launches mysqld_exporternohup / opt/prometheus_exporters/mysqld_exporter-config.my-cnf= ".my.cnf" & tail-200f nohup.outtime= "2017-06-12T11:30" : 0728 level=info msg= 00 "level=info msg=" Starting mysqld_exporter (version=0.10.0 Branch=master, revision=80680068f15474f87847c8ee8f18a2939a26196a) "source=" mysqld_exporter.go:460 "time=" 2017-06-12T11:30:07+08:00 "level=info msg=" Build context (go=go1.8.1, user=root@3b0154cd9e8e, date=20170425-11:24:12) "source=" mysqld_exporter.go:461 "time=" 2017-06-12T11:30:08+08:00 "level=info msg=" source= "mysqld_exporter.go:479"
When we go back to 192.168.1.19991, we can see that
Status-> Targets page
IV. Install and run Grafana
1. The dashboardsGrafana that installs Grafana#wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.3.2-1.x86_64.rpm # yum localinstall grafana-4.3.2-1.x86_64.rpm to replace grafana does not have too many configured chart templates. In addition to some open source Percona, many need to be configured on their own. Download dashboards (https://github.com/percona/grafana-dashboards)git clone https://github.com/percona/grafana-dashboards.gitcp-r grafana-dashboards/dashboards / var/lib/grafana/2, edit configuration file / etc/grafana/grafana.ini Modify the values of the two parameters under the dashboards.json paragraph: [dashboards.json] enabled = truepath = / var/lib/grafana/dashboards2, run Grafana systemctl start grafana-server# [root@monitor prometheus_exporters] # ps aux | grep grafanaroot 3211 0.0 112664 972 pts/1 S+ 11:40 grep-- color=auto grafanagrafana 21241 0.3 0.8 805720 39620? Ssl 12 June 4:42 / usr/sbin/grafana-server-- config=/etc/grafana/grafana.ini-- pidfile= cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins
We can access the Grafana web interface through http://192.168.1.199:3000 (the default account / password is admin/admin):
Log in and set up the data source
At this point, the work is done.
We can see the os and database monitoring data.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.