Installing IcingaWeb/DB on FreeBSD
Prereq:
- installed and running Icinga server
- remove the icingaweb2 package as it is totally outdated
1. Redis
pkg install redis
Create file /usr/local/etc/icinga2/redis.conf with the following content:
bind 127.0.0.1
protected-mode yes
port 6380
tcp-backlog 5
unixsocket /var/run/icinga2/redis.sock
unixsocketperm 660
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/icinga2/redis.pid
loglevel notice
logfile /var/log/icinga2/redis.log
databases 16
always-show-logo no
set-proc-title no
save ""
tracking-table-max-keys 1000
user default on allcommands allkeys allchannels >redis-password
maxclients 100
maxmemory 128MB
maxmemory-policy noeviction
shutdown-timeout 1
Launch redis:
daemon -u icinga redis-server /usr/local/icinga2/redis.conf
Check the log file /var/log/icinga2/redis.log if we’re happy.
Edit file /usr/local/etc/icinga2/features-available/icingadb.conf and enter these values:
object IcingaDB "icingadb" {
host = "127.0.0.1"
port = 6380
password = "redis-password"
}
Enable Redis module in Icinga server:
ln -s /usr/local/etc/icinga2/features-available/icingadb.conf /usr/local/etc/icinga2/features-enabled/
pkill -HUP icinga2
Verify if all gears turn.
2. IcingaDB daemon
Compilation has to be done on machine/credentials connected to the Internet, as the build process downloads a lot of files.
pkg install go
Download a fresh version of IcingaDB. The following steps are done with an unpriviledged user:
tar -xf v*.tar.gz
cd icingadb-*/cmd/icingadb
go build
This should produce the binary called icingadb that needs be copied to the production machine (/usr/local/bin being the usual location).
Set up the database. Then create the configuration file /usr/local/etc/icinga2/icingadb.yml:
database:
type: pgsql
host: 127.0.0.1
port: 5432
database: icingadb
user: icinga
password: postgres-password
redis:
host: 127.0.0.1
port: 6380
password: redis-password
logging:
level: info
output: console
interval: 20s
Launch icingadb daemon:
daemon -f -o /var/log/icinga2/icingadb.log -p /var/run/icinga2/icingadb.pid -u icinga icingadb -c /usr/local/etc/icinga2/icingadb.yml
Check the log /var/log/icinga2/icingadb.log if we’re rolling.
3. Deploying PHP app
The following instructions assume the location of shared components is /usr/local/share/icinga-php, so you need to change the default path by setting the ICINGAWEB_LIBDIR environment variable. For Apache that’s SetEnv ICINGAWEB_LIBDIR "/usr/local/share/icinga-php"
.
Install PHP 8.1:
pkg install php81 php81-bcmath php81-ctype php81-curl php81-dom \
php81-filter php81-gd php81-gettext php81-iconv php81-intl php81-ldap \
php81-mbstring php81-mysqli php81-opcache php81-pdo \
php81-pdo_mysql php81-pdo_pgsql php81-pdo_sqlite php81-pecl-bitset \
php81-pecl-mcrypt php81-pecl-memcache php81-pecl-memcached \
php81-pgsql php81-phar php81-posix php81-session php81-simplexml \
php81-soap php81-sockets php81-sqlite3 php81-xml php81-zlib \
php81-pear-Services_JSON
mkdir -p /usr/local/share/icinga-php/ipl /usr/local/share/icinga-php/vendor
Get the lastest versions of the IPL, thirdparty modules, IcingaWeb, and icingadb-web, and copy their content:
cp -r icinga-php-library-x.xx.x/* /usr/local/share/icinga-php/ipl/
cp -r icinga-php-thirdparty-x.xx.x/* /usr/local/share/icinga-php/vendor/
cp -r icingaweb2-x.xx.x/* /usr/local/www/icingaweb2/
mkdir /usr/local/www/icingaweb2/modules/icingadb
cp -r icingadb-web-x.x.x/* /usr/local/www/icingaweb2/modules/icingadb/
And now the module can be enabled and configured from IcingaWeb GUI.