Difference between revisions of "Zabbix"

From SME Server
Jump to navigationJump to search
 
(92 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Languages}}
+
{{Languages|Zabbix}}
  
===Maintainer===
+
{{Incomplete}}
[[User:VIP-ire|Daniel B.]]<br/>
 
[http://www.firewall-services.com Firewall Services]<br>
 
mailto:daniel@firewall-services.com
 
  
{{Incomplete}}
 
  
 +
===Maintainer===
 +
[mailto:daniel@firewall-services.com][[User:VIP-ire|Daniel B.]] from [http://www.firewall-services.com Firewall Services]
 
=== Description ===
 
=== Description ===
  
[http://www.zabbix.com Zabbix] offers advanced monitoring, alerting and visualisation features today which are missing in other monitoring systems, even some of the best commercial ones:
+
[http://www.zabbix.com Zabbix] offers advanced monitoring, alerting and visualisation features today which are missing in other monitoring systems, even some of the best commercial ones.
  
 
=== Features ===
 
=== Features ===
Line 24: Line 22:
 
*Scalability
 
*Scalability
 
** Tested with 10,000 monitored devices and servers
 
** Tested with 10,000 monitored devices and servers
** Tested with 100,000 availability and perfomance checks
+
** Tested with 100,000 availability and performance checks
 
** Processing of thousands of availability and performance checks per second
 
** Processing of thousands of availability and performance checks per second
  
Line 46: Line 44:
  
 
*Assuring SLA
 
*Assuring SLA
** Hierarchial IT Services
+
** Hierarchical IT Services
 
** Real-time SLA reporting
 
** Real-time SLA reporting
  
Line 128: Line 126:
 
** All data is stored in a database (Oracle, MySQL, PostgreSQL, SQLite)
 
** All data is stored in a database (Oracle, MySQL, PostgreSQL, SQLite)
 
** Centralised configuration and storage of information
 
** Centralised configuration and storage of information
 
*All Information is Available Online
 
** ZABBIX Manual
 
** ZABBIX Forums
 
** ZABBIX Wiki
 
 
*Backed by ZABBIX Company
 
** Annual support agreements
 
** Turn-key solutions
 
** Technical Account Manager
 
** Professional Services
 
  
 
*and more...
 
*and more...
Line 144: Line 131:
 
=== Full documentation ===
 
=== Full documentation ===
  
This wiki page is not a complete guide for Zabbix, but just a starting point to run it on your SME Server using this contrib.
+
A complete documentation is available as a PDF file [https://www.zabbix.com/documentation/current/en here.]
For a complete documentation, please refere to the project documentation: http://www.zabbix.com/documentation.php
+
You'll also find some useful informations on the official [https://www.zabbix.com/forum/ forum].
 +
 
 +
{{Note box|This wiki page is not a complete guide for Zabbix, but just a starting point to run it on your SME Server using this contrib.
 +
For a complete documentation, please refer to the project documentation: https://www.zabbix.com/documentation/current/en.}}
  
 
=== Versions ===
 
=== Versions ===
Here are informations about the latest release of each component:
+
The following is the information about the latest release of each component:
{{ #smeversion: smeserver-zabbix-server }}
+
{{#smeversion: smeserver-zabbix-server }}
{{ #smeversion: zabbix-server }}
+
{{#smeversion: smeserver-zabbix-server-z50 }}
{{ #smeversion: smeserver-zabbix-agent }}
+
{| class="wikitable"
{{ #smeversion: zabbix-agent }}
+
!Release name
{{ #smeversion: smeserver-zabbix-proxy }}
+
!Release date
{{ #smeversion: zabbix-proxy }}
+
!End of Full Support*
 
+
!End of Limited Support**
 
+
!SME9
 
+
!SME10
 +
|-
 +
|Zabbix 6.2
 +
|Jul 5, 2022
 +
|Jan 31, 2023
 +
|Feb 28, 2023
 +
|X
 +
|X
 +
|-
 +
|Zabbix 6.0 LTS
 +
|Feb 8, 2022
 +
|Feb 28, 2025
 +
|Feb 28, 2027
 +
|X
 +
|X
 +
|-
 +
|Zabbix 5.0 '''LTS'''
 +
|May 12, 2020
 +
|May 31, 2023
 +
|May 31, 2025
 +
|X
 +
|yes
 +
|-
 +
|4.4 (EOL)
 +
|
 +
|
 +
|
 +
|yes
 +
|yes
 +
|-
 +
|Zabbix 4.0 '''LTS'''
 +
|October 1, 2018
 +
|October 31, 2021
 +
|October 31, 2023
 +
|yes
 +
|X
 +
|}
  
 
=== Requirements ===
 
=== Requirements ===
*SME Server 7.X
+
*SME Server 7.X (9.X or higher for zabbix-server)
*php-bcmath (smeserver-zabbix-server only): if you have the standard php4 module, it should be ok. If you have upgraded to php5 from centosplus repo, you should manually install php-bcmath package
+
*php>=5.4 for zabbix server only, hence you will need to first install smeserver-php-scl on SME9 and set php54 or higher as default php version
  
 
=== Components ===
 
=== Components ===
Line 167: Line 193:
 
Zabbix is composed of four major components:
 
Zabbix is composed of four major components:
 
*The server (the main part). The server will store and analyse the different data, send alerts, etc...
 
*The server (the main part). The server will store and analyse the different data, send alerts, etc...
*The web interface (which is automatically installed with the server with this contrib)
+
*The web interface (which is automatically installed with the server with this contrib).
*The agent, which gathers informations on the different element you monitor
+
*The agent, which gathers informations on the different hosts you monitor.
*The proxy, which is an optional part, can be used to collects performance and availability data locally, and send it to the server
+
*The proxy, which is an optional part, can be used to collect performance and availability data locally, and send it to the server.
  
 
==== Server ====
 
==== Server ====
  
The server is the core component of Zabbix software. It uses one database (MySQL in this contrib) to store configuration, performance and integrity informations. The server can check network services with simple check (icmp, tcp etc...) for agent-less monitoring, it can monitor network devices using snmp and is also the central component to which agent report informations (agent can work in active, passive, or both mode). The server will also analyze all the informations and send alerts depending on very flexible triggers.
+
The server is the core component of Zabbix software. It uses one database (MySQL in this contrib) to store configuration, performance and integrity information. The server can check network services with simple check (ICMP, TCP etc...) for agent-less monitoring, it can monitor network devices using SNMP and is also the central component to which agent report information (agent can work in active, passive, or both mode). The server will also analyse all the information and send alerts depending on very flexible triggers.
  
===== Installation =====
+
===== Installation=====
 +
<tabs container=""><tab name="SME 10">
 +
to install zabbix 4.4
 +
yum install smeserver-extrarepositories-zabbix -y
 +
db yum_repositories setprop zabbix44 status enabled
 +
signal-event yum-modify
 +
yum install smeserver-zabbix-server --enablerepo=smecontribs
 +
 
 +
<br />
 +
the following version are available :
 +
zabbix42  zabbix44  zabbix45  zabbix50  zabbix51  zabbix52  zabbix53
 +
 
 +
Zabbix is not provided as server on Rhel 7 for version 5.1 and up. This is because of base php version, which could be worked around using php-fpm, but would also need  us to build it.
 +
 
 +
install zabbix 50 server
 +
  yum install smeserver-extrarepositories-zabbix -y
 +
db yum_repositories setprop zabbix50 status enabled
 +
db yum_repositories setprop zabbix50-frontend status enabled
 +
expand-template /etc/yum.smerepos.d/sme-base.repo
 +
yum install smeserver-zabbix-server-z50 --enablerepo=smecontribs
 +
 
 +
 
 +
</tab>
 +
<tab name="SME 9">
 +
First enable the needed repo: Firewall service and REMI
 +
{{:Fws}}
 +
{{:Remi-safe}}
 +
 
 +
signal-event yum-modify
  
 
to install Zabbix server, just use yum:
 
to install Zabbix server, just use yum:
  yum --enablerepo=smecontribs install smeserver-zabbix-server
+
  yum --enablerepo=smecontribs,fws,remi-safe install smeserver-zabbix-server --exclude=smeserver-zabbix-proxy
 +
NB: the --exclude=smeserver-zabbix-proxy is due to a conflict in late 2019 on SME9 as FWS started using zabbix from zabbix repo instead of building it.
 +
 
 +
Then go to your server-manager to set php5.4 or higher as default php for your SME, or you will not be able to access to zabbix web gui, or just issue the following
 +
config setprop php54 PhpModule enabled  #replace here with php55 or php56 if you have other needs
 +
signal-event php-update
 +
 
 +
then you will have to either tweak the default configuration as explain in next step or just issue :
 +
signal-event zabbix-server-update
 +
</tab>
 +
</tabs>
 +
then go to your web interface : https://yourserveradress/zabbix
  
 
===== DB Parameters =====
 
===== DB Parameters =====
  
 
Here's the list of available DB parameters for zabbix-server service on SME:
 
Here's the list of available DB parameters for zabbix-server service on SME:
 +
*'''AdminPassword''': A random password is generated during the installation for Admin user. Replace the default weak zabbix password upon install.
 
*'''DbName''': The name of the database where everything is stored. Default is 'zabbixdb'
 
*'''DbName''': The name of the database where everything is stored. Default is 'zabbixdb'
 
*'''DbPassword''': The password of the database. A random password is generated during the installation
 
*'''DbPassword''': The password of the database. A random password is generated during the installation
Line 190: Line 256:
 
*'''JabberPassword''': Password for the account (for "JabberAccount")
 
*'''JabberPassword''': Password for the account (for "JabberAccount")
 
*'''JabberTLS''': (enabled|disabled) Does your Jabber server requires TLS security
 
*'''JabberTLS''': (enabled|disabled) Does your Jabber server requires TLS security
{{Note box|The different Jabber settings above are not for the builtin jabber notification function (because I couldn't get it working as my server reuiqres TLS and the builtin feature do not support it). But I've included a external script using sendxmpp to send the notification. You should have a media called 'xmpp' in zabbix administration. }}  
+
{{Note box|The different Jabber settings above are not for the built-in jabber notification function (because I couldn't get it working as my server requires TLS and the built-in features do not support it). But I've included a external script using sendxmpp to send the notification. You should have a media called 'xmpp' in zabbix administration. }}  
  
*'''NodeID''': The node ID of your server. If you don't use ditributed monitoring (just one central zabbix server), you should let this to 0
+
*'''NodeID''': The node ID of your server. If you don't use distributed monitoring (just one central Zabbix server), you should let this to 0
 
*'''TCPPort''': Port used for agent<->server (and proxy<->server) communication. The default is 10051
 
*'''TCPPort''': Port used for agent<->server (and proxy<->server) communication. The default is 10051
*'''TimeZone''': It's very important for zabbix to know your timezone (PHP TimeZone setting). Unfortunally, SME do not set it. You can specify your timezone. This setting will only affect Zabbix
+
*'''TimeZone''': It's very important for zabbix to know your time zone (PHP TimeZone setting). Unfortunately, SME do not set it. You can specify your time zone. This setting will only affect Zabbix
 
*'''WebAccess''': (local|public|disabled) From where you'll be able to access the web interface. You can set it to disabled if you want to disable the web interface (for example, if your server is a node of a distributed environment)
 
*'''WebAccess''': (local|public|disabled) From where you'll be able to access the web interface. You can set it to disabled if you want to disable the web interface (for example, if your server is a node of a distributed environment)
*'''access''': (public|local) From where zabbix port will be available (controlled by TCPPort). You should restrict the access to a list of host with the AllowHost key if you set public here.
+
*'''access''': (public|local) From where zabbix port will be available (controlled by TCPPort). You should restrict the access to a list of host with the AllowHosts key if you set public here.
 
*'''status''': Should the service be started automatically ?
 
*'''status''': Should the service be started automatically ?
  
Line 208: Line 274:
 
===== Web Interface =====
 
===== Web Interface =====
  
The main web interface is available (if not disabled with teh key WebAccess) on https://server.domain.tld/zabbix.
+
The main web interface is available (if not disabled with the key WebAccess) on https://server.domain.tld/zabbix.
The default user is admin, with password 'zabbix'.
+
The default user is '''Admin''' (with uppercase A as first letter), with strong password found in the config property AdminPasswd starting smeserver-zabbix-server 0.1-29. If you change it, it will not be overwritten on update. ( prior that the default was '''zabbix''', in this case you should change this password ASAP)<syntaxhighlight lang="bash">
 +
config getprop zabbix-server AdminPassword
 +
</syntaxhighlight>Here are some screenshots of what you can get with zabbix
 +
[[File:Zabbix_graph_cpu.png|768px|thumb|center|CPU Usage Graph]]
 +
[[File:Zabbix_graph_mem.png|768px|thumb|center|Memory Usage Graph]]
 +
[[File:Zabbix_graph_network.png|768px|thumb|center|Network Usage Graph]]
 +
{{Note box|You can select a period on any graph. With this great feature, you can easily zoom on a period of time to analyse things with hight precision}}
 +
[[File:Zabbix_graph_mail_in.png|768px|thumb|center|Incoming mails statistics]]
 +
[[File:Zabbix_screen.png|768px|thumb|center|Screen]]
 +
{{Note box|You can display as many graphs as you want in one screen, automatically refresh it, change it (display network graphs of hosts 1 during 2minutes, then display hardware graphs of hosts2 for 3 minutes etc...)}}
 +
[[File:Zabbix_overview.png|768px|thumb|center|Triggers overview]]
 +
[[File:Zabbix_map.png|768px|thumb|center|Hosts Map]]
 +
{{Note box|this is a very simple map, you can make it look nicer}}
 +
 
 +
 
 +
For more screenshots, visit the project website [http://www.zabbix.com/screenshots.php here]
  
 
==== Agent ====
 
==== Agent ====
  
===== Installation =====
+
see [[Zabbix-agent]]
  
to install Zabbix agent, just use yum:
+
==== Proxy ====
yum --enablerepo=smecontribs install smeserver-zabbix-agent
+
see [[Zabbix-proxy]]
  
===== DB parameters =====
+
=== Monitoring SME servers ===
  
Here's the list of available DB parameters for zabbix-agent service on SME:
+
If you want to monitor SME Servers with zabbix, you'll first need to install the agent as explained earlier, then configure the agent to accept connection from your server. For example, to monitor you local server (the one running zabbix-server):
*'''RemoteCommands''': (enabled|disabled). If you want to enable remote commands on zabbix agent (you should read the zabbix documentation). Please, be aware that there're security implications if you enable it. The default is disabled
 
*'''ServerPort''': port to contact the server when running in active mode. Default to 10051
 
*'''Servers''': List of servers (or proxy), separated by commas, to which send informations. The first one may be used for active checks, the others are only for passive mode
 
*'''TCPPort''': TCP port on which the agent will listen if passive mode is enabled
 
*'''access''': (public|private) If you want to open the agent on the public interface (only usefull if passive is enabled). If you set this to 'public' you should use the AllowHost key to limit the access
 
*'''active''': (enabled|disabled) Do you want to enabled the active mode
 
*'''passvie''': (enabled|disabled) Do you want to enable the passive mode
 
*'''status''': (enabled|disabled) Should the service be automatically started
 
  
===== Additional checks =====
+
db configuration setprop zabbix-agent Servers localhost active disabled passive enabled
 +
signal-event zabbix-agent-update
  
Even if zabbix agent is great and support natively a lot of checks, some where missing for my usage, so I've added some UserParameters entry in the config file. For each of this check, you should add a new item with the name of the check as the key.
+
{{Note box|After installation, the agent is configured for active checks only. Here, we disable the active checks, and enable the passive ones.}}
You can have a look at the configuration file /etc/zabbix/zabbix_agentd.conf (at the end of the file) to see the command used to return the corresponding value
 
  
*External IP:
+
Then, just add a host in Zabbix, pointing to localhost.
**'''ip.external''': Return the real external IP address.
 
  
*Incomming mails statistics:
+
Now you can start adding items (type agent (active or passive depending on the mode you use on the agent)) to this new host.
**'''mail.in.denied.dnsbl''': number of emails rejected by DNSBL since the last run
 
**'''mail.in.denied.rhsbl''': number of emails rejected by RHSBL since the last run
 
**'''mail.in.denied.clamav''': number of emails rejected by CLAMAV since the last run
 
**'''mail.in.denied.earlytalker''': number of emails rejected by EARLYTALKER since the last run
 
**'''mail.in.denied.basicheaders''': number of emails rejected by BASICHEADERS since the last run
 
**'''mail.in.denied.goodrcptto''': number of emails rejected by GOODRCPTTO since the last run
 
**'''mail.in.denied.spamhelo''': number of emails rejected by SPAMHELO since the last run
 
**'''mail.in.denied.total''': sum of rejected emails (sum of the above checks) since the last run
 
**'''mail.in.denied.spam''': number of emails rejected by SPAMASSASSIN since the last run
 
**'''mail.in.denied.other''': number of emails rejected by others checks since the last run
 
**'''mail.in.queued.spam''': number of emails queued but marked as spam by SPAMASSASSIN since the last run
 
**'''mail.in.queued''': number of emails queued (HAM) since the last run
 
**'''mail.in.total''': number of emails received since the last run (accept + denied)
 
  
*Outgoing mails statistics
+
If you want to monitor SME Servers on the Internet and use passive mode, the server will initiate connections to the agent. You'll need to port-forward the port if you run in serveronly mode (the default is port 10050 TCP), or to open this port in the firewall if runing in server&gateway mode:
**'''mail.out.total''': sum of outgoing emails since the last run
 
**'''mail.out.success''': number of successful transmitted emails since the last run
 
**'''mail.out.deferral''': number of deferred emails since the last run
 
**'''mail.out.failure''': number of failures since the last run
 
  
*Memory/Swap usage
+
db configuration setprop zabbix-agent Servers w.x.y.z active disabled passive enabled access public AllowHosts w.x.y.z
**'''vm.memory.size.used''': Actually used memory in bytes
+
signal-event zabbix-agent-update
**'''vm.memory.size.pused''': Actually used memory in %
 
**'''system.swap.size.used''': Actually used swap space in bytes
 
  
*MySQL Informations
+
{{Warning box|If you use active checks, you need to name the host in zabbix server hostname.domainname.tld (check the file /etc/zabbix/zabbix_agentd.conf, the directive Hostname). If you don't do that, checks won't work}}
**'''mysql.uptime''': uptime of mysql server in seconds
 
**'''mysql.threads''': number of threads
 
**'''mysql.questions''': number of queries since mysql has been started
 
**'''mysql.slowqueries''': number of slow queries
 
**'''mysql.qps''': average queries per seconds
 
**'''mysql.size''': total space used by mysql databases
 
  
*Network usage
+
You can download [http://repo.firewall-services.com/misc/monitoring/templates_zabbix.zip here] an archive with some XML exports of the templates I use to monitor my servers. Just extract the archive, and import the templates you want in Zabbix (using the Import/Export menu of zabbix configuration)
**'''net.if.in.internal'''
 
**'''net.if.out.internal'''
 
**'''net.if.in.external'''
 
**'''net.if.out.external'''
 
  
*UPS status
+
Each XML file represent a template in Zabbix
**'''ups.load'''
 
**'''ups.battery.charge'''
 
**'''ups.status'''
 
**'''ups.model'''
 
  
==== Proxy ====
+
*'''Template_SME''' is the main template. It'll add a lot of items for global system monitoring, triggers if load is too high, lack of free memory, httpd is down, passwd has changed etc... and also some graphs like CPU usage, memory, disk space, network usage etc... This templates requires the '''Template_icmp''' and '''Template_app_MySQL''' template
 +
 
 +
*'''Template_SME_coovaChilli''' will add tun0 statistics (useful if you use [[CoovaChilli]] contrib). It'll also create a graph for tun0 stats
  
===== Installation =====
+
*'''Template_SME_softRaid''' will add items and triggers for software raid monitoring. If you link a SME Server with this template, you'll be warned if one of the raid array is degraded or rebuilding
  
to install Zabbix proxy, just use yum:
+
*'''Template_SME_megaRaid''' will do the same but for MegaRaid based cards. It also requires the MegaCli utility from [http://www.lsi.com/storage_home/products_home/internal_raid/megaraid_sas/ LSI] website
yum --enablerepo=smecontribs install smeserver-zabbix-proxy
 
  
===== DB Parameters =====
+
*'''Template_SME_nutUPS''': Will add items and triggers to be warned if your UPS is on battery, or overloaded.
*'''DbName''': the name of the database used by the proxy. The default is zabbixproxydb
 
*'''DbPassword''': the password to access the database
 
*'''DbUser''': the user to access the database
 
*'''Servers''': List of servers (separated by commas) to which send the informations
 
*'''TCPPort''': TCP port on which the proxy listen. Clients will connect on the proxy as if it's a zabbix server. The default is 10051
 
*'''access''': (private|public) If you want to open zabbix-proxy on the external interface. If you set this to public, you should use the AllowHosts key to limit the access
 
*'''status''': (enabled|disabled) Should the service be starte dautomatically
 
  
=== Monitoring SME servers ===
+
*'''Template_icmp''': will configure two items to check if the server is alive, and measure the latency. It also provides latency graphs and some triggers (if latency is too high, if host is down since more than 5min and if hosts is down for more than 1 hour)
  
If you want to monitor SME Servers with zabbix, you'll first need to install the agent as explained earlier, then
+
=== Monitoring ressources ===
configure the agent to send informations to your server. For example, to monitor you local server (the one running zabbix-server):
 
db configuration setprop zabbix-agent Servers localhost
 
signal-event zabbix-agent-update
 
  
 +
* https://github.com/zabbix/community-templates
 +
* https://git.lapiole.org/rpms/zabbix-agent-addons
 +
*
  
Then, just add a host in zabbix, pointing to localhost. Remember, the default mode for the agent is active mode only, so you'll have to name this new host <hostname>.<domain.tld>, then enter 127.0.0.1 in the IP address field.
+
=== Upgrading 4.4 to 5.0 ===
 +
see this page https://www.zabbix.com/documentation/5.0/en/manual/installation/upgrade_notes_500. Mostly you will need to
  
Now you can start adding items (type agent (active)) to this new host.
+
* migrate your db from mariadb 5.5 to mariadb 10.5 with its user if not already done
 +
* fix the  row format to dynamic<syntaxhighlight lang="bash">
 +
echo "USE $(config getprop zabbix-server DbName); alter table hosts row_format = dynamic; "|mysql105
 +
</syntaxhighlight>
 +
* fix ENGINE if forgotten before (y'''ou better doing it before importing it''', converting the history table could take days (yes days not hours)
 +
<syntaxhighlight lang="bash">
 +
echo "SELECT CONCAT('ALTER TABLE ',TABLE_NAME,' ENGINE=InnoDB;')  FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='MyISAM' AND table_schema = 'zabbixdb';" |mysql105 -s|mysql105 zabbixdb
 +
</syntaxhighlight>
 +
* fix collation, for the issue "[Z3005] query failed: [1071] Specified key was too long; max key length is 3072 bytes [create index items_1 on items (hostid,key_(1021))]" [https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/401826-database-upgrade-failed-specified-key-was-too-long-max-key-length-is-3072-bytes see here.]<syntaxhighlight lang="bash">
 +
echo "SELECT CONCAT('ALTER TABLE ',TABLE_SCHEMA,'.',TABLE_NAME,' CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;') FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'zabbixdb';" |mysql105 -s |mysql10
 +
</syntaxhighlight>
 +
* fix the table with database/mysql/double.sql<syntaxhighlight lang="mysql">
 +
cat /usr/share/doc/zabbix-server-mysql-5.0.30/double.sql |mysql105 `config getprop zabbix-server DbName`
 +
</syntaxhighlight>
 +
* fix the  foreign key for the issue "[Z3005] query failed: [1091] Can't DROP FOREIGN KEY `c_items_1`; check that it exists [alter table items drop foreign key c_items_1]" [https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/402412-zabbix-4-4-8-to-5-0-upgrade-failure see here]<syntaxhighlight lang="bash">
 +
echo "ALTER TABLE items ADD CONSTRAINT c_items_1 FOREIGN KEY (hostid) REFERENCES hosts (hostid) ON DELETE CASCADE;
 +
CREATE INDEX items_1 ON items (hostid);" |mysql105 zabbixdb
 +
</syntaxhighlight>
  
You can download [http://sme.firewall-services.com/downloads/zabbix/zabbix_SME.xml.zip here] an XML export of the templates I use to monitor some servers. Just extract the archive, and import it in zabbix (using the Import/Export menu of zabbix configuration)
+
* install 5.0 using rpms<syntaxhighlight lang="bash">
It'll create some new templates in zabbix:
+
db yum_repositories setprop zabbix44 status disabled
 +
db yum_repositories setprop zabbix50 status enabled
 +
db yum_repositories setprop zabbix50-frontend status enabled
 +
expand-template /etc/yum.smerepos.d/sme-base.repo
 +
rpm -e --nodeps zabbix-web-mysql zabbix-web smeserver-zabbix-server
 +
yum install smeserver-zabbix-server-z50 --enablerepo=smecontribs,smetest,smedev
 +
</syntaxhighlight>
 +
** fix collation after install
 +
<syntaxhighlight lang="bash">
 +
echo "alter database $(config getprop zabbix-server DbName) character set utf8mb4 collate utf8mb4_bin;" |mysql105
 +
wget https://www.zabbix.com/documentation/current/assets/en/manual/appendix/install/utf8mb4_convert.sql
 +
cat utf8mb4_convert.sql |mysql105 `config getprop zabbix-server DbName`
 +
echo "SET @ZABBIX_DATABASE = '$(config getprop zabbix-server DbName)'; \
 +
set innodb_strict_mode = OFF;  \
 +
CALL zbx_convert_utf8(); \
 +
set innodb_strict_mode = ON; \
 +
drop procedure zbx_convert_utf8;"|mysql105 `config getprop zabbix-server DbName`
 +
</syntaxhighlight>
  
*Template_SME is for agents running in active mode (default of the contrib)
+
=== Migrate DB from mariadb 5.5. to mariadb 10.5 ===
*Template_SME_dynip is for agents running in passive mode (I use it to monitor SME Servers with a dynamic IP address)
+
The script will check if zabbixdb is present in mariadb 5.5. path, as long as it is it will keep using this db, even if one is present in mariadb 10.5.<syntaxhighlight lang="bash">
 +
# need testing, writing inspired from Nextcloud contrib page
 +
mysqldump `config getprop zabbix-server DbName` > zabbixdb.sql
 +
echo "CREATE DATABASE IF NOT EXISTS `config getprop zabbix-server DbName` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"| mysql105
 +
cat zabbixdb.sql |sed 's/ENGINE=MyISAM/ENGINE=InnoDB/g'|mysql105 `config getprop zabbix-server DbName`
  
If you use one of this template, it'll configure a lot of items, graphs, triggers. Of course, you'll need to adjust it to your needs.
+
echo "CREATE USER IF NOT EXISTS `config getprop zabbix-server DbUser`@localhost IDENTIFIED BY '`config getprop zabbix-server DbPassword`';"| mysql105
 +
echo "GRANT ALL PRIVILEGES ON `config getprop zabbix-server DbName`.* TO `config getprop zabbix-server DbUser`@localhost; FLUSH PRIVILEGES;" | mysql105
  
Those two templates are based on other templates you can use for other hosts (non SME):
+
echo "drop database `config getprop zabbix-server DbName`;" |mysql
*Template_all uses only icmp checks. It'll enable latency graphs and triggers if latency is too high or if the host is down
+
signal-event smeserver-zabbix-server-update
*Template_nutUPS can monitor the status of your UPS. It needs the UserParameters ups.load ups.battery.charge ups.status and ups.model which are allready configured on the agent on SME.
+
</syntaxhighlight>{{Warning box|These lines of code need to be tested first, try on a test environment and be prepared to restore a backup of your db.}}
  
 
=== Bugs ===
 
=== Bugs ===
 
Please raise bugs under the SME-Contribs section in [http://bugs.contribs.org/enter_bug.cgi bugzilla]
 
Please raise bugs under the SME-Contribs section in [http://bugs.contribs.org/enter_bug.cgi bugzilla]
and select the smeserver-zabbix component or use on of this link:
+
and select the smeserver-zabbix-server component or use {{BugzillaFileBug|product=SME%20Contribs|component=smeserver-zabbix-server|title=this link.}}
 +
Below is an overview of the current issues for this contrib:{{#bugzilla:columns=id,product,version,status,summary |sort=id|order=desc |component=smeserver-zabbix-server|noresultsmessage="No open bugs found."}}
 +
 
 +
===Changelog===
 +
Only released version in smecontrib are listed here.
 +
 
 +
{{#smechangelog: smeserver-zabbix-server }}
  
{{BugzillaFileBug|product=SME%20Contribs|component=smeserver-zabbix-server|title=server}}{{BugzillaFileBug|product=SME%20Contribs|component=smeserver-zabbix-agent|title=agent}}{{BugzillaFileBug|product=SME%20Contribs|component=smeserver-zabbix-proxy|title=proxy}}
 
  
 
----
 
----
 
[[Category:Contrib]]
 
[[Category:Contrib]]
 +
[[Category:Administration:Monitoring]]

Latest revision as of 20:54, 11 September 2023



Incomplete.png Incomplete:
This article or section needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page



Maintainer

[1]Daniel B. from Firewall Services

Description

Zabbix offers advanced monitoring, alerting and visualisation features today which are missing in other monitoring systems, even some of the best commercial ones.

Features

Here are some of the features provided by Zabbix:

  • Distributed monitoring
    • Centralized configuration
    • Centralized access to all data
    • Up-to 1000 of nodes
    • Unlimited number of proxies
  • Scalability
    • Tested with 10,000 monitored devices and servers
    • Tested with 100,000 availability and performance checks
    • Processing of thousands of availability and performance checks per second
  • Real-time monitoring
    • Performance monitoring
    • Availability monitoring
    • Integrity monitoring
    • Flexible notification conditions
    • Alerting users (Email, SMS, Jabber)
    • Logging
  • Visualisation
    • User-defined views and slide shows
    • Mapping
    • Graphing (including pie charts)
    • Zooming
  • Fast Problem Resolution
    • Send alerts via email, cell phone, SMS or audio alerts
    • Execute remote commands
  • Assuring SLA
    • Hierarchical IT Services
    • Real-time SLA reporting
  • Reporting and trending
    • Easy integration of 3rd party tools
    • Analysis of yearly/monthly/daily statistics
    • SLA reports
  • XML data import/export
    • Easy sharing of templates
  • Auto discovery
    • Discovery by IP range, services and SNMP
    • Automatic monitoring of discovered devices
  • WEB monitoring
    • WEB performance and availability monitoring
    • Flexible scenarios
    • Support of POST and GET methods
  • Flexibility
    • Support of IPv4 and IPv6
    • Easily extendable native agents
    • Any notifications methods
    • Runs on any platform
  • Pro-active monitoring
    • Automatic execution of remote commands
    • Automatic IPMI commands
  • Aggregate monitoring
    • Monitoring of a group of hosts as a single host
  • Agentless monitoring
    • Monitoring of remote services (FTP, SSH, HTTP, other)
    • Support of SNMP v1,2,3
    • Support of IPMI
    • SNMP traps
  • High performance agents
    • All platforms supported (UNIX, Windows, Novell)
    • Memory utilisation
    • Network utilisation
    • Disk I/O
    • Disk space availability
    • File checksums
    • Monitoring of log files
    • And more...
  • Security
    • Flexible user permissions
    • Authentication by IP address
    • Protection against brute force attacks
  • Escalations and notifications
    • Repeated notifications
    • Unlimited escalations
    • Recovery messages
    • Be notified while problem is not resolved
  • Management functions
    • Ping, traceroute to a host
    • Any other functions
  • Dashboard
    • Personalized dashboard
    • Favourite resources
    • High level view
  • Agent-based monitoring
    • Native agent for any platform
    • Immune to connection problems
  • Open Source Solution
    • No license driven limitations
    • Access to source code
    • Open to code audit
  • Easy Administration
    • Very fast learning curve
    • All data is stored in a database (Oracle, MySQL, PostgreSQL, SQLite)
    • Centralised configuration and storage of information
  • and more...

Full documentation

A complete documentation is available as a PDF file here. You'll also find some useful informations on the official forum.


Important.png Note:
This wiki page is not a complete guide for Zabbix, but just a starting point to run it on your SME Server using this contrib.

For a complete documentation, please refer to the project documentation: https://www.zabbix.com/documentation/current/en.


Versions

The following is the information about the latest release of each component:

Contrib 10:
Devel 9:
Contrib 9:
smeserver-zabbix-server
The latest version of smeserver-zabbix-server is available in the SME repository, click on the version number(s) for more information.


Contrib 10:
smeserver-zabbix-server-z50
The latest version of smeserver-zabbix-server-z50 is available in the SME repository, click on the version number(s) for more information.


Release name Release date End of Full Support* End of Limited Support** SME9 SME10
Zabbix 6.2 Jul 5, 2022 Jan 31, 2023 Feb 28, 2023 X X
Zabbix 6.0 LTS Feb 8, 2022 Feb 28, 2025 Feb 28, 2027 X X
Zabbix 5.0 LTS May 12, 2020 May 31, 2023 May 31, 2025 X yes
4.4 (EOL) yes yes
Zabbix 4.0 LTS October 1, 2018 October 31, 2021 October 31, 2023 yes X

Requirements

  • SME Server 7.X (9.X or higher for zabbix-server)
  • php>=5.4 for zabbix server only, hence you will need to first install smeserver-php-scl on SME9 and set php54 or higher as default php version

Components

Zabbix is composed of four major components:

  • The server (the main part). The server will store and analyse the different data, send alerts, etc...
  • The web interface (which is automatically installed with the server with this contrib).
  • The agent, which gathers informations on the different hosts you monitor.
  • The proxy, which is an optional part, can be used to collect performance and availability data locally, and send it to the server.

Server

The server is the core component of Zabbix software. It uses one database (MySQL in this contrib) to store configuration, performance and integrity information. The server can check network services with simple check (ICMP, TCP etc...) for agent-less monitoring, it can monitor network devices using SNMP and is also the central component to which agent report information (agent can work in active, passive, or both mode). The server will also analyse all the information and send alerts depending on very flexible triggers.

Installation

to install zabbix 4.4

yum install smeserver-extrarepositories-zabbix -y
db yum_repositories setprop zabbix44 status enabled
signal-event yum-modify
yum install smeserver-zabbix-server --enablerepo=smecontribs


the following version are available : zabbix42 zabbix44 zabbix45 zabbix50 zabbix51 zabbix52 zabbix53

Zabbix is not provided as server on Rhel 7 for version 5.1 and up. This is because of base php version, which could be worked around using php-fpm, but would also need us to build it.

install zabbix 50 server

 yum install smeserver-extrarepositories-zabbix -y
db yum_repositories setprop zabbix50 status enabled
db yum_repositories setprop zabbix50-frontend status enabled
expand-template /etc/yum.smerepos.d/sme-base.repo
yum install smeserver-zabbix-server-z50 --enablerepo=smecontribs


First enable the needed repo: Firewall service and REMI

db yum_repositories set fws repository \
BaseURL http://repo.firewall-services.com/centos/\$releasever \
EnableGroups no GPGCheck yes \
Name "Firewall Services" \
GPGKey http://repo.firewall-services.com/RPM-GPG-KEY \
Visible no status disabled


db yum_repositories set fws-testing repository \
BaseURL http://repo.firewall-services.com/centos-testing/\$releasever \
EnableGroups no GPGCheck yes \
Name "Firewall Services Testing" \
GPGKey http://repo.firewall-services.com/RPM-GPG-KEY \
Visible no status disabled


issue the following command on the SME Server shell:

/sbin/e-smith/db yum_repositories set remi-safe repository \
Name 'Remi - safe' \
BaseURL 'http://rpms.famillecollet.com/enterprise/$releasever/safe/$basearch/' \
EnableGroups no \
GPGCheck yes \
GPGKey http://rpms.famillecollet.com/RPM-GPG-KEY-remi \
Visible yes \
status enabled


signal-event yum-modify

to install Zabbix server, just use yum:

yum --enablerepo=smecontribs,fws,remi-safe install smeserver-zabbix-server --exclude=smeserver-zabbix-proxy

NB: the --exclude=smeserver-zabbix-proxy is due to a conflict in late 2019 on SME9 as FWS started using zabbix from zabbix repo instead of building it.

Then go to your server-manager to set php5.4 or higher as default php for your SME, or you will not be able to access to zabbix web gui, or just issue the following

config setprop php54 PhpModule enabled   #replace here with php55 or php56 if you have other needs
signal-event php-update

then you will have to either tweak the default configuration as explain in next step or just issue :

signal-event zabbix-server-update

then go to your web interface : https://yourserveradress/zabbix

DB Parameters

Here's the list of available DB parameters for zabbix-server service on SME:

  • AdminPassword: A random password is generated during the installation for Admin user. Replace the default weak zabbix password upon install.
  • DbName: The name of the database where everything is stored. Default is 'zabbixdb'
  • DbPassword: The password of the database. A random password is generated during the installation
  • DbUser: The user name to access the database. Default is zabbixuser
  • JabberAccount: Account used to send jabber notification
  • JabberServer: Jabber server to use to send notifications
  • JabberPassword: Password for the account (for "JabberAccount")
  • JabberTLS: (enabled|disabled) Does your Jabber server requires TLS security
Important.png Note:
The different Jabber settings above are not for the built-in jabber notification function (because I couldn't get it working as my server requires TLS and the built-in features do not support it). But I've included a external script using sendxmpp to send the notification. You should have a media called 'xmpp' in zabbix administration.


  • NodeID: The node ID of your server. If you don't use distributed monitoring (just one central Zabbix server), you should let this to 0
  • TCPPort: Port used for agent<->server (and proxy<->server) communication. The default is 10051
  • TimeZone: It's very important for zabbix to know your time zone (PHP TimeZone setting). Unfortunately, SME do not set it. You can specify your time zone. This setting will only affect Zabbix
  • WebAccess: (local|public|disabled) From where you'll be able to access the web interface. You can set it to disabled if you want to disable the web interface (for example, if your server is a node of a distributed environment)
  • access: (public|local) From where zabbix port will be available (controlled by TCPPort). You should restrict the access to a list of host with the AllowHosts key if you set public here.
  • status: Should the service be started automatically ?


Once you have everything configured like you want, just issue

signal-event zabbix-server-update

to expand the templates and restart the needed services.

Web Interface

The main web interface is available (if not disabled with the key WebAccess) on https://server.domain.tld/zabbix.

The default user is Admin (with uppercase A as first letter), with strong password found in the config property AdminPasswd starting smeserver-zabbix-server 0.1-29. If you change it, it will not be overwritten on update. ( prior that the default was zabbix, in this case you should change this password ASAP)

config getprop zabbix-server AdminPassword

Here are some screenshots of what you can get with zabbix

CPU Usage Graph
Memory Usage Graph
Network Usage Graph
Important.png Note:
You can select a period on any graph. With this great feature, you can easily zoom on a period of time to analyse things with hight precision


Incoming mails statistics
Screen
Important.png Note:
You can display as many graphs as you want in one screen, automatically refresh it, change it (display network graphs of hosts 1 during 2minutes, then display hardware graphs of hosts2 for 3 minutes etc...)


Triggers overview
Hosts Map
Important.png Note:
this is a very simple map, you can make it look nicer



For more screenshots, visit the project website here

Agent

see Zabbix-agent

Proxy

see Zabbix-proxy

Monitoring SME servers

If you want to monitor SME Servers with zabbix, you'll first need to install the agent as explained earlier, then configure the agent to accept connection from your server. For example, to monitor you local server (the one running zabbix-server):

db configuration setprop zabbix-agent Servers localhost active disabled passive enabled
signal-event zabbix-agent-update


Important.png Note:
After installation, the agent is configured for active checks only. Here, we disable the active checks, and enable the passive ones.


Then, just add a host in Zabbix, pointing to localhost.

Now you can start adding items (type agent (active or passive depending on the mode you use on the agent)) to this new host.

If you want to monitor SME Servers on the Internet and use passive mode, the server will initiate connections to the agent. You'll need to port-forward the port if you run in serveronly mode (the default is port 10050 TCP), or to open this port in the firewall if runing in server&gateway mode:

db configuration setprop zabbix-agent Servers w.x.y.z active disabled passive enabled access public AllowHosts w.x.y.z
signal-event zabbix-agent-update


Warning.png Warning:
If you use active checks, you need to name the host in zabbix server hostname.domainname.tld (check the file /etc/zabbix/zabbix_agentd.conf, the directive Hostname). If you don't do that, checks won't work


You can download here an archive with some XML exports of the templates I use to monitor my servers. Just extract the archive, and import the templates you want in Zabbix (using the Import/Export menu of zabbix configuration)

Each XML file represent a template in Zabbix

  • Template_SME is the main template. It'll add a lot of items for global system monitoring, triggers if load is too high, lack of free memory, httpd is down, passwd has changed etc... and also some graphs like CPU usage, memory, disk space, network usage etc... This templates requires the Template_icmp and Template_app_MySQL template
  • Template_SME_coovaChilli will add tun0 statistics (useful if you use CoovaChilli contrib). It'll also create a graph for tun0 stats
  • Template_SME_softRaid will add items and triggers for software raid monitoring. If you link a SME Server with this template, you'll be warned if one of the raid array is degraded or rebuilding
  • Template_SME_megaRaid will do the same but for MegaRaid based cards. It also requires the MegaCli utility from LSI website
  • Template_SME_nutUPS: Will add items and triggers to be warned if your UPS is on battery, or overloaded.
  • Template_icmp: will configure two items to check if the server is alive, and measure the latency. It also provides latency graphs and some triggers (if latency is too high, if host is down since more than 5min and if hosts is down for more than 1 hour)

Monitoring ressources

Upgrading 4.4 to 5.0

see this page https://www.zabbix.com/documentation/5.0/en/manual/installation/upgrade_notes_500. Mostly you will need to

  • migrate your db from mariadb 5.5 to mariadb 10.5 with its user if not already done
  • fix the row format to dynamic
    echo "USE $(config getprop zabbix-server DbName); alter table hosts row_format = dynamic; "|mysql105
    
  • fix ENGINE if forgotten before (you better doing it before importing it, converting the history table could take days (yes days not hours)
echo "SELECT CONCAT('ALTER TABLE ',TABLE_NAME,' ENGINE=InnoDB;')  FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='MyISAM' AND table_schema = 'zabbixdb';" |mysql105 -s|mysql105 zabbixdb
  • fix collation, for the issue "[Z3005] query failed: [1071] Specified key was too long; max key length is 3072 bytes [create index items_1 on items (hostid,key_(1021))]" see here.
    echo "SELECT CONCAT('ALTER TABLE ',TABLE_SCHEMA,'.',TABLE_NAME,' CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;') FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'zabbixdb';" |mysql105 -s |mysql10
    
  • fix the table with database/mysql/double.sql
    cat /usr/share/doc/zabbix-server-mysql-5.0.30/double.sql |mysql105 `config getprop zabbix-server DbName`
    
  • fix the foreign key for the issue "[Z3005] query failed: [1091] Can't DROP FOREIGN KEY `c_items_1`; check that it exists [alter table items drop foreign key c_items_1]" see here
    echo "ALTER TABLE items ADD CONSTRAINT c_items_1 FOREIGN KEY (hostid) REFERENCES hosts (hostid) ON DELETE CASCADE;
    CREATE INDEX items_1 ON items (hostid);" |mysql105 zabbixdb
    
  • install 5.0 using rpms
    db yum_repositories setprop zabbix44 status disabled
    db yum_repositories setprop zabbix50 status enabled
    db yum_repositories setprop zabbix50-frontend status enabled
    expand-template /etc/yum.smerepos.d/sme-base.repo
    rpm -e --nodeps zabbix-web-mysql zabbix-web smeserver-zabbix-server
    yum install smeserver-zabbix-server-z50 --enablerepo=smecontribs,smetest,smedev
    
    • fix collation after install
echo "alter database $(config getprop zabbix-server DbName) character set utf8mb4 collate utf8mb4_bin;" |mysql105
wget https://www.zabbix.com/documentation/current/assets/en/manual/appendix/install/utf8mb4_convert.sql
cat utf8mb4_convert.sql |mysql105 `config getprop zabbix-server DbName`
echo "SET @ZABBIX_DATABASE = '$(config getprop zabbix-server DbName)'; \
set innodb_strict_mode = OFF;  \
CALL zbx_convert_utf8(); \
set innodb_strict_mode = ON; \
drop procedure zbx_convert_utf8;"|mysql105 `config getprop zabbix-server DbName`

Migrate DB from mariadb 5.5. to mariadb 10.5

The script will check if zabbixdb is present in mariadb 5.5. path, as long as it is it will keep using this db, even if one is present in mariadb 10.5.

# need testing, writing inspired from Nextcloud contrib page
mysqldump `config getprop zabbix-server DbName` > zabbixdb.sql
echo "CREATE DATABASE IF NOT EXISTS `config getprop zabbix-server DbName` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"| mysql105
cat zabbixdb.sql |sed 's/ENGINE=MyISAM/ENGINE=InnoDB/g'|mysql105 `config getprop zabbix-server DbName`

echo "CREATE USER IF NOT EXISTS `config getprop zabbix-server DbUser`@localhost IDENTIFIED BY '`config getprop zabbix-server DbPassword`';"| mysql105
echo "GRANT ALL PRIVILEGES ON `config getprop zabbix-server DbName`.* TO `config getprop zabbix-server DbUser`@localhost; FLUSH PRIVILEGES;" | mysql105

echo "drop database `config getprop zabbix-server DbName`;" |mysql
signal-event smeserver-zabbix-server-update
Warning.png Warning:
These lines of code need to be tested first, try on a test environment and be prepared to restore a backup of your db.


Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-zabbix-server component or use this link.

Below is an overview of the current issues for this contrib:

IDProductVersionStatusSummary (5 tasks)
12282SME Contribs10.0CONFIRMEDIncorrect default charset for Zabbix database: "utf8mb4" instead "UTF8, UTF8MB3".
12281SME Contribs10.0CONFIRMEDmisisng font firectory in php base dir
12279SME Contribs10.0CONFIRMEDmissing deps
11747SME Contribs10.0CONFIRMEDadd SME specific templates
11743SME Contribs10.0CONFIRMEDswitch or at least configure ldap auth

Changelog

Only released version in smecontrib are listed here.

smeserver-zabbix-server Changelog: SME 10 (smecontribs)

2022/12/10 Jean-Philippe Pialasse 0.1-31.sme
- original package build for Zabbix 5.0 using Remi SCLO [SME: 11748]

 support for LTS 5.0 EOL May 31, 2025
needs mariadb105.
manual migration from mariadb55 to mariadb105 needed for existing installs

2022/08/01 Jean-Philippe Pialasse 0.1-30.sme
- update to httpd 2.4 access syntax [SME: 12068]

 thanks to Vasarhelyi Zsolt

- add to core backup [SME: 12031]

 non rpm owned files in /etc/zabbix, /etc/zabbix/zabbix_agentd.conf.d/
and /var/lib/zabbix/bin/
2021/11/09 Jean-Philippe Pialasse 0.1-29.sme
- set random password to Admin i fuser exists and password is zabbix [SME: 11749]

2021/11/08 Jean-Philippe Pialasse 0.1-28.sme
- add check cert scripts and telegram [SME: 10802]

no template provided to use with
2021/11/07 Jean-Philippe Pialasse 0.1-27.sme
- fix init sql, typo and reload deamon [SME: 11232]