设为首页 加入收藏

TOP

CentOS 7.2下安装Prometheus和Grafana监控MySQL服务器性能(一)
2017-06-22 10:23:23 】 浏览:1356
Tags:CentOS 7.2 安装 Prometheus Grafana 监控 MySQL 服务器 性能

一、 Prometheus 是一个开源的服务监控系统和时间序列数据库。:
官方GitHub地址为:https://github.com/prometheus/prometheus
官方地址:https://prometheus.io/


官方拓扑图如下



特性:


二、安装Prometheus(服务器环境为CentOS 7.2,本实验服务端跟被监控MySQL在同一台服务器)
前提条件请关闭SELinux与Firewalld(centos6  为iptables)


下载安装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


编辑配置prometheus.yml文件,内容如下:


global:
  scrape_interval:    15s
  eva luation_interval: 15s
  external_labels:
      monitor: 'codelab-monitor'
rule_files:
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['192.168.1.199:9090']
  - job_name: linux
    static_configs:
      - targets: ['192.168.1.199:9100']
        labels:
          instance: db1
  - job_name: mysql
    static_configs:
      - targets: ['192.168.1.199:9104']
        labels:
          instance: db1


后台启动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 x86_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:51:16+08: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提供一个内置的web界面。我们可以通过http://192.168.1。199:9090访问



在 Status -> Targets 页面下,我们可以看到我们配置的两个Target,它们的 State



三、接下来我们安装client客户端
1、安装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=1


2、启动os监控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:

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Zabbix监控MySQL图文详解 下一篇Oracle快速彻底Kill掉等待会话

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目