日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
Zabbix監(jiān)控PostgreSQL

Zabbix監(jiān)控PostgreSQL

學(xué)習(xí) PostgreSQL zabbix

創(chuàng)新互聯(lián)公司主要從事網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站設(shè)計(jì)、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)古塔,10年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):028-86922220

  • Zabbix監(jiān)控PostgreSQL

    • 1. 安裝libzbxpgsql

    • 2. 配置zabbix配置文件zabbix_agentd.conf

    • 3. 創(chuàng)建監(jiān)控用戶

    • 4. 導(dǎo)入監(jiān)控模板

    • 5. 主機(jī)鏈接模板,設(shè)置宏變量

因上次用到了PostgreSQL,而所使用的監(jiān)控又是Zabbix,所以找到了此插件用于Zabbix監(jiān)控PostgreSQL。

插件網(wǎng)站:PostgreSQL monitoring for Zabbix 
Github地址:https://github.com/cavaliercoder/libzbxpgsql

環(huán)境: 
CentOS6.8 
Zabbix3.2.1 
PostgreSQL9.5.6

1. 安裝libzbxpgsql

根據(jù)官方文檔進(jìn)行安裝即可。 
http://cavaliercoder.com/libzbxpgsql/documentation/module-installation/

rpm -ivh https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-3.noarch.rpm
yum -y install postgresql95-libs  # 已經(jīng)安裝可忽略
yum -y install libconfig
wget http://cdn.cavaliercoder.com/libzbxpgsql/yum/zabbix32/rhel/6/x86_64/libzbxpgsql-1.1.0-1.el6.x86_64.rpm
[root@im109 packages]# find / -name libzbxpgsql.so
[root@im109 packages]# rpm -ivh --force libzbxpgsql-1.1.0-1.el6.x86_64.rpm
error: Failed dependencies:
       libconfig.so.8()(64bit) is needed by libzbxpgsql-1.1.0-1.x86_64
       zabbix-agent >= 3.0.0 is needed by libzbxpgsql-1.1.0-1.x86_64
[root@im109 packages]# rpm -ivh --force libzbxpgsql-1.1.0-1.el6.x86_64.rpm --nodeps
Preparing...                ########################################### [100%]
  1:libzbxpgsql            ########################################### [100%]
[root@im109 packages]# find / -name libzbxpgsql.so                        
/usr/lib64/zabbix/modules/libzbxpgsql.so
[root@im109 packages]# ln -s /usr/lib64/zabbix/modules/libzbxpgsql.so /usr/local/zabbix/lib/

2. 配置zabbix配置文件zabbix_agentd.conf

Zabbix監(jiān)控PostgreSQL

[root@im109 log]# /usr/local/zabbix/sbin/zabbix_agentd -t pg.modver
zabbix_agentd [21910]: starting agent module libzbxpgsql 1.1.0
zabbix_agentd [21910]: using module configuration file: /etc/zabbix/libzbxpgsql.conf
pg.modver                                     [s|libzbxpgsql 1.1.0, compiled for Zabbix 3.2.3]
[root@im109 log]# /etc/init.d/zabbix-agentd restart
Shutting down Zabbix agent:                                [  OK  ]
Starting Zabbix agent:                                     [  OK  ]

3. 創(chuàng)建監(jiān)控用戶

創(chuàng)建一個(gè)用戶,開放你所要監(jiān)控的數(shù)據(jù)庫只讀權(quán)限給它,為了安全,把權(quán)限做到最小化。 
我用的pgpool-II。

psql -h 10.1.0.115 -U postgres -p9999         
Password for user postgres:
psql (9.5.6)
Type "help" for help.

postgres=# CREATE ROLE monitoring WITH LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE;
CREATE ROLE
postgres=# GRANT CONNECT ON DATABASE wiseucmsg TO monitoring;        
GRANT
postgres=# alter user monitoring with password 'password';
ALTER ROLE

使用創(chuàng)建的用戶能登錄查看相應(yīng)數(shù)據(jù)庫,則可進(jìn)行下一步。

[root@im109 pgpool-II]# psql -h localhost -U monitoring -p 54321 wiseucmsg
psql (9.5.6)
Type "help" for help.

wiseucmsg=> \l
                                 List of databases
  Name    |  Owner  | Encoding|   Collate  |    Ctype    |   Access privileges  
-----------+----------+----------+-------------+-------------+-----------------------
postgres  | postgres| UTF8    | en_US.UTF-8| en_US.UTF-8|
template0| postgres| UTF8    | en_US.UTF-8| en_US.UTF-8| =c/postgres          +
         |          |          |            |            | postgres=CTc/postgres
template1| postgres| UTF8    | en_US.UTF-8| en_US.UTF-8| =c/postgres          +
         |          |          |            |            | postgres=CTc/postgres
wiseucmsg| postgres| UTF8    | en_US.UTF-8| en_US.UTF-8| =Tc/postgres         +
         |          |          |            |            | postgres=CTc/postgres+
         |          |          |            |            | monitoring=c/postgres
(4 rows)

wiseucmsg=>

4. 導(dǎo)入監(jiān)控模板

模板在Github上有: 
https://github.com/cavaliercoder/libzbxpgsql/tree/master/templates

5. 主機(jī)鏈接模板,設(shè)置宏變量

Zabbix監(jiān)控PostgreSQL

Zabbix監(jiān)控PostgreSQL

{$PG_CONN} => host=localhost port=54321 user=monitoring connect_timeout=10 
{$PG_DB} => wiseucmsg

Zabbix監(jiān)控PostgreSQL

有圖形出現(xiàn),則監(jiān)控成功。

附件:http://down.51cto.com/data/2366485

新聞標(biāo)題:Zabbix監(jiān)控PostgreSQL
標(biāo)題網(wǎng)址:http://www.dlmjj.cn/article/pieccs.html