Enabling icingadb: Class 'Redis' not found

When I enable the icingadb module in icinga web, the following error shows up:

Method Icinga\Web\Widget\ApplicationStateMessages::__toString() must not throw an exception, caught Error: Class ‘Redis’ not found

I followed the instructions, checked the requirements and checked that icingadb-redis is running. Can anyone give a hint?

It looks like you are missing the Redis PHP module.

Can you try installing php-redis? e.g. on CentOS 7:

yum install rh-php71-php-pecl-redis

1 Like

doing this and restarting icinga and icingadb-redis after that didnt help

Thanks for your help!

What does your Icinga Web install look like?

Operating System/PHP Version/etc.

Can you do php -i | grep redis and make sure the redis module is being recognised?

This is the output of php -i | grep redis:

/etc/php.d/50-redis.ini
redis
Registered save handlers => files user redis rediscluster
This program is free software; you can redistribute it and/or modify

So it seems to recognize it.

I’m using CentOS Linux release 7.7.1908 with PHP 5.6.40

Hi.

Just a little hint:
After installing php-redis, it is required to restart php-fpm.

it is not recommended to use icingadb with php 5.6, but it should work

Hey Guys

I have the same issue…
Even tough I installed php-redis with “yum install php-pecl-redis” and restarted the php-fpm service it’s not working… I get following error message:

Uncaught Error: Class ‘Redis’ not found in /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/IcingaRedis.php:92

I’m using rh-php73-php-fpm… do I need to install another package?
The requirements for the icingadb should be ok.

BR

Coincidentally, I’m having the same issue in a slightly different spot:

Uncaught Error: Class 'Redis' not found in /usr/share/icingaweb2/modules/icingadb/application/forms/RedisConfigForm.php:176
Stack trace:
#0 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Setup/RedisPage.php(56): Icinga\Module\Icingadb\Forms\RedisConfigForm::checkRedis(Object(Icinga\Module\Icingadb\Setup\RedisPage))
#1 /usr/share/php/Icinga/Web/Wizard.php(294): Icinga\Module\Icingadb\Setup\RedisPage->isValidPartial(Array)
#2 /usr/share/php/Icinga/Web/Wizard.php(264): Icinga\Web\Wizard->handleRequest(Object(Icinga\Web\Request))
#3 /usr/share/icingaweb2/modules/setup/application/controllers/IndexController.php(46): Icinga\Web\Wizard->handleRequest()
#4 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Setup\Controllers\IndexController->indexAction()
#5 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('indexAction')
#6 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(O

I thought I was missing an redis module but my guesses weren’t right:

# icingacli module enable redis
ERROR: Icinga\Exception\ConfigurationError in /usr/share/php/Icinga/Application/Modules/Manager.php:248 with message: Cannot enable module "redis". Module is not installed.

The documentation, while usually very helpful in this case directs me to the web menu for redis configuration which won’t work until I have some aspect of the redis configuration working to get the web page working. I had already ran the suggested icingacli module enable icingadb. I did verify php -i | grep redis which shows:

[root@csc2cxn00003503 ~]# php -i |grep redis
/etc/php.d/redis.ini,
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
redis
Registered save handlers => files user redis rediscluster redis rediscluster
This program is free software; you can redistribute it and/or modify

UPDATE: Looks like this has something to do with the php version. I’m using php73. Tomorrow I’ll try to remove it and see if I can use 71.

Andy

The package should be called rh-php73-php-pecl-redis5 or something along the lines. You then have to restart php-fpm.

Don’t! :astonished: It’s the other way round, PHP 7.1 had issues as there’s no installation candidate for the redis php extension for php-fpm. If you’re on PHP 7.3 you’re fine.

Though remember, if you’re using php-fpm for Icinga Web 2 you probably have two different php versions installed. The system’s default one and the one for php-fpm. The redis extension needs to be installed for php-fpm. Then it should work.

Thank you, @nilmerg for saving me from that! :wink:

I got the packages installed and as you predicted, that error went away. I got this slightly nicer looking warning:

* Primary connection established but failed to verify Icinga is connected as well.

I’m going to skip it for now and see where it leads me.

This means that Icinga 2’s feature for Icinga DB is not running or unable to connect to Redis. Without this, there won’t be any data Icinga DB is processing.

Thanks, it looks like Icinga2 was being killed by our corporate virus software. Working on that one!

1 Like