icinga2+postgresql
postgresql10下载网址:
http://download.postgresql.org/pub/repos/yum/testing/10/redhat/rhel-6-x86_64/
需先下载postgresql10-10.0、postgresql10-server、postgres10-contrib、postgresql10-libs、icinga2-ido-pgsql
安装rpm -i 略(提示有依赖可以--nodeps),redhat postgresql的安装路径为/var/lib/pgsql/10/data
# rsync -av /usr/pgsql-10/bin/* /usr/bin/
创建账号和数据库:
# /etc/init.d/postgresql-10 initdb
# /etc/init.d/postgresql-10 start
# su - postgres
$ psql
# create user "icinga2" with password 'xxxxx';
# create database "icinga2" with owner='icinga2''
#\q
$ exit
# vi /var/lib/pgsql/10/data/pg_hba.conf (设置postgres对所有数据库为peer认证方式,icinga2账号对icinga2数据库为md5认证方式)
local all postgres peer
local all icinga2 md5
host all icinga2 md5
:wq
# /etc/init.d/postgresql-10 restart
导入icinga2的sql结构:
# psql -U icinga2 -d icinga2 < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql
启用ido-pgsql.conf
# vi /etc/icinga2/features-enabled/ido-pgsql.conf
library "db_ido_pgsql"
object IdoPgsqlConnection "ido-pgsql" {
user = "icinga2"
password = "xxxxxx"
host = "localhost"
database = "icinga2"
}
:wq
# icinga2 feature enable ido-pgsql
最后重启icinga2即可
# service icinga2 restart