美文网首页
Prometheus+Grafana的安装添加zabbix监控

Prometheus+Grafana的安装添加zabbix监控

作者: hahashen | 来源:发表于2021-08-03 22:07 被阅读0次

    [root@bogon soft]# ll

    -rw-r--r-- 1 root root 25710888 Jul 27 11:12 alertmanager-0.21.0.linux-amd64.tar.gz

    -rw-r--r-- 1 root root 69491886 Jul 27 11:12 prometheus-2.27.1.linux-amd64.tar.gz

    [root@bogon soft]# tar -zxvf prometheus-2.27.1.linux-amd64.tar.gz

    [root@bogon soft]# mv prometheus-2.27.1.linux-amd64 /usr/local/prometheus

    [root@bogon soft]# cd /usr/local/prometheus/

    root@bogon prometheus]# nohup ./prometheus --config.file=prometheus.yml &

    在Prometheus中配置mysqld_exporter

    exporter启动了,需要在Prometheus中正确的配置。修改prometheus目录中的prometheus.yml,增加配置如下:

     - job_name: 'mysql'

        static_configs:

        - targets: ['localhost:9104']

           labels:

              instance: mysql

       static_configs:

        - targets: ['localhost:9090']

      - job_name: 'mysql'

    安装Grafana

    1、配置数据源

    首先,你要添加一个数据源,将Grafana和Prometheus关联起来。点击Add data source,如下填写数据保存即可: 

    操作步骤如下: 

    1 在左侧工具栏中,点击"Configuration"菜单

    2 点击"Data Sources"

    3 点击"Add data source"

    4 数据源Type选择“Prometheus”

    5 设置Prometheus服务访问地址(例如:http://localhost:9090)

    6 点击“Add”按钮,保存这个新数据源

    安装zabbix插件

    https://github.com/alexanderzobnin/grafana-zabbix

    [root@bogon bin]# ./grafana-cli plugins install alexanderzobnin-zabbix-app

    installing alexanderzobnin-zabbix-app @ 4.1.5

    from: https://grafana.com/api/plugins/alexanderzobnin-zabbix-app/versions/4.1.5/download

    into: /var/lib/grafana/plugins

    ✔ Installed alexanderzobnin-zabbix-app successfully

    Restart grafana after installing plugins . <service grafana-server restart>

    路径不同,需要拷贝到自己所安装的路径下

    [root@bogon grafana-7.3.5]# cd /var/lib/grafana/

    [root@bogon grafana]# ll

    total 0

    drwxr-xr-x 3 root root 40 Jul 27 16:04 plugins

    [root@bogon grafana]# cd plugins/

    [root@bogon plugins]# ll

    total 4

    drwxr-xr-x 8 root root 4096 Jul 27 16:04 alexanderzobnin-zabbix-app

    [root@bogon plugins]# cp -r alexanderzobnin-zabbix-app /soft/grafana-7.3.5/plugins-bundled/

    [root@bogon bin]# ./grafana-server restart

    [root@bogon conf]# pwd

    /soft/grafana-7.3.5/conf

    [root@bogon conf]# more defaults.ini

    # The http port to use

    http_port = 80

    [root@bogon bin]# ./grafana-server restart

    http://192.168.240.57/zabbix/api_jsonrpc.php

    添加CPU负载图形,平均一分钟到15分钟

    以下是添加图形的步骤,请关注:DevOps架构实战

    DevOps运维实战,Docker、K8s、Jenkins、Ansible让运维人不在孤寂的成长,分享、交流、沉淀、进步 。

    ----------------------end---------------------

    推荐阅读:

    测试环境快速部署K8s集群实战

    Docker如何快速构建Apollo项目

    Dockerfile 指令书写建议

    Dockerfile 最佳实践

    超简单--k8s部署dashboard实战

    相关文章

      网友评论

          本文标题:Prometheus+Grafana的安装添加zabbix监控

          本文链接:https://www.haomeiwen.com/subject/cgcyvltx.html