Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

||||||||||||||||||||

38 Getting Started with Zabbix and User Management

These are our user details:

Figure 1.39 – The Azure user details window


To set up SAML, retrieve your SAML settings from your AD or another SAML provider.
To work with Zabbix, we will need the following:

• IdP entity ID
• SSO service URL
• SLO service URL
• Username attribute
• SP entity ID
• SP name ID format

||||||||||||||||||||
||||||||||||||||||||

Advanced user authentication with SAML 39

How to do it…
Now that we have our Azure AD ready, let's see how we can configure SAML using
our setup:

1. In our Azure AD setup, we can find this info under Active Directory | Single
sign-on:

Figure 1.40 – The Azure SAML settings window

Technet24
||||||||||||||||||||
||||||||||||||||||||

40 Getting Started with Zabbix and User Management

2. Fill this information into your Zabbix instance as follows:

Figure 1.41 – The Zabbix SAML settings


3. After following these steps, it should now be possible to log in with your user
configured in Zabbix and use the password set in Azure AD for this:

||||||||||||||||||||
||||||||||||||||||||

Advanced user authentication with SAML 41

Figure 1.42 – The Zabbix login window

How it works…
Zabbix advanced user authentication is used to centralize password management. While
we are not able to actually assign user groups and permissions to users via this setup, we
can use it for password management.
This way, we can make sure it is easier for users to keep their passwords centralized in
medium to big office environments:

Figure 1.43 – Zabbix SAML authentication diagram


Zabbix communicates with our Azure AD SAML component when we press the
login button. The user is then authenticated against your Azure AD user and
a confirmation is sent back to the Zabbix server. Congratulations, you are now logged
in to your Zabbix server!

Technet24
||||||||||||||||||||
||||||||||||||||||||

42 Getting Started with Zabbix and User Management

There's more…
We can do this kind of authentication not only with SAML but also with HTTP and
LDAP. This way, you can choose the right form of advanced authentication for
your organization.
Check out the Zabbix documentation for more information on the different forms of
authentication: https://www.zabbix.com/documentation/current/manual/
web_interface/frontend_sections/administration/authentication.
It's also possible to work with an identity provider such as Okta, so your options aren't
limited to Azure AD. As long as it supports SAML, you can use it to authenticate against
your Zabbix server.

||||||||||||||||||||
||||||||||||||||||||

2
Setting Up Zabbix
Monitoring
Zabbix is built to be flexible and should be able to monitor just about anything you could
ever require. In this chapter, we will learn more about working with Zabbix to build a lot
of different options for monitoring. We'll go over them recipe by recipe, so you'll end up
with a solid understanding of how they work. We'll cover the following recipes on the
different monitoring types:

• Setting up Zabbix agent monitoring


• Working with SNMP monitoring
• Creating Zabbix simple checks and Zabbix trapper
• Working with calculated and dependent items
• Creating external checks
• Setting up JMX monitoring
• Setting up database monitoring
• Setting up HTTP agent monitoring
• Using Zabbix preprocessing to alter item values

Technet24
||||||||||||||||||||
||||||||||||||||||||

44 Setting Up Zabbix Monitoring

Technical requirements
We will need a Zabbix server capable of performing monitoring, with the following
requirements:

• A server with Zabbix server installed on a Linux distribution of your choice, such as
CentOS or Ubuntu, but a distribution such as Debian or anything else will suit you
just as well
• MariaDB set up to work with your Zabbix server
• NGINX or Apache set up to serve the Zabbix frontend

I'll be using the same server as we used in the previous chapter, but any Zabbix server
should do.

Setting up Zabbix agent 2 monitoring


With the release of Zabbix 5, Zabbix also officially started support for the new Zabbix
agent 2. Zabbix agent 2 brings some major improvements and is even written in another
coding language, which is Golang instead of C. In this recipe, we will be exploring how
to work with Zabbix agent 2 and explore some of the new features introduced by it.
You'll also need a Linux distribution of your choice running Zabbix agent 2.

Getting ready
To get started with Zabbix agent 2, all we need to do is install it to a (Linux) host that we
want to monitor. Make sure you have an empty Linux (CentOS 8) host ready to monitor.

How to do it
Let's see how to install Zabbix agent 2 and then move on to actually working with it.

Installing Zabbix agent 2


Let's start by installing Zabbix agent 2 on the Linux host we want to monitor. I'll be using
a CentOS 8 machine:

1. Issue the following command to add the repository:


For RHEL-based systems:
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/
x86_64/zabbix-release-5.0-1.el8.noarch.rpm

||||||||||||||||||||
||||||||||||||||||||

Setting up Zabbix agent 2 monitoring 45

For Debian-based systems:


wget https://repo.zabbix.com/zabbix/5.0/debian/pool/
main/z/zabbix-release/zabbix-release_5.0-1+buster_all.deb

dpkg -i zabbix-release_5.0-1+buster_all.deb

2. Then issue the following command to install Zabbix Agent 2:


For RHEL-based systems:
dnf -y install zabbix-agent2

For Debian-based systems:


apt install zabbix-agent2

Congratulations, Zabbix agent 2 is now installed and ready to use.

Using a Zabbix agent in Passive mode


Let's start by building a Zabbix agent with passive checks:

1. After installing Zabbix agent 2, let's open the Zabbix agent configuration file
for editing:
vim /etc/zabbix/zabbix_agent2.conf

In this file, we edit all the Zabbix agent configuration values we could need from the
server side.
2. Let's start by editing the following values:
Server=127.0.0.1
Hostname=Zabbix server

3. Change Server to the IP of the Zabbix server that will monitor this passive agent.
Change Hostname to the hostname of the monitored server.
4. Now restart the Zabbix agent 2 process:
systemctl restart zabbix-agent2.service

5. Now move to the frontend of your Zabbix server and add this host for monitoring.
6. Go to Configuration | Hosts in your Zabbix frontend and click Create host in the
top-right corner.

Technet24
||||||||||||||||||||
||||||||||||||||||||

46 Setting Up Zabbix Monitoring

7. To create this host in our Zabbix server, we need to fill in the values seen in the
following screenshot:

Figure 2.1 – The Zabbix host creation page for host lar-book-agent
It's important to add the following:

• Host name: To identify this host.


• Groups: To logically group hosts.
• Interfaces: To monitor this host on a specific interface. No interface means
no communication.

8. It is also important to add a template to this host. As this is a Linux server


monitored by a Zabbix agent, let's add the correct out-of-the-box template as shown
in the following screenshot:

Figure 2.2 – The Zabbix host template page for host lar-book-agent

||||||||||||||||||||
||||||||||||||||||||

Setting up Zabbix agent 2 monitoring 47

9. Click the Add button and you're done creating this agent host. Now that you've got
this host, make sure the ZBX icon turns green, indicating that this host is up and
being monitored with the passive Zabbix agent:

Figure 2.3 – The Zabbix configuration hosts page, host lar-book-agent


10. You can now see the values received on this host by going to Monitoring | Hosts
and checking the Latest data button. Please note that the values could take a while
to show up:

Figure 2.4 – The Zabbix latest data page for host lar-book-agent

Using a Zabbix agent in Active mode


Now let's check out how to configure the Zabbix agent with active checks. We need to
change some values on the monitored Linux server host side:

1. Start by executing the following command:


vim /etc/zabbix/zabbix_agent2.conf

Technet24
||||||||||||||||||||

You might also like