一、pg_monz介绍

1、介绍

pg_monz是一套用于专门监控pgsql的监控脚本,通过zabbix-sender将数据发送给server端。github上看软件介绍,是一个日本人写的。

github地址:https://github.com/pg-monz/pg_monz

2、适用场景

pg_monz适用多种场景,single PostgreSQL pattern, HA pattern with Streaming Replication and load balancing pattern with pgpool-II。

3、pg_monz组成:

(1) Templates

(2)后端脚本

Usr-local-bin目录

通过UserParameters调用定义在文件userparameter_pgsql.conf中的参数获取监控值。

(3) 配置文件

Usr-local-etc

  • pgsql_funcs.conf :连接PostgreSQL server的配置信息
  • pgpool_funcs.conf :连接 pgpool-II的配置信息

(4) UserParameter 配置文件

二、需求

软件需求:

重要:Agent上必须安装zabbix-sender

三、数据流

单实例模式

  • (1) Zabbix agent type item(key: psql.get…) executes monitoring information in bulk regularly.
  • (2) On the backend, scripts are executed to collect PostgreSQL statistics information according to UserParameter definitions.
  • (3) In these scripts, psql commands are executed to collect data from Database.
  • (4) The information which is collected at (3) is sent to Zabbix with zabbix_sender command.
  • (5) The data which is sent by zabbix_sender is registered to some Zabbix trapper items.

复制模式

To execute monitoring for Streaming Replication, you should assign the template for Streaming Replicaion to hosts. Streaming Replication template is linked to the template for single PostgreSQL. The (1)-(5) processes is similar to single PostgreSQL pattern.

There is only one different point. In this pattern, you should register the host for the whole Streaming Replication cluster. And you should assign ‘Template App PostgreSQL SR Cluster’ template to this host. So, this template execute aggregating the data to show the whole cluster status.(6)

集群模式

To execute monitoring for pgpool-II, you should assign the template for pgpool-II to hosts. To assign this template, the following process is executed.

  • (1) Zabbix agent type item(key: pgpool.get…) executes monitoring information in bulk regularly.
  • (2) On the backend, scripts are executed to collect PostgreSQL statistics information according to UserParameter definitions.
  • (3) In these scripts, psql commands are executed towards pgpool-II to collect data.
  • (4) The information which is collected at (3) is sent to Zabbix with zabbix_sender command.
  • (5) The data which is sent by zabbix_sender is registered to some Zabbix trapper items.

Like the Streaming Replication pattern, the whole status of pgpool-II cluster is monitored by assigning the template for pgpool-II cluster.(6)

四、安装部署

(1) Zabbix Agent配置

Agent必须对PostgreSQL logs and pgpool-II logs有执行权限。

(2) 安装 Zabbix-Sender

(3) 部署配置文件和脚本

文件:

