Howto install Zabbix 3.4

Would it be possible to use zabbix 3.4 instead of 3.2 ? Has anyone tried it?

http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/

Sorry, didnt see it:

:bomb: oh man that’s REALLY interesting. How many installations are you monitoring currently?

We monitor mainly our customers’ networks, so it is not only NS but also hypervisors, Access points, switches etc. going to printers. A quick grasp on the numbers of our main monitoring system:

It’s probably a small deployment, but the numbers start to be interesting.

4 Likes

So I will add some details on NS installation of the Zabbix Server, trying to share some more information just because it’s Christmas time and I feel a good boy :laughing:

@mrmarkuz tutorial at the beginning of the thread is quite fine, still I do think some additions may be interesting.

Zabbix Server daemon inside NethServer WebGUI

Integration inside NS WebGUI (under network services, adding exclusions to the firewall) is quite easy:

mkdir -p /etc/e-smith/db/configuration/defaults/zabbix-server
echo "service" > /etc/e-smith/db/configuration/defaults/zabbix-server/type
echo "enabled" > /etc/e-smith/db/configuration/defaults/zabbix-server/status
echo "10051" > /etc/e-smith/db/configuration/defaults/zabbix-server/TCPPort
echo "public" > /etc/e-smith/db/configuration/defaults/zabbix-server/access

db configuration set zabbix-server service status enabled TCPPort 10051 access public
signal-event runlevel-adjust && signal-event firewall-adjust

Adding SNMP support and MIBs

yum install net-snmp-utils nethserver-net-snmp

This would install common MIBs usually used in some templates. Developing custom templates (e.g. for Zyxel Switches) using MIBs is much more easier (because they describe each OID and assigns to some of them strings as names of the OID). If you use OID names, you need to install a copy of the MIB you used in development in the folder /usr/share/snmp/mibs of the Zabbix Server.

Using Postgres as a backend (instead of MariaDB/MySQL)

useradd -m -d /var/lib/zabbix -s /bin/bash zabbix
passwd zabbix
yum install nethserver-postgresql
echo "alter role postgres password 'secret'" | sudo -u postgres psql 
echo "create role zabbix with CREATEDB LOGIN PASSWORD 'secret'" | sudo -u postgres psql
echo "create database zabbix owner zabbix" | sudo -u postgres psql
echo "local\tall\t\tzabbix\t\t\t\tident" >> /etc/e-smith/templates/var/lib/pgsql/data/pg_hba.conf/20auth
# Previous line permits to the Unix user zabbix to authenticate without passing the password.
signal-event nethserver-postgresql-update
yum install --enablerepo=zabbix zabbix-server-pgsql
zcat $(rpm -ql zabbix-server-pgsql | grep create.sql.gz) | sudo -u zabbix psql zabbix
# Configure /etc/zabbix/zabbix_server.conf according to @mrmarcuz guide above
systemctl restart zabbix-server

# Frontend accordingly installed with:
yum install --enablerepo=zabbix php-pgsql zabbix-web zabbix-web-pgsql

Automatic creation of the frontend configuration

You may customize the file /etc/zabbix/web/zabbix.conf.php to automatically configure the frontend (so to skip the first wizard). For example, here’s a template from our ansible playbook:

<?php
// Zabbix GUI configuration file.
global $DB;

$DB['TYPE']			= 'POSTGRESQL';
$DB['SERVER']			= 'localhost';
$DB['PORT']			= '0';
$DB['DATABASE']			= 'zabbix';
$DB['USER']			= '{{ postgresql_username }}';
$DB['PASSWORD']			= '{{ postgresql_passwd }}';
// Schema name. Used for IBM DB2 and PostgreSQL. 
$DB['SCHEMA']			= '';

$ZBX_SERVER			= 'localhost';
$ZBX_SERVER_PORT		= '10051';
$ZBX_SERVER_NAME		= '';

$IMAGE_FORMAT_DEFAULT		= IMAGE_FORMAT_PNG;

Placeholders should be quite clear to understand :wink:

Zabbix agent

If you use other NethServers in your networks (as we do :wink: ), you may want to use Zabbix Agent to monitor them. Configure it like this:

# Following lines create a unix 'zabbix' user which can run any program as root
useradd -m -d /var/lib/zabbix -s /bin/bash zabbix
passwd zabbix # use strong password!
echo "zabbix ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/zabbix
chmod 0440 /etc/sudoers.d/zabbix

