加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Using PGSNAP to Monitor PostgreSQL Database

发布时间:2020-12-13 17:45:00 所属栏目:百科 来源:网络整理
导读:前几天一位同事问我PostgreSQL有没有好的监控程序,因为一直都是自己写的脚本来实现的,其他的监控产品接触也不多,赶紧抽点时间补补功课。 数据库监控是一个非常重要的活,一般性把监控分为三类. 1. 实时告警类监控(不保留历史) 这一类的PostgreSQL监控有na

前几天一位同事问我PostgreSQL有没有好的监控程序,因为一直都是自己写的脚本来实现的,其他的监控产品接触也不多,赶紧抽点时间补补功课。

数据库监控是一个非常重要的活,一般性把监控分为三类.

1. 实时告警类监控(不保留历史)

这一类的PostgreSQL监控有nagios,等等。当然也可以自己写监控程序。

2. 准实时分析类监控(保留历史)

这一类的PostgreSQL监控有HQ,RHQ等等。当然也可以自己写监控程序。

3. 按需监控

这一类的PostgreSQL监控有PGSNAP,PGSTATSPACK等等。当然也可以自己写监控程序。

由于时间关系,先介绍一个部署比较简单,功能相对齐全,易于做集中监控的PGSNAP,以后有时间慢慢补充其他的,最后汇聚一个POSTGRESQL监控转贴。

安装PGSNAP需要的前提:

1.linux服务器

2.httpd

3.php-cli

4.php-common

5.php-pdo

6.php-pgsql

7.open-flash-chart1.9.7

安装完这些玩意之后,

解压pgsnap-0.5.0,将

open_flash_chart_object.php,

open-flash-chart.php,open-flash-chart.swf,and swfobject.js 拷贝到pgsnap-0.5.0/external

使用帮助:

This is ./pgsnap.php 0.5.0.

Usage:

./pgsnap.php [OPTIONS]… [DBNAME]

General options:

-a,–all build a report for all databases on the PostgreSQL server

-d DBNAME specify database name to connect to

(default: “root”)

-o outputdir specify output directory

(default: “”)

-S,–without-sysobjects

get report without system objects informations

–delete-if-exists

delete output directory if it already exists

–help show this help,then exit

–version output version information,then exit

Connection options:

-h HOSTNAME database server host or socket directory

(default: “”)

-p PORT database server port (default: “”)

-U NAME database user name (default: “root”)

-W prompt for password

使用举例

./pgsnap.php -d db_name -o /pgsnap_report_path –delete-if-exists -h db_ip -p db_port -U superuser_name -W

配置httpd:

配置根目录到/pgsnap_report_path

OK 可以使用WEB页面查看了。

后记:

pgsnap0.5.0暂时不支持PostgreSQL9.0

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读