Error while installing zabbix plugin.

Venzeles

Cadet
Joined
Apr 1, 2022
Messages
4
Hi,

When installing the plugin zabbix stops at 75% with an error:
zabbixserver had a failure Exception: RuntimeError Message: pkg error: - zabbix5-frontend : Refusing to fetch artifact and run post_install.sh! Partial plugin destroyed.

Other plugins install without problems.
Tried to update PKG - didn't help.

What could be the problem, what config should I look at, fix?
 
Joined
Apr 7, 2022
Messages
1
Hi,
i have the same problem with the installation of Zabbix Plugin, on the last release of TrueNAS.
 

sechub

Cadet
Joined
Apr 25, 2022
Messages
1
I've a similar problem. Do you have a solution? system is up to date.
Version:
TrueNAS-12.0-U8.1
 

Venzeles

Cadet
Joined
Apr 1, 2022
Messages
4
Hey,
no solution yet.
Updated the system - did not help.
I did a plugin update via the command line - no results.
Gotta get under the hood...
 

TangoFB

Cadet
Joined
Oct 22, 2020
Messages
7
I know this is a 3rd party plug-in, but if we do not post about it here, where are we supposed to post about it?
 

ragametal

Contributor
Joined
May 4, 2021
Messages
188
I also noticed this issue and decided to install zabbix myself. I figured it was a good learning exercise.