cp usr-local-etc/* /usr/local/etc  #拷贝配置文件夹到对应目录
[root@bgp-bjzw-zabbix-server02 usr-local-etc]# cat pgsql_funcs.conf
PGHOST=127.0.0.1
PGPORT=5432
PGROLE=postgres
PGDATABASE=postgres
[root@bgp-bjzw-zabbix-server02 usr-local-etc]# cat pgpool_funcs.conf
PGPOOLHOST=127.0.0.1
PGPOOLPORT=9999
PGPOOLROLE=postgres
PGPOOLDATABASE=postgres
PGPOOLCONF=/usr/local/etc/pgpool.conf

脚本:

cp usr-local-bin/* /usr/local/bin
chmod +x /usr/local/bin/*.sh

userparameter_pgsql.conf

cp userparameter_pgsql.conf  /etc/zabbix/zabbix_agentd.conf.d/userparameter_pgsql.conf

(4) 导入模板

[root@bgp-bjzw-zabbix-server02 template]# ll
total 276
-rw-r--r-- 1 root root   6216 May 26  2016 Template_App_pgpool-II_watchdog.xml
-rw-r--r-- 1 root root  53618 May 26  2016 Template_App_pgpool-II.xml
-rw-r--r-- 1 root root   7974 May 26  2016 Template_App_PostgreSQL_SR_Cluster.xml
-rw-r--r-- 1 root root  39832 May 26  2016 Template_App_PostgreSQL_SR.xml
-rw-r--r-- 1 root root 164024 May 26  2016 Template_App_PostgreSQL.xml
[root@bgp-bjzw-zabbix-server02 template]# 

(5) 配置模板宏(macro参数)

(6) 主机上套(套模板)

五、监控项介绍

六、效果图(部分)

因为监控项和图表太多,以下只是截取部分效果图进行展示。

七、文献参考

http://pg-monz.github.io/pg_monz/index-en.html

 

转载于:https://www.cnblogs.com/skyflask/articles/8004772.html

Zabbix实战-简易教程--DB类--Pgsql(pg_monz介绍)相关推荐

  1. Zabbix实战-简易教程--订阅类

    一.需求提出 最近数据中心有一个新的需求,有一批后台任务需要在每天固定时间点运行(凌晨8:00),现在希望能够把这个任务执行的结果定时上报给他. 说明:执行的任务为一个sql查询,查询出来的是每个任务 ...

  2. Zabbix实战-简易教程--拓扑图(Maps)

    一.拓扑图(Maps) 二话不说,有图有真相,先看看效果,再详细讲解配置过程: 图1:全国网络质量图 图2 核心机房网络质量图 二.详细配置 1.添加  map 选择 系统管理-->基础配置-- ...

  3. Android实战简易教程-第三十九枪(第三方短信验证平台Mob和验证码自动填入功能结合实例)

    用户注册或者找回密码时一般会用到短信验证功能,这里我们使用第三方的短信平台进行验证实例. 我们用到第三方短信验证平台是Mob,地址为:http://mob.com/ 一.注册用户.获取SDK 大家可以 ...

  4. Android实战简易教程-第五十一枪(ListView实现子控件的动态显示和隐藏、checkbox全选和反选)

    前段时间写过一篇文章:Android实战简易教程-第四十七枪(ListView多选-实现点餐系统)有的同学留言建议,可不可以动态控制checkbox的显示和全选反选功能,我研究了一下,发现实现也比较容 ...

  5. Android实战简易教程-第五十枪(工具类的测试)

    在开发中,为了提高开发效率,我们一般会自定义自己的工具类.为了保证项目的可靠性,在将工具类引入项目之前,我们一般都会对工具类进行单元测试,下面我们通过一个实例看一下如何搭建测试环境. 1.首先自定义一 ...

  6. Android实战简易教程-第七十五枪(WIFI直连工具类)

    设置指定的WIFI用户名密码和加密方式,可以进行WIFI直连. 1.工具类-WifiUtil.java: package demo.androidwar.com.myapplication;impor ...

  7. Android实战简易教程-第六十六枪(服务器端搭建和服务器端Json数据交互)

    学习Android有一段时间了,对服务器端有很深的好奇,决定对服务器端的实现进行一些研究,这里实现了一个简单的小例子,用于获取服务器端的json数据,例子很简单,适合初学者学习使用. 服务器端 首先我 ...

  8. Android实战简易教程-第六十五枪(自定义控件实现数字液晶时钟Demo)

    下面我们研究一下如何实现一个数字液晶时钟,本质属于特效一种哈. 首先创建一个布局文件: <?xml version="1.0" encoding="utf-8&qu ...

  9. Android实战简易教程-第三十四枪(基于ViewPager和FragmentPagerAdapter实现滑动通用Tab)...

    上一段时间写过一篇文章<基于ViewPager实现微信页面切换效果> 里面实现了相似微信Tab的页面.可是这样的实现方法有个问题.就是以后全部的代码逻辑都必须在MainActivity中实 ...

最新文章

  1. Ajax接收Java异常_java – 处理来自Servlet的Jquery AJAX响应中的异常
  2. 面向对象程序设计上机练习一(函数重载)
  3. excel公式 某一个单元格等于另一个单元格的值_15个excel小技巧,简单易学,一看就会,收藏备用吧...
  4. vivo手机解锁_关于手机“解锁”的话题,vivo屏幕指纹技术很有话语权
  5. python 类方法装饰器_python类装饰器即__call__方法
  6. java 方法 示例_Java Collectionsfrequency()方法与示例
  7. 回溯算法之幸运的袋子
  8. Mongodb存储特性与内部原理
  9. 在 ML2 中配置 OVS vlan network - 每天5分钟玩转 OpenStack(136)
  10. BZOJ 3261: 最大异或和 [可持久化Trie]
  11. 软件开发:到底谁还在传言软件巨头濒临死亡?
  12. 编程学习记录1:编程的一些简单概念
  13. java csv下载_javacsv.jar
  14. 扩展卡尔曼滤波python_扩展卡尔曼滤波EKF与多传感器融合
  15. 微信小程序获取access_token报错errcode: 40125,errmsg: invalid appsecret
  16. Go Anywhere Chair
  17. 电脑取消撤销快捷键是什么_电脑撤销快捷键是什么?这个万能快捷键适合各种电脑软件...
  18. 深度学习GPU选购指南:哪款显卡配得上我的炼丹炉?
  19. e签宝认证服务API PHP请求签名鉴权生成
  20. latex怎么给图片命名_[Latex] Beamer 入门

热门文章

  1. flutter 的sketch切图
  2. 超级简单的3D slicer使用教程(一)
  3. 阿里Java架构师讲解购物车的原理及实现
  4. 月销售额224万美金的Shopify独立站卖家实操详解
  5. ZZULIOJ--1261: 小媛在努力
  6. ios 查看app 包名 id
  7. 计算机专业中的一些术语
  8. 趣出行APP被指存在四项涉嫌隐私不合规问题,仍借虚拟货币宣传?
  9. python数组一维转三维_python数组一维变二维
  10. 一文让你搞懂什么是Redis集群