(2) Node_exporter and redis_exproter deployment of prometheus deployment

1. Deployment of node_exporter
1. Download and install node_exporter

~:wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz
~:groupadd prometheus
~:useradd -g prometheus -m -d /var/lib/prometheus -s /sbin/nologin prometheus
~:tar -zxf node_exporter-1.0.1.linux-amd64.tar.gz -C /usr/local/
~:cd /usr/local/
~:mv node_exporter-1.0.1.linux-amd64/ node_exporter
~:chown -R prometheus:prometheus node_exporter
~:vim /usr/lib/systemd/system/node_exporter.service
	[Unit]
	Description=node-exporter
	
	[Service]
	ExecStart=/usr/local/node_exporter/node_exporter
	
	[Install]
	WantedBy=multi-user.target

~:systemctl daemon-reload
~:systemctl start node_exporter.service
~:systemctl status node_exporter.service
~:systemctl enable node_exporter.service

2. Import and load in grafana——>https://grafana.com/api/dashboards/8919
Insert picture description here
3. Edit the prometheus.yml configuration file

  - job_name: 'node_exporter'
    static_configs:
    - targets:
      - 'xxxx.xxxx.xxxx.xxxx:9100'

4. Restart prometheus and visit again.

2. Deploy redis monitoring
1. Download redis_exproter

~:wget https://github.com/oliver006/redis_exporter/releases/download/v1.6.1/redis_exporter-v1.6.1.linux-amd64.tar.gz
~:tar -zxf redis_exporter-v1.6.1.linux-amd64.tar.gz
~:mv redis_exporter-v1.6.1.linux-amd64 /usr/local/redis_exporter
~:chown -R prometheus:prometheus /usr/local/redis_exporter
~:ss -tln | grep 9121

2. Establish a connection between redis_exproter and redis cluster

~:./redis_exporter -redis.addr xxxx.xxxx.xxxx.xxxx:7000  &

3. Edit the prometheus.yml configuration file and add the following content. https://www.cnblogs.com/fsckzy/p/12053604.html

  - job_name: 'redis_exporter_targets'
    static_configs:
      - targets:
        - redis://xxxx.xxxx.xxxx.xxxx:7000
        - redis://xxxx.xxxx.xxxx.xxxx:7001
        - redis://xxxx.xxxx.xxxx.xxxx:7002
        - redis://xxxx.xxxx.xxxx.xxxx:7003
        - redis://xxxx.xxxx.xxxx.xxxx:7004
        - redis://xxxx.xxxx.xxxx.xxxx:7005
    metrics_path: /scrape
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: xxxx.xxxx.xxxx.xxxx:9121

  - job_name: 'redis'
    static_configs:
      - targets: ['xxxx.xxxx.xxxx.xxxx:9121']

4. Restart prometheus, http://xxxx.xxxx.xxxx.xxxx:9090
Insert picture description here
5. Import in grafana, load——>11835
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_48226988/article/details/108979642