If you are open to that option, these steps worked for me (please don't ask for support if anything goes wrong as I am not an IT professional). These instructions are lengthy as it involve many moving parts but they should help you get a zabbix6 installed in truenas with apache, PHP7.4 Mysql and IPMI.

Assumptions
You know how to create jails.
You feel comfortable with the command line.
You know how to create, delete and modify config files from the command line.
Jail name: Zabbix
Jail IP: 10.0.0.24
Mysql root password: "zabbix-mysql-root" (PLEASE CHANGE THIS TO SOMETHING SECURE).
Mysql zabbix user password: "zabbixDBpass" (PLEASE CHANGE THIS TO SOMETHING SECURE).
Instructions will not discuss HTTPS redirect or SSL certificates (I use HA proxy on PFsense for this)

1. Create a jail.

2. SSH into truenas.

3. Get into the zabbix jail
iocage console zabbix

Install Zabbix
4. Install packages
pkg update && pkg upgrade pkg install -y libevent libpthread-stubs zlib-ng openipmi fping curl openssl wget pkg install -y apache24 pkg install -y mysql80-server

5. Install zabbix server from ports as this is the only way of getting compatibility with IPMI
portsnap fetch extract portsnap fetch update cd /usr/ports/net-mgmt/zabbix6-server/ make config make install clean
A new window will appear, enable all the options you want (noticed how i selected IPMI

1655898472184.png


6. Install zabbix frontentd and agent
pkg install -y zabbix6-frontend-php74 pkg install -y zabbix6-agent

7. Install php and all required extensions
pkg install -y mod_php74 php74-gd php74-bcmath php74-ctype php74-xml php74-simplexml php74-xmlreader php74-xmlwriter php74-session php74-sockets php74-mbstring php74-gettext php74-ldap php74-openssl php74-mysqli nmap ipmitool nut

Setup apache (webserver)
8. Enable apache
sysrc apache24_enable=yes

9.Open the file /usr/local/etc/apache24/httpd.conf uncomment the line "ServerName", indicate the IP of the jail (10.0.0.24 in this example)save and exit. The line should look similar to
ServerName 10.0.0.24:80

10.Start the webserver
service apache24 start

11. verify that the webserver is running by opening a browser and going to http://10.0.0.24. This should open the default apache webpage.

Setup MySQL
12. Enable and start the mysql service
sysrc mysql_enable=yes service mysql-server start

13.Enable the security features of mysql
mysql_secure_installation
  • The system will ask if we want to "validate password component". Click any key for NO
  • The system will ask for a new password for root. Type "zabbix-mysql-root"
  • the system will ask if we want to "remove anonymous users". Type "Y".
  • The system will ask if we want to "Dissallow root login remotely". Type "Y".
  • The system will ask if we want to "Remove test database and access to it". Type "Y".
  • The system will ask if we want to reload priviledge table now". Type "Y".
14. Enter the Mysql terminal
mysql -uroot -pzabbix-mysql-root

15. enter the following commands
create database zabbix character set utf8mb4 collate utf8mb4_bin; SHOW DATABASES; create USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'zabbixDBpass'; grant all privileges on zabbix.* to 'zabbix'@'localhost'; FLUSH PRIVILEGES; quit;

16. Install the zabbiz database
cd /usr/local/share/zabbix6/server/database mysql -uzabbix -pzabbixDBpass zabbix < mysql/schema.sql mysql -uzabbix -pzabbixDBpass zabbix < mysql/images.sql mysql -uzabbix -pzabbixDBpass zabbix < mysql/data.sql

Setup Zabbix Server
17. open the file /usr/local/etc/zabbix6/zabbix_server.conf, Uncomment and change the following parameters:
LogFile=/var/log/zabbix/zabbix_server.log DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbixDBpass StartIPMIPollers=3

18. create a log folder
mkdir /var/log/zabbix/ chown zabbix:zabbix /var/log/zabbix/

19. enable and start the zabbix server service
sysrc zabbix_server_enable=yes service zabbix_server start

Setup PHP

20. Create the PHP config file
cd /usr/local/etc cp php.ini-production php.ini

21. Open the config file /usr/local/etc/php.ini; uncomment the line "date.timezone" and indicate your timezone. For eastern US it should be
date.timezone= America/New_York

22. Enable and start the php_fpm service
sysrc php_fpm_enable=yes service php-fpm start

23. Create the apache php module config file
touch /usr/local/etc/apache24/modules.d/001_mod-php.conf

24. open the apache php module config file and paste the following text
Code:
<IfModule dir_module>
    DirectoryIndex index.php index.html
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
</IfModule>


25. Test if apache configuration is valid
apachectl configtest

26. Restart apache
service apache24 restart

27. create a test file for php touch /usr/local/www/apache24/data/info.php

28. open the php test file and add the following content
Code:
<?php
phpinfo(); //display all info
?>


29. Create an apache virtual host for the php test page touch /usr/local/etc/apache24/Includes/test.conf

30. add the following content to the apache virtual host for the php test page
Code:
<VirtualHost *:80>
        DocumentRoot "/usr/local/www/apache24/data"
        ServerName 10.0.0.24
        <Directory "/usr/local/www/apache24/data">
                Require all granted
                AllowOverride All
                Options Indexes FollowSymLinks
                Satisfy Any
                <IfModule mod_php7.c>
                        php_value max_execution_time 300
                        php_value memory_limit 512M
                        php_value post_max_size 128M
                        php_value upload_max_filesize 128M
                        php_value max_input_time 300
                        php_value max_input_vars 10000
                        php_value always_populate_raw_post_data -1
                </IfModule>
        </Directory>
        DirectoryIndex index.php index.html
</VirtualHost>


31. Restart apache
service apache24 restart

32. Test by opening a browser and going to http://10.0.0.24/info.php. This should open a webpage with all the specs for the php installation.

33. If everythign went ok, delete the php test files.
rm /usr/local/etc/apache24/Includes/test.conf rm /usr/local/www/apache24/data/info.php

Setup Zabbix frontend
34. Create an apache virtual host for the zabbix frontend page touch /usr/local/etc/apache24/Includes/zabbix.conf

35. add the following content to the apache virtual host for the zabbix frontend page
Code:
<VirtualHost *:80>
    ServerName 10.0.0.24
    ServerAdmin lrossi@levelupec.com
    DocumentRoot "/usr/local/www/zabbix6"
    <Directory "/usr/local/www/zabbix6">
        Require all granted
        AllowOverride All
        Options Indexes FollowSymLinks
        <IfModule mod_php7.c>
            php_value max_execution_time 300
            php_value memory_limit 512M
            php_value post_max_size 128M
            php_value upload_max_filesize 128M
            php_value max_input_time 300
            php_value max_input_vars 10000
            php_value always_populate_raw_post_data -1
        </IfModule>
    </Directory>
    DirectoryIndex index.php index.html
    <IfModule mod_headers.c>
        Header always set Strict-Transport-Security "max-age=31536000"
    </IfModule>
</VirtualHost>


36. Restart apache
service apache24 restart

37. Test by opening a browser and going to http://10.0.0.24/zabbix. This should open the zabbix initial setup wizard. Note, after the wizard has been completed, we can access this zabbix server just by indicating its IP address.

Setup Zabbix agent
38. Open the zabbix agent configuration file /usr/local/etc/zabbix6/zabbix_agentd.conf and change the LogFile line to
LogFile=/var/log/zabbix/zabbix_agent.log

39. Enable and start the zabbix agent service
sysrc zabbix_agentd_enable=yes service zabbix_agentd start

Troubleshooting
Problem #1: At least for me, when i was doing the initial setup, zabbix indicated that it couldn't create a configuration file and had a ling to download one.

Solution #1: Download the file to your local computer, open it in notepad and copy its content.
SSH into the jail, create a new config file touch /usr/local/www/zabbix6/conf/zabbix.conf.php and paste the contents of the zabbix config file that we downloaded earlier.
Go back tot he web interface and try again. This should solve the problem

Problem #2: Some times duting the initial setup zabbix will indicate that it cannot connect to the database.

Solution #2: SSH into the zabbix jail
enter the mysql terminal
mysql -uroot -p

then issue the following commands
ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'zabbixDBpass'; FLUSH PRIVILEGES; quit;

and restart the mysql service
service mysql-server restart

In the end, i realized that Zabbix was not the right solution for my envirmoment but I hope that these instructions are helpful to somebody else down the line.
 
Last edited:

TangoFB

Cadet
Joined
Oct 22, 2020
Messages
7
I also noticed this issue and decided to install zabbix myself. I figured it was a good learning exercise.

If you are open to that option, these steps worked for me (please don't ask for support if anything goes wrong as I am not an IT professional). These instructions are lengthy as it involve many moving parts but they should help you get a zabbix6 installed in truenas with apache, PHP7.4 Mysql and IPMI.

Assumptions
You know how to create jails.
You feel comfortable with the command line.
You know how to create, delete and modify config files from the command line.
Jail name: Zabbix
Jail IP: 10.0.0.24
Mysql root password: "zabbix-mysql-root" (PLEASE CHANGE THIS TO SOMETHING SECURE).
Mysql zabbix user password: "zabbixDBpass" (PLEASE CHANGE THIS TO SOMETHING SECURE).
Instructions will not discuss HTTPS redirect or SSL certificates (I use HA proxy on PFsense for this)

1. Create a jail.

2. SSH into truenas.

3. Get into the zabbix jail
iocage console zabbix

Install Zabbix
4. Install packages
pkg update && pkg upgrade pkg install -y libevent libpthread-stubs zlib-ng openipmi fping curl openssl wget pkg install -y apache24 pkg install -y mysql80-server

5. Install zabbix server from ports as this is the only way of getting compatibility with IPMI
portsnap fetch extract portsnap fetch update cd /usr/ports/net-mgmt/zabbix6-server/ make config make install clean
A new window will appear, enable all the options you want (noticed how i selected IPMI

View attachment 56279

6. Install zabbix frontentd and agent
pkg install -y zabbix6-frontend-php74 pkg install -y zabbix6-agent

7. Install php and all required extensions
pkg install -y mod_php74 php74-gd php74-bcmath php74-ctype php74-xml php74-simplexml php74-xmlreader php74-xmlwriter php74-session php74-sockets php74-mbstring php74-gettext php74-ldap php74-openssl php74-mysqli nmap ipmitool nut

Setup apache (webserver)
8. Enable apache
sysrc apache24_enable=yes

9.Open the file /usr/local/etc/apache24/httpd.conf uncomment the line "ServerName", indicate the IP of the jail (10.0.0.24 in this example)save and exit. The line should look similar to
ServerName 10.0.0.24:80

10.Start the webserver
service apache24 start

11. verify that the webserver is running by opening a browser and going to http://10.0.0.24. This should open the default apache webpage.

Setup MySQL
12. Enable and start the mysql service
sysrc mysql_enable=yes service mysql-server start

13.Enable the security features of mysql
mysql_secure_installation
  • The system will ask if we want to "validate password component". Click any key for NO
  • The system will ask for a new password for root. Type "zabbix-mysql-root"
  • the system will ask if we want to "remove anonymous users". Type "Y".
  • The system will ask if we want to "Dissallow root login remotely". Type "Y".
  • The system will ask if we want to "Remove test database and access to it". Type "Y".
  • The system will ask if we want to reload priviledge table now". Type "Y".
14. Enter the Mysql terminal
mysql -uroot -pzabbix-mysql-root

15. enter the following commands
create database zabbix character set utf8mb4 collate utf8mb4_bin; SHOW DATABASES; create USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'zabbixDBpass'; grant all privileges on zabbix.* to 'zabbix'@'localhost'; FLUSH PRIVILEGES; quit;

16. Install the zabbiz database
cd /usr/local/share/zabbix6/server/database mysql -uzabbix -pzabbixDBpass zabbix < mysql/schema.sql mysql -uzabbix -pzabbixDBpass zabbix < mysql/images.sql mysql -uzabbix -pzabbixDBpass zabbix < mysql/data.sql

Setup Zabbix Server
17. open the file /usr/local/etc/zabbix6/zabbix_server.conf, Uncomment and change the following parameters:
LogFile=/var/log/zabbix/zabbix_server.log DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbixDBpass StartIPMIPollers=3

18. create a log folder
mkdir /var/log/zabbix/ chown zabbix:zabbix /var/log/zabbix/

19. enable and start the zabbix server service
sysrc zabbix_server_enable=yes service zabbix_server start

Setup PHP

20. Create the PHP config file
cd /usr/local/etc cp php.ini-production php.ini

21. Open the config file /usr/local/etc/php.ini; uncomment the line "date.timezone" and indicate your timezone. For eastern US it should be
date.timezone= America/New_York

22. Enable and start the php_fpm service
sysrc php_fpm_enable=yes service php-fpm start

23. Create the apache php module config file
touch /usr/local/etc/apache24/modules.d/001_mod-php.conf

24. open the apache php module config file and paste the following text
Code:
<IfModule dir_module>
    DirectoryIndex index.php index.html
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
</IfModule>


25. Test if apache configuration is valid
apachectl configtest

26. Restart apache
service apache24 restart

27. create a test file for php touch /usr/local/www/apache24/data/info.php

28. open the php test file and add the following content
Code:
<?php
phpinfo(); //display all info
?>


29. Create an apache virtual host for the php test page touch /usr/local/etc/apache24/Includes/test.conf

30. add the following content to the apache virtual host for the php test page
Code:
<VirtualHost *:80>
        DocumentRoot "/usr/local/www/apache24/data"
        ServerName 10.0.0.24
        <Directory "/usr/local/www/apache24/data">
                Require all granted
                AllowOverride All
                Options Indexes FollowSymLinks
                Satisfy Any
                <IfModule mod_php7.c>
                        php_value max_execution_time 300
                        php_value memory_limit 512M
                        php_value post_max_size 128M
                        php_value upload_max_filesize 128M
                        php_value max_input_time 300
                        php_value max_input_vars 10000
                        php_value always_populate_raw_post_data -1
                </IfModule>
        </Directory>
        DirectoryIndex index.php index.html
</VirtualHost>


31. Restart apache
service apache24 restart

32. Test by opening a browser and going to http://10.0.0.24/info.php. This should open a webpage with all the specs for the php installation.

33. If everythign went ok, delete the php test files.
rm /usr/local/etc/apache24/Includes/test.conf rm /usr/local/www/apache24/data/info.php

Setup Zabbix frontend
34. Create an apache virtual host for the zabbix frontend page touch /usr/local/etc/apache24/Includes/zabbix.conf

35. add the following content to the apache virtual host for the zabbix frontend page
Code:
<VirtualHost *:80>
    ServerName 10.0.0.24
    ServerAdmin lrossi@levelupec.com
    DocumentRoot "/usr/local/www/zabbix6"
    <Directory "/usr/local/www/zabbix6">
        Require all granted
        AllowOverride All
        Options Indexes FollowSymLinks
        <IfModule mod_php7.c>
            php_value max_execution_time 300
            php_value memory_limit 512M
            php_value post_max_size 128M
            php_value upload_max_filesize 128M
            php_value max_input_time 300
            php_value max_input_vars 10000
            php_value always_populate_raw_post_data -1
        </IfModule>
    </Directory>
    DirectoryIndex index.php index.html
    <IfModule mod_headers.c>
        Header always set Strict-Transport-Security "max-age=31536000"
    </IfModule>
</VirtualHost>


36. Restart apache
service apache24 restart

37. Test by opening a browser and going to http://10.0.0.24/zabbix. This should open the zabbix initial setup wizard. Note, after the wizard has been completed, we can access this zabbix server just by indicating its IP address.

Setup Zabbix agent
38. Open the zabbix agent configuration file /usr/local/etc/zabbix6/zabbix_agentd.conf and change the LogFile line to
LogFile=/var/log/zabbix/zabbix_agent.log

39. Enable and start the zabbix agent service
sysrc zabbix_agentd_enable=yes service zabbix_agentd start

Troubleshooting
Problem #1: At least for me, when i was doing the initial setup, zabbix indicated that it couldn't create a configuration file and had a ling to download one.

Solution #1: Download the file to your local computer, open it in notepad and copy its content.
SSH into the jail, create a new config file touch /usr/local/www/zabbix6/conf/zabbix.conf.php and paste the contents of the zabbix config file that we downloaded earlier.
Go back tot he web interface and try again. This should solve the problem

Problem #2: Some times duting the initial setup zabbix will indicate that it cannot connect to the database.

Solution #2: SSH into the zabbix jail
enter the mysql terminal
mysql -uroot -p

then issue the following commands
ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'zabbixDBpass'; FLUSH PRIVILEGES; quit;

and restart the mysql service
service mysql-server restart

In the end, i realized that Zabbix was not the right solution for my envirmoment but I hope that these instructions are helpful to somebody else down the line.
This is super awesome. Thank you!

May I ask what you decided to go with instead of Zabbix?
 

ragametal

Contributor
Joined
May 4, 2021
Messages
188
This is super awesome. Thank you!

May I ask what you decided to go with instead of Zabbix?
Honestly, I'm just using the integral notification features in Truenas and PFsense which are the main pieces of gear in my network.

I installed zabbix without knowing what it was, just because i saw that everyone seems to like/recommend it. Then I saw that its main purpose is to notify the network admin if any of the monitored parameters goes beyond certain threshold (aka triggers).

I think that Zabbix, while a great piece of software, requires a great time comitment to learn how to set it up properly. I just can't afford to invest that amount of time into a software that gives me the same functionality that i already have. In addition, i realized that it was yet another solution that will require to be maintained/updated (think about updating apache, mysql, php, and then zabbix).

So, using zabbix was just going to overcomplicate my life for no additional benefit besides having a centralized interface to manage triggers.

Don't get me wrong, I can get away with this because my network is small but if my network grows to more than 10 machines i would use zabbix in a heartbeat.

I do miss the "Map" feature with the topology of my network. I'm open to suggestions about other software to get this functionality back if you happen to know one.

The dashboard feature of zabbiz was nice too but not great. You can even find youtube videos on how to integrate zabbix to grafana to get really nice dashboards with the parameters of the entire network just like "TrueCommand" does but then you get trapped into maintaining yet another system (influxDB + grafana).

So, yeah, i decided to make my network simpler by not using any dedicated monitoring software
 
Last edited:

TangoFB

Cadet
Joined
Oct 22, 2020
Messages
7
Honestly, I'm just using the integral notification features in Truenas and PFsense which are the main pieces of gear in my network.

I installed zabbix without knowing what it was, just because i saw that everyone seems to like/recommend it. Then I saw that its main purpose is to notify the network admin if any of the monitored parameters goes beyond certain threshold (aka triggers).

I think that Zabbix, while a great piece of software, requires a great time comitment to learn how to set it up properly. I just can't afford to invest that amount of time into a software that gives me the same functionality that i already have. In addition, i realized that it was yet another solution that will require to be maintained/updated (think about updating apache, mysql, php, and then zabbix).

So, using zabbix was just going to overcomplicate my life for no additional benefit besides having a centralized interface to manage triggers.

Don't get me wrong, I can get away with this because my network is small but if my network grows to more than 10 machines i would use zabbix in a heartbeat.

I do miss the "Map" feature with the topology of my network. I'm open to suggestions about other software to get this functionality back if you happen to know one.

The dashboard feature of zabbiz was nice too but not great. You can even find youtube videos on how to integrate zabbix to grafana to get really nice dashboards with the parameters of the entire network just like "TrueCommand" does but then you get trapped into maintaining yet another system (influxDB + grafana).

So, yeah, i decided to make my network simpler by not using any dedicated monitoring software
Yeah, I am interested in a map as well. I WFH and have a decent lab set up and was really looking for that "single glass view" of my environment. Zabbix was working well until it got nuked by an update and I am starting again from scratch.

The lack of an auto generated map is def a sore spot with me for Zabbix :-/
 

SiCwan

Dabbler
Joined
Dec 4, 2018
Messages
14
Since it doesn't look like anyone figured this out, when you install the plugin, you need to change the securelevel of the jail, that's whats stopping the script from running. I just installed it on mine.
 

TangoFB

Cadet
Joined
Oct 22, 2020
Messages
7
Since it doesn't look like anyone figured this out, when you install the plugin, you need to change the securelevel of the jail, that's whats stopping the script from running. I just installed it on mine.
Confirmed. Changed to 0 and install completed.

Thank you!
 

Anorak

Cadet
Joined
Jan 10, 2023
Messages
1
Hi
I got the same problem on 13.1 and here is a solution.

I discover that installation fails while installing "zabbix6-frontend-php74"
In Github i found a change in packages from "zabbix6-frontend-php74" to "zabbix6-frontend-php81"

But no attempts to update templates and reinstall have been successful. Also i tried to install from json template and it didn't work.

  1. You need open the Shell
  2. Then go to /mnt/ your_pool_name /iocage/.plugins/github_com_ix-plugin-hub_iocage-plugin-index_git
  3. Find zabbixserver.json and change from "zabbix6-frontend-php74" to "zabbix6-frontend-php81"(working for me 13.1-RELEASE-p5) or make this file equal to json on Github
  4. Try to install plugin as usual
 

Archaniel

Explorer
Joined
Jun 9, 2016
Messages
50
Thank you so much for the tutorial.
I used PHP81 instead, worked like a charm.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
The answer to any question about plugins is the same: don't use them.
 
Top