yum localinstall http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install --enablerepo=zabbix zabbix-agent

# Edit zabbix_agentd.conf file - see below

# Integrating the Agent within NethServer GUI
mkdir -p /etc/e-smith/db/configuration/defaults/zabbix-agent
echo "service" > /etc/e-smith/db/configuration/defaults/zabbix-agent/type
echo "enabled" > /etc/e-smith/db/configuration/defaults/zabbix-agent/status
echo "10050" > /etc/e-smith/db/configuration/defaults/zabbix-agent/TCPPort
echo "public" > /etc/e-smith/db/configuration/defaults/zabbix-agent/access
db configuration set zabbix-agent service status enabled TCPPort 10050 access public
signal-event runlevel-adjust && signal-event firewall-adjust 
systemctl restart zabbix-agent

Agent configuration file (/etc/zabbix/zabbix_agentd.conf) is well commented and documentation online is quite complete, so be careful to correctly configure at least the following variables:

Server={{ your_zabbix_server_IP }}
ServerActive={{ your_zabbix_server_IP }}
User=zabbix

Last one is to drop permissions on zabbix-agent daemon to run as zabbix Unix user. Unfortunately we didn’t develop a NethServer GUI to configure base parameters, this may be a good addition.

Caution Also your Zabbix Server should have its own Agent, so you may follow the same steps! Server and ServerActive in this case can be leaved at 127.0.0.1.

Next round I will share instructions on how to monitor NS backups using the agent, a script, some UserParameters and a custom template, and the configuration for the Zabbix Proxy :slight_smile: Just hope this is not coming next Christmas :wink:

5 Likes

Please follow instructions on the GitHub repository I just created :slight_smile:

First of all, do I need a proxy? What are the main advantages of having a proxy?
A Zabbix Proxy is a machine which acts like a ‘local Zabbix Server’ in a remote network, sampling the remote network and collecting data to be passed to the real Zabbix Server. It is most useful if you have a lot of hosts to monitor and you cannot open up ports on your firewall. Also, it stores locally all the collected values before passing it to the server, assuring that (in case of missing connectivity) it will retain data until it reaches the server again.

Also, you will do a basic configuration on the proxy, just to make it talk to the Server and to be available to the hosts to monitor: any other configuration (like items to check on each host) will be syncronized from the server automatically.

In the remote network with the proxy installed, all the Agents should point to the local proxy in their Server and ServerActive directives. Also, a Proxy should have its own Agent (and the installation was already explained).

On Proxy installation, starting from a bare NethServer:

# Following lines create a unix 'zabbix' user which can run any program as root
useradd -m -d /var/lib/zabbix -s /bin/bash zabbix
passwd zabbix # use strong password!
echo "zabbix ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/zabbix
chmod 0440 /etc/sudoers.d/zabbix

# Installing and configuring PostgreSQL as local database for item collection
yum install nethserver-postgresql
echo "alter role postgres password 'secret'" | sudo -u postgres psql
echo "create user zabbix with createdb login password 'secret'" | sudo -u postgres psql
echo "create database zabbix_proxy owner zabbix" | sudo -u postgres psql
# Below line permits access with no password to the unix user 'zabbix'
echo "local\tall\t\tzabbix\t\t\t\tident" >> /etc/e-smith/templates/var/lib/pgsql/data/pg_hba.conf/20auth
signal-event nethserver-postgresql-update

# Installation of the Proxy
yum localinstall http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install --enablerepo=zabbix zabbix-proxy-pgsql
zcat $(rpm -ql zabbix-proxy-pgsql | grep schema.sql.gz) | sudo -u zabbix psql zabbix_proxy

# Configure the zabbix_proxy.conf file (see below)
systemctl restart zabbix-proxy

# Adding zabbix-proxy to the services managed by NethServer
mkdir -p /etc/e-smith/db/configuration/defaults/zabbix-proxy
echo "service" > /etc/e-smith/db/configuration/defaults/zabbix-proxy/type
echo "enabled" > /etc/e-smith/db/configuration/defaults/zabbix-proxy/status
echo "10051" > /etc/e-smith/db/configuration/defaults/zabbix-proxy/TCPPort
echo "public" > /etc/e-smith/db/configuration/defaults/zabbix-proxy/access
db configuration set zabbix-proxy service status enabled TCPPort 10051 access public
signal-event runlevel-adjust && signal-event firewall-adjust 
systemctl restart zabbix-proxy

