IDO DB 中没有带有 Icinga2 Web2 的历史数据
No Historical Data in IDO DB with Icinga2 Web2
上下文
我正在使用 IDO PostgreSQL
和 IDO MySQL
在 CentOS 7
上使用 Ansible
配置 Icinga2
Web2
。
我的工作基于出色的 https://github.com/Icinga/icinga2-ansible 角色。我已将项目 (mickael-ange/icinga2-ansible) 分叉以添加更多自动化和支持,例如 IDO PostgreSQL。我正在使用 PostgreSQL 服务器 9.4.
好吧,我最终得到了 icinga2-ansible-web2-ui
角色的一个版本,它使用 IDO PostgreSQL 或 IDO MySQL 自动安装 Icinga2 Web2 无需向导.
我的问题
服务器似乎正常工作,但我无法弄清楚如何在 Icinga2 Web2 界面中获取数据,例如:
Comments
和 Downtimes
来自 Overview
菜单
Event Grid
、Event Overview
、Notifications
、Timeline
来自 History
菜单
我可以创建 Comments
和 Schedule Downtimes
,但它们没有在 UI 中列出。正确处理停机时间。
我可以发送 Notifications
但他们也没有在 UI 中列出。当 SELinux 处于宽容模式时发出通知。
我的问题是:是否有任何 IDO 或 Icinga2 Web2 配置可以让数据库填充评论、停机时间等?
我的/etc/icinga2/features-enabled/ido-pgsql.conf
library "db_ido_pgsql"
object IdoPgsqlConnection "ido-pgsql" {
user = "icinga"
password = "icinga"
host = "localhost"
database = "icinga"
table_prefix = "icinga_"
instance_name = "icinga2"
instance_description = "icinga2 instance"
cleanup = {
downtimehistory_age = 48h
logentries_age = 31d
}
categories = DbCatConfig | DbCatState
}
备注
注一
我已经在 Icinga2 项目和论坛的大部分文档中进行了搜索,但我找不到雪茄。我很惊讶 none 以前遇到过这个问题,所以这可能是我这边的问题。
注2
在 Icinga IRC 频道上聊天并做了更多测试后,我发现 我的问题只发生在 PostgreSQL 后端 上。它与 MySQL 后端一起按预期工作。
调试会话
调试会话 1
我收集了更多关于我的环境的 info/logs。
PostgreSQL 权限
我检查了我的 PostgreSQL icinga 用户权限:
TABLE
权限设置为 SELECT
,INSERT
,UPDATE
,DELETE
SEQUENCE
权限设置为 USAGE
我什至尝试将 postgres
配置为用户以访问后端(icinga_ido
和 icingaweb_ido
资源),但我仍然没有在中列出任何 Comments
UI(创建评论后)。
这里是 \dp
命令列出的 PosgreSQL 权限:
icinga=> \dp
Access privileges
Schema | Name | Type | Access privileges | Column access privileges
--------+-----------------------------------------------------------------+----------+---------------------------+--------------------------
public | icinga_acknowledgements | table | postgres=arwdDxt/postgres+|
| | | icinga=arwd/postgres |
public | icinga_acknowledgements_acknowledgement_id_seq | sequence | postgres=rwU/postgres +|
| | | icinga=U/postgres |
public | icinga_commands | table | postgres=arwdDxt/postgres+|
| | | icinga=arwd/postgres |
public | icinga_commands_command_id_seq | sequence | postgres=rwU/postgres +|
| | | icinga=U/postgres |
public | icinga_commenthistory | table | postgres=arwdDxt/postgres+|
| | | icinga=arwd/postgres |
public | icinga_commenthistory_commenthistory_id_seq | sequence | postgres=rwU/postgres +|
| | | icinga=U/postgres |
<truncated>
此外,我在 PostgreSQL 日志(例如 /var/lib/pgsql/9.4/data/pg_log/postgresql-Thu.log)中没有错误,当从 Icinga UI.
但是,我发现尝试使用 icinga
用户从 pgAdmin
UI 浏览 SEQUENCE
时出现错误(postgres
用户没有错误):
< 2016-01-21 03:55:52.436 GMT >STATEMENT: SELECT last_value, min_value, max_value, cache_value, is_cycled, increment_by, is_called
FROM icinga_acknowledgements_acknowledgement_id_seq
但我不确定这是否有意义,因为 icinga
用户对 SEQUENCE
只有 USAGE
权限。
比较 PostgreSQL 和 MySQL 后端的调试日志
所以当我创建评论时,我最终比较了两边的 Icinga 调试日志(MySQL IDO 和 PostgreSQL IDO)。我可以看到只有 MySQL 后端才有我正在寻找的 SQL 语句,它们在 icinga_externalcommands
、icinga_comments
和 icinga_commenthistory
表中插入数据。
我没有足够的声誉来提供超过 2 个链接(例如 pastebin)。所以这是日志。
添加 Comment
与 PostgreSQL 后端:
[2016-01-21 04:14:00 +0000] information/ExternalCommandListener: Executing external command: [1453349640] ADD_HOST_COMMENT;icinga2-web2-postgres;1;icingaadmin;dededewdwwewdew
[2016-01-21 04:14:00 +0000] debug/DbEvents: add external command history
[2016-01-21 04:14:00 +0000] notice/ExternalCommandProcessor: Creating comment for host icinga2-web2-postgres
[2016-01-21 04:14:00 +0000] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/api/packages/_api/icinga2-web2-postgres-1453347670-1/conf.d/comments/icinga2-web2-postgres!icinga2-web2-postgres-1453349640-1.conf
[2016-01-21 04:14:00 +0000] information/ConfigItem: Committing config items
[2016-01-21 04:14:00 +0000] warning/ApplyRule: Apply rule 'satellite-host' (in /etc/icinga2/conf.d/satellite.conf: 29:1-29:41) for type 'Dependency' does not match anywhere!
[2016-01-21 04:14:00 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/conf.d/services.conf: 57:1-57:65) for type 'Service' does not match anywhere!
[2016-01-21 04:14:00 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/conf.d/services.conf: 65:1-65:53) for type 'Service' does not match anywhere!
[2016-01-21 04:14:00 +0000] information/ConfigItem: Instantiated 1 Comment.
[2016-01-21 04:14:00 +0000] information/ConfigItem: Triggering Start signal for config items
[2016-01-21 04:14:00 +0000] information/ConfigItem: Activated all objects.
[2016-01-21 04:14:00 +0000] notice/Comment: Added comment 'icinga2-web2-postgres!icinga2-web2-postgres-1453349640-1'.
[2016-01-21 04:14:01 +0000] debug/IdoPgsqlConnection: Query: COMMIT
[2016-01-21 04:14:01 +0000] debug/IdoPgsqlConnection: Query: BEGIN
添加 Comment
和 MySQL 后端:
[2016-01-21 04:12:49 +0000] information/ExternalCommandListener: Executing external command: [1453349569] ADD_HOST_COMMENT;icinga2-web2-mysql;1;icingaadmin;yggygyyj
[2016-01-21 04:12:49 +0000] debug/DbEvents: add external command history
[2016-01-21 04:12:49 +0000] notice/ExternalCommandProcessor: Creating comment for host icinga2-web2-mysql
[2016-01-21 04:12:49 +0000] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/api/packages/_api/icinga2-web2-mysql-1453347256-1/conf.d/comments/icinga2-web2-mysql!icinga2-web2-mysql-1453349569-0.conf
[2016-01-21 04:12:49 +0000] information/ConfigItem: Committing config items
[2016-01-21 04:12:49 +0000] warning/ApplyRule: Apply rule 'satellite-host' (in /etc/icinga2/conf.d/satellite.conf: 29:1-29:41) for type 'Dependency' does not match anywhere!
[2016-01-21 04:12:49 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/conf.d/services.conf: 57:1-57:65) for type 'Service' does not match anywhere!
[2016-01-21 04:12:49 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/conf.d/services.conf: 65:1-65:53) for type 'Service' does not match anywhere!
[2016-01-21 04:12:49 +0000] information/ConfigItem: Instantiated 1 Comment.
[2016-01-21 04:12:49 +0000] information/ConfigItem: Triggering Start signal for config items
[2016-01-21 04:12:49 +0000] information/ConfigItem: Activated all objects.
[2016-01-21 04:12:49 +0000] notice/Comment: Added comment 'icinga2-web2-mysql!icinga2-web2-mysql-1453349569-0'.
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: INSERT INTO icinga_externalcommands (command_args, command_name, command_type, endpoint_object_id, entry_time, instance_id) VALUES ('icinga2-web2-mysql;1;icingaadmin;yggygyyj', 'ADD_HOST_COMMENT', '1', 1, FROM_UNIXTIME(1453349569), 1)
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: INSERT INTO icinga_comments (author_name, comment_data, comment_source, comment_time, comment_type, endpoint_object_id, entry_time, entry_time_usec, entry_type, expires, instance_id, internal_comment_id, is_persistent, name, object_id) VALUES ('icingaadmin', 'yggygyyj', '1', FROM_UNIXTIME(1453349569), '2', 1, FROM_UNIXTIME(1453349569), '947563', '1', '0', 1, '1', '1', 'icinga2-web2-mysql!icinga2-web2-mysql-1453349569-0', 68)
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: INSERT INTO icinga_commenthistory (author_name, comment_data, comment_source, comment_time, comment_type, endpoint_object_id, entry_time, entry_time_usec, entry_type, expires, instance_id, internal_comment_id, is_persistent, name, object_id) VALUES ('icingaadmin', 'yggygyyj', '1', FROM_UNIXTIME(1453349569), '2', 1, FROM_UNIXTIME(1453349569), '947563', '1', '0', 1, '1', '1', 'icinga2-web2-mysql!icinga2-web2-mysql-1453349569-0', 68)
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: COMMIT
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: BEGIN
使用 PostgreSQL 和 MySQL 后端重新启动 Icinga2
当使用 PostgreSQL 和 MySQL 后端重新启动 Icinga2 时,我有几乎相同的日志,这听起来不错!
# Icinga2 restart with PostgreSQL
[2016-01-21 05:02:11 +0000] information/Application: Received request to shut down.
[2016-01-21 05:02:11 +0000] information/Application: Shutting down...
[2016-01-21 05:02:11 +0000] information/CheckerComponent: Checker stopped.
[2016-01-21 05:02:11 +0000] information/DbConnection: Resuming IDO connection: ido-pgsql
[2016-01-21 05:02:11 +0000] information/ConfigItem: Activated all objects.
[2016-01-21 05:02:11 +0000] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/modified-attributes.conf
[2016-01-21 05:02:11 +0000] information/IdoPgsqlConnection: pgSQL IDO instance id: 1 (schema version: '1.14.0')
# Icinga2 restart with MySQL
[2016-01-21 05:03:20 +0000] information/Application: Received request to shut down.
[2016-01-21 05:03:20 +0000] information/Application: Shutting down...
[2016-01-21 05:03:20 +0000] information/CheckerComponent: Checker stopped.
[2016-01-21 05:03:20 +0000] information/DbConnection: Resuming IDO connection: ido-mysql
[2016-01-21 05:03:20 +0000] information/ConfigItem: Activated all objects.
[2016-01-21 05:03:20 +0000] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/modified-attributes.conf
[2016-01-21 05:03:20 +0000] information/IdoMysqlConnection: MySQL IDO instance id: 1 (schema version: '1.14.0')
包版本
- icinga2-2.4.1-1.el7.centos.x86_64
- icinga2-ido-pgsql-2.4.1-1.el7.centos.x86_64
- postgresql94-9.4.5-1PGDG.rhel7.x86_64
- postgresql94-server-9.4.5-1PGDG.rhel7.x86_64
如何重现此问题
对于那些有能力重现问题的人,您可以克隆 mickael-ange/icinga2-ansible
Github 存储库(分支:Issue-No-Historical-Data-in-Icinga2-Web2-and-DB)并按照 icinga2-we2-vagrant.md 中的说明进行操作。如果还没有,则需要安装所需的工具。然后使用 librarian-ansible 安装角色依赖项。最后,我写了一个部分(#ido-no-historical-data-in-icinga2-web2-and-db)来重现问题。
提前感谢您抽空阅读到这里!
迈克尔
终于弄明白为什么历史数据没有插入到DB中了,所以我来回复一下自己。
如 documentation 中所述:
categories Optional. The types of information that should be written to the database.
因此,当我从 ido-pgsql.conf
配置中删除类别时。我重新启动 Icinga2,然后数据按预期写入数据库。 Comments
、Downtimes
,好吧,我想要的一切现在都在 UI 中列出了。
我还删除了 cleanup
部分,因为它可能也不是我想要的。
最后的ido-pgsql.conf
配置:
library "db_ido_pgsql"
object IdoPgsqlConnection "ido-pgsql" {
user = "icinga"
password = "icinga"
host = "localhost"
database = "icinga"
table_prefix = "icinga_"
instance_name = "icinga2"
instance_description = "icinga2 instance"
}
上下文
我正在使用 IDO PostgreSQL
和 IDO MySQL
在 CentOS 7
上使用 Ansible
配置 Icinga2
Web2
。
我的工作基于出色的 https://github.com/Icinga/icinga2-ansible 角色。我已将项目 (mickael-ange/icinga2-ansible) 分叉以添加更多自动化和支持,例如 IDO PostgreSQL。我正在使用 PostgreSQL 服务器 9.4.
好吧,我最终得到了 icinga2-ansible-web2-ui
角色的一个版本,它使用 IDO PostgreSQL 或 IDO MySQL 自动安装 Icinga2 Web2 无需向导.
我的问题
服务器似乎正常工作,但我无法弄清楚如何在 Icinga2 Web2 界面中获取数据,例如:
Comments
和Downtimes
来自Overview
菜单Event Grid
、Event Overview
、Notifications
、Timeline
来自History
菜单
我可以创建 Comments
和 Schedule Downtimes
,但它们没有在 UI 中列出。正确处理停机时间。
我可以发送 Notifications
但他们也没有在 UI 中列出。当 SELinux 处于宽容模式时发出通知。
我的问题是:是否有任何 IDO 或 Icinga2 Web2 配置可以让数据库填充评论、停机时间等?
我的/etc/icinga2/features-enabled/ido-pgsql.conf
library "db_ido_pgsql"
object IdoPgsqlConnection "ido-pgsql" {
user = "icinga"
password = "icinga"
host = "localhost"
database = "icinga"
table_prefix = "icinga_"
instance_name = "icinga2"
instance_description = "icinga2 instance"
cleanup = {
downtimehistory_age = 48h
logentries_age = 31d
}
categories = DbCatConfig | DbCatState
}
备注
注一
我已经在 Icinga2 项目和论坛的大部分文档中进行了搜索,但我找不到雪茄。我很惊讶 none 以前遇到过这个问题,所以这可能是我这边的问题。
注2
在 Icinga IRC 频道上聊天并做了更多测试后,我发现 我的问题只发生在 PostgreSQL 后端 上。它与 MySQL 后端一起按预期工作。
调试会话
调试会话 1
我收集了更多关于我的环境的 info/logs。
PostgreSQL 权限
我检查了我的 PostgreSQL icinga 用户权限:
TABLE
权限设置为SELECT
,INSERT
,UPDATE
,DELETE
SEQUENCE
权限设置为USAGE
我什至尝试将 postgres
配置为用户以访问后端(icinga_ido
和 icingaweb_ido
资源),但我仍然没有在中列出任何 Comments
UI(创建评论后)。
这里是 \dp
命令列出的 PosgreSQL 权限:
icinga=> \dp
Access privileges
Schema | Name | Type | Access privileges | Column access privileges
--------+-----------------------------------------------------------------+----------+---------------------------+--------------------------
public | icinga_acknowledgements | table | postgres=arwdDxt/postgres+|
| | | icinga=arwd/postgres |
public | icinga_acknowledgements_acknowledgement_id_seq | sequence | postgres=rwU/postgres +|
| | | icinga=U/postgres |
public | icinga_commands | table | postgres=arwdDxt/postgres+|
| | | icinga=arwd/postgres |
public | icinga_commands_command_id_seq | sequence | postgres=rwU/postgres +|
| | | icinga=U/postgres |
public | icinga_commenthistory | table | postgres=arwdDxt/postgres+|
| | | icinga=arwd/postgres |
public | icinga_commenthistory_commenthistory_id_seq | sequence | postgres=rwU/postgres +|
| | | icinga=U/postgres |
<truncated>
此外,我在 PostgreSQL 日志(例如 /var/lib/pgsql/9.4/data/pg_log/postgresql-Thu.log)中没有错误,当从 Icinga UI.
但是,我发现尝试使用 icinga
用户从 pgAdmin
UI 浏览 SEQUENCE
时出现错误(postgres
用户没有错误):
< 2016-01-21 03:55:52.436 GMT >STATEMENT: SELECT last_value, min_value, max_value, cache_value, is_cycled, increment_by, is_called
FROM icinga_acknowledgements_acknowledgement_id_seq
但我不确定这是否有意义,因为 icinga
用户对 SEQUENCE
只有 USAGE
权限。
比较 PostgreSQL 和 MySQL 后端的调试日志
所以当我创建评论时,我最终比较了两边的 Icinga 调试日志(MySQL IDO 和 PostgreSQL IDO)。我可以看到只有 MySQL 后端才有我正在寻找的 SQL 语句,它们在 icinga_externalcommands
、icinga_comments
和 icinga_commenthistory
表中插入数据。
我没有足够的声誉来提供超过 2 个链接(例如 pastebin)。所以这是日志。
添加 Comment
与 PostgreSQL 后端:
[2016-01-21 04:14:00 +0000] information/ExternalCommandListener: Executing external command: [1453349640] ADD_HOST_COMMENT;icinga2-web2-postgres;1;icingaadmin;dededewdwwewdew
[2016-01-21 04:14:00 +0000] debug/DbEvents: add external command history
[2016-01-21 04:14:00 +0000] notice/ExternalCommandProcessor: Creating comment for host icinga2-web2-postgres
[2016-01-21 04:14:00 +0000] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/api/packages/_api/icinga2-web2-postgres-1453347670-1/conf.d/comments/icinga2-web2-postgres!icinga2-web2-postgres-1453349640-1.conf
[2016-01-21 04:14:00 +0000] information/ConfigItem: Committing config items
[2016-01-21 04:14:00 +0000] warning/ApplyRule: Apply rule 'satellite-host' (in /etc/icinga2/conf.d/satellite.conf: 29:1-29:41) for type 'Dependency' does not match anywhere!
[2016-01-21 04:14:00 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/conf.d/services.conf: 57:1-57:65) for type 'Service' does not match anywhere!
[2016-01-21 04:14:00 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/conf.d/services.conf: 65:1-65:53) for type 'Service' does not match anywhere!
[2016-01-21 04:14:00 +0000] information/ConfigItem: Instantiated 1 Comment.
[2016-01-21 04:14:00 +0000] information/ConfigItem: Triggering Start signal for config items
[2016-01-21 04:14:00 +0000] information/ConfigItem: Activated all objects.
[2016-01-21 04:14:00 +0000] notice/Comment: Added comment 'icinga2-web2-postgres!icinga2-web2-postgres-1453349640-1'.
[2016-01-21 04:14:01 +0000] debug/IdoPgsqlConnection: Query: COMMIT
[2016-01-21 04:14:01 +0000] debug/IdoPgsqlConnection: Query: BEGIN
添加 Comment
和 MySQL 后端:
[2016-01-21 04:12:49 +0000] information/ExternalCommandListener: Executing external command: [1453349569] ADD_HOST_COMMENT;icinga2-web2-mysql;1;icingaadmin;yggygyyj
[2016-01-21 04:12:49 +0000] debug/DbEvents: add external command history
[2016-01-21 04:12:49 +0000] notice/ExternalCommandProcessor: Creating comment for host icinga2-web2-mysql
[2016-01-21 04:12:49 +0000] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/api/packages/_api/icinga2-web2-mysql-1453347256-1/conf.d/comments/icinga2-web2-mysql!icinga2-web2-mysql-1453349569-0.conf
[2016-01-21 04:12:49 +0000] information/ConfigItem: Committing config items
[2016-01-21 04:12:49 +0000] warning/ApplyRule: Apply rule 'satellite-host' (in /etc/icinga2/conf.d/satellite.conf: 29:1-29:41) for type 'Dependency' does not match anywhere!
[2016-01-21 04:12:49 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/conf.d/services.conf: 57:1-57:65) for type 'Service' does not match anywhere!
[2016-01-21 04:12:49 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/conf.d/services.conf: 65:1-65:53) for type 'Service' does not match anywhere!
[2016-01-21 04:12:49 +0000] information/ConfigItem: Instantiated 1 Comment.
[2016-01-21 04:12:49 +0000] information/ConfigItem: Triggering Start signal for config items
[2016-01-21 04:12:49 +0000] information/ConfigItem: Activated all objects.
[2016-01-21 04:12:49 +0000] notice/Comment: Added comment 'icinga2-web2-mysql!icinga2-web2-mysql-1453349569-0'.
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: INSERT INTO icinga_externalcommands (command_args, command_name, command_type, endpoint_object_id, entry_time, instance_id) VALUES ('icinga2-web2-mysql;1;icingaadmin;yggygyyj', 'ADD_HOST_COMMENT', '1', 1, FROM_UNIXTIME(1453349569), 1)
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: INSERT INTO icinga_comments (author_name, comment_data, comment_source, comment_time, comment_type, endpoint_object_id, entry_time, entry_time_usec, entry_type, expires, instance_id, internal_comment_id, is_persistent, name, object_id) VALUES ('icingaadmin', 'yggygyyj', '1', FROM_UNIXTIME(1453349569), '2', 1, FROM_UNIXTIME(1453349569), '947563', '1', '0', 1, '1', '1', 'icinga2-web2-mysql!icinga2-web2-mysql-1453349569-0', 68)
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: INSERT INTO icinga_commenthistory (author_name, comment_data, comment_source, comment_time, comment_type, endpoint_object_id, entry_time, entry_time_usec, entry_type, expires, instance_id, internal_comment_id, is_persistent, name, object_id) VALUES ('icingaadmin', 'yggygyyj', '1', FROM_UNIXTIME(1453349569), '2', 1, FROM_UNIXTIME(1453349569), '947563', '1', '0', 1, '1', '1', 'icinga2-web2-mysql!icinga2-web2-mysql-1453349569-0', 68)
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: COMMIT
[2016-01-21 04:12:50 +0000] debug/IdoMysqlConnection: Query: BEGIN
使用 PostgreSQL 和 MySQL 后端重新启动 Icinga2
当使用 PostgreSQL 和 MySQL 后端重新启动 Icinga2 时,我有几乎相同的日志,这听起来不错!
# Icinga2 restart with PostgreSQL
[2016-01-21 05:02:11 +0000] information/Application: Received request to shut down.
[2016-01-21 05:02:11 +0000] information/Application: Shutting down...
[2016-01-21 05:02:11 +0000] information/CheckerComponent: Checker stopped.
[2016-01-21 05:02:11 +0000] information/DbConnection: Resuming IDO connection: ido-pgsql
[2016-01-21 05:02:11 +0000] information/ConfigItem: Activated all objects.
[2016-01-21 05:02:11 +0000] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/modified-attributes.conf
[2016-01-21 05:02:11 +0000] information/IdoPgsqlConnection: pgSQL IDO instance id: 1 (schema version: '1.14.0')
# Icinga2 restart with MySQL
[2016-01-21 05:03:20 +0000] information/Application: Received request to shut down.
[2016-01-21 05:03:20 +0000] information/Application: Shutting down...
[2016-01-21 05:03:20 +0000] information/CheckerComponent: Checker stopped.
[2016-01-21 05:03:20 +0000] information/DbConnection: Resuming IDO connection: ido-mysql
[2016-01-21 05:03:20 +0000] information/ConfigItem: Activated all objects.
[2016-01-21 05:03:20 +0000] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/modified-attributes.conf
[2016-01-21 05:03:20 +0000] information/IdoMysqlConnection: MySQL IDO instance id: 1 (schema version: '1.14.0')
包版本
- icinga2-2.4.1-1.el7.centos.x86_64
- icinga2-ido-pgsql-2.4.1-1.el7.centos.x86_64
- postgresql94-9.4.5-1PGDG.rhel7.x86_64
- postgresql94-server-9.4.5-1PGDG.rhel7.x86_64
如何重现此问题
对于那些有能力重现问题的人,您可以克隆 mickael-ange/icinga2-ansible
Github 存储库(分支:Issue-No-Historical-Data-in-Icinga2-Web2-and-DB)并按照 icinga2-we2-vagrant.md 中的说明进行操作。如果还没有,则需要安装所需的工具。然后使用 librarian-ansible 安装角色依赖项。最后,我写了一个部分(#ido-no-historical-data-in-icinga2-web2-and-db)来重现问题。
提前感谢您抽空阅读到这里! 迈克尔
终于弄明白为什么历史数据没有插入到DB中了,所以我来回复一下自己。
如 documentation 中所述:
categories Optional. The types of information that should be written to the database.
因此,当我从 ido-pgsql.conf
配置中删除类别时。我重新启动 Icinga2,然后数据按预期写入数据库。 Comments
、Downtimes
,好吧,我想要的一切现在都在 UI 中列出了。
我还删除了 cleanup
部分,因为它可能也不是我想要的。
最后的ido-pgsql.conf
配置:
library "db_ido_pgsql"
object IdoPgsqlConnection "ido-pgsql" {
user = "icinga"
password = "icinga"
host = "localhost"
database = "icinga"
table_prefix = "icinga_"
instance_name = "icinga2"
instance_description = "icinga2 instance"
}