ITPub博客

首页 > Linux操作系统 > Linux操作系统 > nagios 插件引发的 数据库告警

nagios 插件引发的 数据库告警

原创 Linux操作系统 作者:babyyellow 时间:2012-07-13 12:17:13 0 删除 编辑

pg 从库的日志里告警如下:

psql postgres postgres [local] 2012-07-13 09:54:13 CSTERROR:  cannot assign TransactionIds during recovery
psql postgres postgres [local] 2012-07-13 09:54:13 CSTSTATEMENT:  SET statement_timeout=30000;BEGIN;SET statement_timeout=30000;COMMIT;SELECT datname, age(datfrozenxid) FROM pg_database WHERE datallowconn ORDER BY 1, 2

诈一看,蒙了,

在查看nagios 的告警发现这个warning   check_postgresql_txn_wrapper  这个选项。

看了下代码发现了 证实执行了这个查询 “SELECT datname, age(datfrozenxid) FROM pg_database WHERE datallowconn ORDER BY 1, 2”

在主库上执行时没有问题的。可以正确的返回结构,然后去查age() 函数的  

发现age (datfrozenxid)   需要请求一个事务id      而从库时streaming 复制, 是只读访问的,自然不能分配一个事务id[code]

postgres=# \df age*
                                            List of functions
   Schema   | Name | Result data type |                   Argument data types                    |  Type  
------------+------+------------------+----------------------------------------------------------+--------
pg_catalog | age  | interval         | timestamp with time zone                                 | normal
pg_catalog | age  | interval         | timestamp with time zone, timestamp with time zone       | normal
pg_catalog | age  | interval         | timestamp without time zone                              | normal
pg_catalog | age  | interval         | timestamp without time zone, timestamp without time zone | normal
pg_catalog | age  | integer          | xid                                                      | normal
(5 rows)



[/code]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/133735/viewspace-735383/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
oracle MySQL Postgresql 专职数据库dba。 系统架构师。 mysql 官方认知dba 。 15年专职dba 经验。 潜意识沟通实证者 心理咨询师。 禅修布道者, 禅修指导员。 禅定实证者。

注册时间:2010-12-02

  • 博文量
    367
  • 访问量
    1908853