About configuration of the proxy, the file is /etc/zabbix/zabbix_proxy.conf. As for the Agent configuration file, it is well commented and explained. The fundamental settings you should modify are:

Server={{ your_zabbixserver_IP }}
Hostname={{ choose_an_hostname }}
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=secret
User=zabbix

Regarding the Hostname directive, this should be the same string you have to configure inside the Zabbix Server in the Administration > Proxies > Create new proxy wizard, so it is better to have a fixed one.

Hope this helps :slight_smile:

3 Likes

Please feel free to test the nethserver-zabbix module! I didn’t really use Zabbix for a long time, I am more a Nagios user, so please share your suggestions to help improving Zabbix for NethServer. Thanks to @syntaxerrormmm, @Andy_Wismer, @dz00te and anybody I forgot to mention.

Features:

  • postgresql
  • zabbix-server, agent and web UI ready to go
  • should work with any version from zabbix repo
yum -y install https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum -y install https://smart-ict.services/mirror/mrmarkuz/7/noarch/nethserver-zabbix-0.0.1-4.ns7.noarch.rpm

Now you may login to https://YOURNETHSERVER/zabbix as Admin (case-sensitive) with password zabbix. Go to “Configuration/Hosts” and enable the Zabbix server host.

CAUTION! This is a testing package, don’t use on production systems :smiley:

To have some test problems just add a Windows client :slight_smile:

5 Likes

@mrmarkuz

Hi

Just installed your Version of NethServer-Zabbix…

The only problems with the install was a mirror issue:

zabbix-server-pgsql-3.4.6-1.el FAILED
http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-server-pgsql-3.4.6-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-server-pgsql-3.4.6-1.el7.x86_64.rpm: (28, ‘Connection timed out after 30000 milliseconds’)
Trying other mirror.
zabbix-server-pgsql-3.4.6-1.el FAILED
http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-server-pgsql-3.4.6-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-server-pgsql-3.4.6-1.el7.x86_64.rpm: (28, ‘Connection timed out after 30000 milliseconds’)
Trying other mirror.
(14/14): zabbix-server-pgsql-3.4.6-1.el7.x86_64.rpm | 2.0 MB 00:00:01

But it did finally install on the third try…

It’s now installed and working. A view of the map:

One (small) problem observed: The default values for processes on the Zabbix-Server (Also the NethServer) is too low…

Otherwise it seems to be working in the chosen environment, a small home server for a friend.

Cool stuff!

1 Like

Thanks for testing!

Which values would you recommend?

Hard to say at the moment, there’s hardly any load on the server at the moment…
But this is a really low powered, old box - a HP Proliant ML110 G4 (!) - and there’s not much running besides Firewall, Mail, NextCloud and Zabbix.

See the load below…

I’d say 400-500 would be a good value.

Also a good idea would be to change the default symbol reflecting NethServer… :wink:
I can provide these as a ZIP including all 5 default sizes… (Mail?)

BTW: I really like the fact that Zabbix shows up under Applications (Anwendungen)!

Andy

1 Like

Hi everybody!

Finally i have tested your solution which has been described here by @mrmarkuz and @syntaxerrormmm - and I must say that i haven’t seen better Zabbix Howto that this - great job all of you - finally i can monitor my network/server environment !

I was wondering if the developer team could make it possible to have Zabbix as a module in NS ?

3 Likes

You may try this one, maybe I should make it more visible…

Thanks to @Andy_Wismer who sent some nice symbols to use, I’ll implement them asap.

sorry for the late reply … i’ve installed last week as test-in-production :slight_smile: and for now it’s all ok (only linux server monitoring ) but i still need to reconfigure lot of things…
anyway no error during install and i appreciate the postgresql choiche…
great work :clap: tnx i’ll keep you informed

1 Like

Thanks for testing!

1 Like

@mrmarkuz

I’m so intrigued by this that I’ve got this running on 4 servers. All 4 are running excellently so far - no hiccups!

