IcingaDB supported on FreeBSD (Ports, Packages)?

Hi,

I’m running a huge Monitoring-Environment (>20 Nodes) completly on FreeBSD 13.x. Currently, I’m using IDO-DB, but I see that support will be removed in the future.

Are there plans to support FreeBSD, e.g. in form of maintaining a “port”? Has anyone tried to build icingadb on FreeBSD? It is written in go, so in theory it might work.


SaM

Hey there,
there most likely won’t be any official support for FreeBSD from Icinga, I’m afraid.
Icinga on FreeBSD was always a community project, so I’m positive that IcingaDB for FreeBSD is something that will come up sooner or later.

Fingers crossed :crossed_fingers:

Thank you for the information, Feu.

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.

I have created a FreeBSD port for icingadb and icingadb-web - I am still testing. The works-in-progress are available at https://github.com/dlangille/ports-wip/tree/main/net-mgmt

They will be added to the FreeBSD ports tree within the next week or two.

2 Likes

Hi Matlib,

sorry for not answering for so long.

Thank you for the great valuable input. I managed to get IcingaWeb running on all the systems without using FreeBSD packages. Although there are up-to-date packages now, I’ll stick to this method because things work better with ‘your’ method, e.g. language support. And - I already built an ansible-playbook to roll out IcingaWeb this way.

I didn’t have time to try icingadb yet, but your reply will be a valuable reference of how things actually work.

Yes, I also prefer to deploy PHP scripts directly from upstream builds, and manually.

Anyway, somebody must have updated these packages because their version is 2.11.4 now.