Icinga Web 2: History is empty with "No items found."

I have the issue on the completely new installed Icinga2 setup, that the state history in the web UI is not shown. I also don’t have an error, it’s just “No items found.”.

The setup consists of two MariaDB databases. One for the Icinga2 itself (icingadb) and a dedicated database for the Icinga2 Web 2 (icingaweb2).

I’ve checked the various log files of the Icinga2 components (icinga2, icingaweb2, icingadb-redis) and can’t find any errors related to that. If I check the MariaDB database for the state_history table, I can find the state change records.

MariaDB [icingadb]> SELECT * FROM state_history ORDER BY event_time DESC LIMIT 3;
*************************** 1. row ***************************
                 id:   :>\     ( s&t q 
     environment_id: guV >| F   @ u ?! 
        endpoint_id:  0  V ʺア<e By 
        object_type: service
            host_id: Ug     ȡRt /o  oRk
         service_id:  2~  &D!9Z q+  @k
         event_time: 1706083213640
         state_type: hard
         soft_state: 0
         hard_state: 0
previous_soft_state: 2
previous_hard_state: 0
      check_attempt: 1
             output: PING OK - Packet loss = 0%, RTA = 1.63 ms
        long_output: NULL
 max_check_attempts: 5
       check_source: [..]
  scheduling_source: [..]
*************************** 2. row ***************************
                 id: :pE/ ʺ  qA  ,=d!~՝
     environment_id: guV >| F   @ u ?! 
        endpoint_id:  0  V ʺア<e By 
        object_type: service
    ϠRe u i host_id: -1 i I
         service_id:   J  [ 0 [t |\ Hb E
         event_time: 1706083189897
         state_type: hard
         soft_state: 0
         hard_state: 0
previous_soft_state: 2
previous_hard_state: 0
      check_attempt: 1
             output: PING OK - Packet loss = 0%, RTA = 24.80 ms
        long_output: NULL
 max_check_attempts: 5
       check_source: [..]
  scheduling_source: [..]
*************************** 3. row ***************************
                 id:      ب B    * w  
     environment_id: guV >| F   @ u ?! 
        endpoint_id:  0  V ʺア<e By 
        object_type: service
            host_id: Ug     ȡRt /o  oRk
         service_id:  2~  &D!9Z q+  @k
         event_time: 1706083181043
         state_type: soft
         soft_state: 2
         hard_state: 0
previous_soft_state: 0
previous_hard_state: 0
      check_attempt: 1
             output: PING CRITICAL - Packet loss = 16%, RTA = 1.47 ms
        long_output: NULL
 max_check_attempts: 5
       check_source: [..]
  scheduling_source: [..]

System overview:

  • Setup: New setup created on December 2023, single server
  • Icinga Web 2 version: 2.12.1
  • Used modules: icingadb v1.1.1
  • MariaDB version: 10.5.21
  • Web browser: Edge
  • Icinga 2 version: r2.14.2-1
  • PHP version: 7.4.33
  • Server hardware: Raspberry Pi 3 B+
  • Server operating system and version: Raspbian 11 Bullseye (Kernel: 6.1.21-v7+)

Do I miss a module or something else to enable the history in the web UI?
Do I have to use a single database which is hosting both schemas?

That’s dificult to say since I don’t know what you did…

Do you have any

  • install log / commands executed to install all components / bash history
  • guide you followed?

Hi

I’ve tried to follow the setup instructions on the documents of the Icinga2 components. The resulted setup instructions I’ve used are below. Maybe I’ve done a step I forget to document, but I guess it should be complete.

(Please forgive the style in which I have documented this, I am not an experienced Linux/Icinga2 engineer…)

Part 1: Install Icinga 2

Add the Raspbian repository for Icinga:

apt update
apt -y install apt-transport-https wget gnupg

wget -O - https://packages.icinga.com/icinga.key | gpg --dearmor -o /usr/share/keyrings/icinga-archive-keyring.gpg

DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \
  echo "deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/raspbian icinga-${DIST} main" > \
  /etc/apt/sources.list.d/icinga.list
  echo "deb-src [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] 
  https://packages.icinga.com/raspbian icinga-${DIST} main" >> \
  /etc/apt/sources.list.d/icinga.list

apt update

Now install Icinga2 core service:

# Install the main package
apt install icinga2

systemctl status icinga2
icinga2 daemon -C

# Install the basic check plugins
apt install monitoring-plugins

Finally we setup the Icinga API.

icinga2 api setup
systemctl restart icinga2

# Check user and password, create the icingadb api user
cat /etc/icinga2/conf.d/api-users.conf

Part 2: IcingaDB on MariaDB

Install the IcingaDB and the MariaDB Server

# Install the IcingaDB and the MariaDB components
apt install icingadb
apt install mariadb-server

Now create the database with the Icinga2 schema:

# Create the database with user
mysql -u root -p
> CREATE DATABASE icingadb;
> CREATE USER 'icingadb'@'localhost' IDENTIFIED BY '{password}';
> GRANT ALL ON icingadb.* TO 'icingadb'@'localhost';

# Import schema
mysql -u root -p icingadb </usr/share/icingadb/schema/mysql/schema.sql

Finally connect the IcingaDB to the MariaDB database:

# Update the IcingaDB database user password in the icinga confi
nano /etc/icingadb/config.yml
> # Database password.
> password: {password}

# Enable the IcingaDB component and restart to pick up the new database password
systemctl enable --now icingadb
systemctl restart icingadb

# Enable the IcingaDB feature in Icinga2
icinga2 feature enable icingadb
systemctl restart icinga2

Part 3: Redis Server

Install redit:

# Install ans start the icingaDB Redis component
apt install icingadb-redis
systemctl enable --now icingadb-redis

# For a single node setup, it's not required to publish the redis service to another IP than 127.0.0.1
cat /etc/icingadb-redis/icingadb-redis.conf | grep ^bind

Part 4: Icinga2 Web with IcingaDB Web

Install the web components:

apt install icingadb-web
apt install icingaweb2 libapache2-mod-php icingacli php-pgsql

# Set a valid timezone
nano /etc/php/7.4/apache2/php.ini
> date.timezone = Europe/Zurich

# Setup icinga to user the nginx web server
icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public
systemctl restart apache

# Create the setup token for the UI setup later
icingacli setup token create
icingacli setup token show

Now create the database:

# Create the database with user
mysql -u root -p
> CREATE DATABASE icingaweb2;
> CREATE USER 'icingaweb2'@'localhost' IDENTIFIED BY '{password}';
> GRANT ALL ON icingaweb2.* TO 'icingaweb2'@'localhost';

Now start the setup wizard:

http://{ip-address}/icingaweb2/setup

Setp Action
Welcome Enter the setup token
Modules icingadb
Verification Ensure there are no errors
Authentication Database
Database Resource > Resource Name icingaweb_db
Database Resource > Database Type MySQL
Database Resource > Host localhost
Database Resource > Database Name icingaweb2
Database Resource > Username icingaweb2
Database Resource > Password ***
Authentication Backend > Backend Name icingaweb2
Administration > Username admin
Administration > Password ***
Application Configuration > Show stack… Yes
Application Configuration > Show app… Yes
Application Configuration > Enable strict … No
Application Configuration > Logging Type Syslog
Application Configuration > Logging Error
Application Configuration > Application Prefix icingaweb2
Application Configuration > Facility user
Icinga DB Resource > Database Type MySQL
Icinga DB Resource > Host localhost
Icinga DB Resource > Database Name icingadb
Icinga DB Resource > Username icingadb
Icinga DB Resource > Password ***
Icinga DB Redis > Primary > Redit Host localhost
Icinga 2 API > Host localhost
Icinga 2 API > Port 5665
Icinga 2 API > API Username icingadb
Icinga 2 API > API Password ***

Installed it too and in fact the history is not working

I have created a ticket for that 32bit OS: icingadb-web/history is empty because of integer overflow · Issue #964 · Icinga/icingadb-web · GitHub

32bit:
Something causes an interger overflow which breaks the sql query.

but the debian repo recently received arm64 packages:
https://packages.icinga.com/debian/pool/main/i/icinga2/icinga2-bin_2.14.2-1+debian12_arm64.deb

I would reinstall and try out a 64 bit OS

DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \
 echo "deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-${DIST} main" > \
 /etc/apt/sources.list.d/icinga.list
 echo "deb-src [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-${DIST} main" >> \
 /etc/apt/sources.list.d/icinga.list

So I installed raspberry OS bookworm 64 bit and it works fine
the apt file should look like this:

DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \
 echo "deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-${DIST} main" > \
 /etc/apt/sources.list.d/icinga.list
 echo "deb-src [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-${DIST} main" >> \
 /etc/apt/sources.list.d/icinga.list
root@raspberrypi:/etc/apt/sources.list.d# cat icinga.list
deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-bookworm main
deb-src [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-bookworm main

you need to edit the php8 ini !

nano /etc/php/8.2/apache2/php.ini

you don’t need the nginx config and you need to restart apache2

systemctl restart apache2

History works but ofcourse it is empty at first because there is no state change.
you can create a state change using “process check result”

I’ve tried it on my Raspberry 3 B+ using Raspberry OS Bullseye with 64-bit, it works as expected. Thank you @moreamazingnick for finding the but and pointing to the solution!

I ran into that issue, as I did not carefully check what image was suggested in the Raspberry Pi Imager. As of January 2024, it’s still recommends Bullseye 32-bit for a 3B+ model… I switched to the 64-bit Lite option.
raspberry-imager

Not sure why, but with my installation guide it still installs PHP 7.4 and not 8.2 → maybe it’s the default dependency. Maybe it’s because I’m on Bullseye? Anyway, as Icinga2 Web requires >7.2, that should be fine.

Yeah, the nginx config command was just useless. I missed, that this config line is obsolet, as the apache2 is already installed and configured.

1 Like