Quite a few of my clients run a small environment, some at home, some even in the small office. Quite common is a HP Microserver Gen8 with 16 GB RAM and virtualisation (Now all ProxMox). There’s hardly enough RAM to run a NethServer and a Windows (Terminal/RDP) Server side by side - let alone a Stand-Alone monitoring system (Zabbix).

Then again, a few clients who have NethServer running on an older Server hardware, but natively. No virtualisation or possibility of a stand alone monitoring system. This helps in such a scenario, too!

Markus, you must make this a full Module for NethServer, I’ll gladly provide the testing and Symbols.

A bow to the City of Vienna! Keep up your excellent work!

Andy Wismer

3 Likes

Why not using a Zabbix Proxy in this case? Well, one for each customer I mean. We use a virtualized NethServer with 1/2 vCPU and 2 GB of RAM on each customer’s hypervisor. Alternatively you may deploy a Proxy on a RaspberryPi :wink: you then link all the proxies to a single centralized Server. Trust me, Zabbix binaries are really optimized and will work well also on poor hardware.

@syntaxerrormmm

My clients want in house monitoring. My older Nagios was satisfied with 1-2 GB RAM, Zabbix takes 2-4 or more…

For the Multiple-Sites scenario, I like the idea of using OPNsense as the Firewall, and NethServer as Server On-Site. OPNsense actually comes with an Agent or Proxy (or both) if needed. I have cases where the remote site has basically ONLY a windows cashier-box, sometimes a networked printer, and VPN to the main site.

The client’s OK with buying the OPNsense hardware, I get monitoring thrown in with the VPNs… :wink:

My 2 cents

Andy

You are lucky. Ours don’t, plus I am quite sure they wouldn’t like to pay for monitoring even when you explain to them why they would want to have it in place. Answering to them “We know what’s going on” when they call you on phone with issues is a much sufficient reward in some case.

Sure, as always, YMMV and you are not bound to choices done by other within NS; still, if you are ok with Nagios, why bothering changing monitoring system?

I think Zabbix is far superior to Nagios for a lot of reasons (you may add/remove checks to a host from the web interface; the single frontend console can be set up to show data only for a customer using different usernames to access it; autodiscoverying/autoregistration rules can be set up, so customers only need to install the Agent [if you provide an installer to them] or enable SNMP on a device; it can be extended with small effort if you are ok with writing some scripts and a lot more).

You may be accustomized to some kind of setup/hardware but I do think Zabbix is flexible enough to fit inside 1 GB RAM box (if you don’t use, for example, JMX checks for Java/Tomcat applications). As I have said, binaries are really optimized. Below some graphs for a Proxy on a Raspberry PI (1 week of data). This Raspberry PI collects data about 153 checks on 7 hosts.

1 Like

In comparison to only Nagios this is absolutely true. I use to monitor networks with OMD which is able to manage any point you mentioned with Nagios or Icinga as core. This is not about Zabbix vs. Nagios, i just wanted to point out that Nagios fans still have the possibility to use their favourite monitoring inside NethServer with nice web UI.

@syntaxerrormmm

I was using a simple distri called FAN. It worked for a while great, still does actually.
But being based on an OLD Kernel, and no more updates since 2+ years AND Repo shut down by centos / red hat I thought it’s time to move on.

That’s when, durng evaluation, I discovered Zabbix - and I’m sold on it!

Many Maps, Screens, and it all comes in one package.

Their Client List is also quite respecatable, I know of more huge companies who use it, but aren’t displayed on the customer list…

My 2 cents
Andy

@syntaxerrormmm, I tested your backup monitor script, it rocks! :clap:

You missed a “d” in zabbix_agentd.d in the README:

install -m 0644 -o root -g root userparameter_nethserver.conf /etc/zabbix/zabbix_agentd.d/userparameter_nethserver.conf

@Andy_Wismer, how do you import all the images? I managed to import them in postgresql:

Create following directory symbols_by_andy_wismer and put the images there, it has to be there to be correctly imported, at least I found no other way:

mkdir -p /var/lib/pgsql/data/symbols_by_andy_wismer
cd /var/lib/pgsql/data/symbols_by_andy_wismer

Then import the images:

for d in *; do su postgres -c "psql zabbix postgres -c \"insert into images (imageid,imagetype,name,image) values ((select max(imageid) +1 from images),1,'$d',pg_read_binary_file('symbols_by_andy_wismer/$d'));\""; done
1 Like