prometheus + grafana install monitoring redis mysql mongodb Linux servers

prometheus:

              Prometheus is an open source system monitoring and alarm kit, originally released by the SoundCloud.         

Introducing:

1 Prometheus main program is mainly responsible for the storage, capture, aggregation, query terms. 
2  Alertmanager program, primarily responsible for implementing alarm.
. 3  Pushgateway procedure, is to achieve a Client receives index data push over, at a specified time interval, to capture by the main program.
4 * _exporter is a different kind of system integration has been achieved.

 

download link:

1 In the software under the address https: // github.com/prometheus/prometheus/releases/download/v2.17.1/prometheus-2.17.1.linux-amd64.tar.gz 
2 alarm plug-in download address https: // github.com /prometheus/alertmanager/releases/download/v0.20.0/alertmanager-0.20.0.linux-amd64.tar.gz 
3 MySQL monitoring client Download HTTPS: // github.com/prometheus/mysqld_exporter/releases/download/v0 .12.1 / mysqld_exporter-0.12.1.linux-amd64.tar.gz 
4 Linux server client Download HTTPS: // github.com/prometheus/node_exporter/releases/download/v1.0.0-rc.0/node_exporter-1.0 rc.0.linux-amd64.tar.gz-.0 
5 template Download https://grafana.com/grafana/dashboards?dataSource=influxdb&orderBy=name&direction=asc

 

prometheus deployment:

Downloading codecs:

1 wget https://github.com/prometheus/prometheus/releases/download/v2.17.1/prometheus-2.17.1.linux-amd64.tar.gz
2 wget
https://github.com/prometheus/node_exporter/releases/download/v1.0.0-rc.0/node_exporter-1.0.0-rc.0.linux-amd64.tar.gz
3 tar -xvzf prometheus-2.17.1.linux-amd64.tar.gz
4 tar -xvzf node_exporter-1.0.0-rc.0.linux-amd64.tar.gz
5 cd prometheus-2.17.1.linux-amd64
6 mkdir Linux Redis Mysql Mongodb

Add prometheus modify the configuration file:

static_configs:
- targets: ['本机IP:9090']

- job_name: 'Linux'
    file_sd_configs:
    - files: ['/usr/local/src/prometheus-2.17.0.linux-amd64/Linux/Linux.yml']
      refresh_interval: 5s
  - job_name: 'MysqlLinux'
    file_sd_configs:
    - files: ['/usr/local/src/prometheus-2.17.0.linux-amd64/Linux/MysqlLinux.yml']
      refresh_interval: 5s
  - job_name: 'RedislLinux'
    file_sd_configs:
    - files: ['/usr/local/src/prometheus-2.17.0.linux-amd64/Linux/RedisLinux.yml']
      refresh_interval:5s
  - job_name: 'MongodbLinux'
    file_sd_configs:
    - files: ['/usr/local/src/prometheus-2.17.0.linux-amd64/Linux/MongodbLinux.yml']
      refresh_interval: 5s
  - job_name: 'Mysql'
    file_sd_configs:
    - files: ['/usr/local/src/prometheus-2.17.0.linux-amd64/Mysql/Mysql.yml']
      refresh_interval: 5s
  - job_name: 'Redis'
    file_sd_configs:
    - files: ['/usr/local/src/prometheus-2.17.0.linux-amd64/Redis/Redis.yml']
      refresh_interval: 5s

Write sub configuration file, each surveillance client ports are different:

Linux vim / Linux.yml
 - Targets: [ ' monitoring host IP: 9100 ' ] 
  Labels: 
    name: Linux

Start prometheus

nohup ./prometheus --config.file=prometheus.yml &

Start node_exporter

nohup ./node_exporter >>/dev/null &

Login http: // prometheus: 9090 / targets can view the monitoring host is normal

Description:

     node_exporter to prometheus data collection, need to be deployed to the server to be monitored above, Once deployed, add a service corresponding address and port in the corresponding sub-prometheus configuration file

- Targets: [ ' monitoring host IP: 9100 ' ] 
  Labels: 
    name: Linux

 

 

grafana department

               Download the official website address http://docs.grafana.org/installation/rpm/

# Download software 
wget https://dl.grafana.com/oss/release/grafana-6.7.1-1.x86_64.rpm # now software dependencies yum the install the initscripts the fontconfig URW Fonts -Y- # grafana software installed yum install grafana -y -6.7.1-1.x86_64.rpm
# start the service
systemctl start grafana-server.service

      grafana default startup port 3000, visit http: // IP: 3000 default account and password admin / admin

1. Log grafang system

 

 Configuring Prometheus and add a data source connection Grafana

 

 Select prometheus

 

 

 Fill prometheus the corresponding IP address and port save 

 Importing Linux Monitoring Templates

 

 

 Select the downloaded template

 

 

 Import Template:

 

 

 View Linux monitoring:

 

 

 

 

 

 mysql monitor deployment:

           Installation node_exporter and mysqld_exporter on the need to monitor mysql

tar -xvf node_exporter-0.14.0.linux-amd64.tar.gz
cd node_exporter-0.14.0.linux-amd64
nohup ./node_exporter &
tar -xvf mysqld_exporter-0.10.0.linux-amd64.tar.gz
cd mysqld_exporter-0.10.0.linux-amd64
vi .my.cnf
[client]
user=root
password=root
nohup./mysqld_exporter -config.my-cnf=".my.cnf" &

Adding server configuration:

. 1 Vim the Linux / MysqlLinux.yml
 2 - Targets: [ ' monitored hosts the IP: 9100 ' ]
 . 3    Labels:
 . 4      name: the Linux
1 vim Mysql/Mysql.yml
2 - targets: ['mysqIP:9104']
3   labels:
4     name: Mysql

Import corresponding template mysql

 

 redis monitoring deployment:

         Installation node_exporter and redis_exporter on the need to monitor mysql

. 1 . -Xvf redis_exporter the tar-V0 . 11 .linux- amd64.tar.gz
 2 the nohup / opt / redis_exporter -redis.addr Redis: // the IP Address: 16379 -redis.password & Password

Adding server configuration:

Linux Vim / RedisLinux.Yml
   - Targets: [ ' 监控main desk IP: 9100 ' ] 
   Labels: 
     Name: Linux
 vim Redis/Redis.yml
 - targets: ['RedisIP:端口']
   labels:
     name: Redis

 mongodb monitoring deployment:

   updating.....................

Guess you like

Origin www.cnblogs.com/hushaojie/p/12606713.html