Professional Documents
Culture Documents
We will create a new item with the following values, and after doing, so we will click
the Add button at the bottom of the page:
Figure 2.18 – Zabbix item port 22 check configuration page for host lar-book-agent_simple
||||||||||||||||||||
||||||||||||||||||||
4. Now we should be able to see whether our server is accepting SSH connections on
port 22 on our Latest data screen. Navigate to Monitoring | Hosts and check the
Latest data screen for our new value:
Figure 2.19 – Zabbix Latest data page for host lar-book-agent_simple, item port 22 check
That's all there is to creating your simple checks in Zabbix. Now let's move on to the
Zabbix trapper item.
Creating a trapper
We can do some cool stuff with Zabbix trapper items once we get more advanced setups.
But for now, let's create an item on our lar-book-agent_simple host:
1. Go to Configuration | Hosts and click the host, then go to Items. We want to create
a new item here again by clicking the Create item button.
Technet24
||||||||||||||||||||
||||||||||||||||||||
Now let's create the following item and click the Add button:
Figure 2.20 – Zabbix item trap receiver configuration screen for host lar-book-agent_simple
2. If we go to the CLI of our monitored server, we can now execute the following to
install Zabbix sender:
sudo dnf -y install zabbix-sender
3. After installation, we can use Zabbix sender to send some information to our server:
zabbix_sender -z 10.16.16.152 -p 10051 -s "lar-book-
agent_simple" -k trap -o "Let's test this book trapper"
||||||||||||||||||||
||||||||||||||||||||
Now we should be able to see whether our monitored host has sent out the Zabbix
trap and the Zabbix server has received this trap for processing.
4. Navigate to Monitoring | Hosts and check the Latest data screen for our new value:
Figure 2.21 – Zabbix Latest data page for host lar-book-agent_simple, item trap receiver
There it is, our Zabbix trap in our Zabbix frontend.
How it works…
Now that we have built our new items, let's see how they work by diving into the
theoretical side of Zabbix simple checks and trappers.
Simple checks
Zabbix simple checks are basically a list of built-in checks made for monitoring certain
values. There is a list and description available on the Zabbix documentation wiki:
https://www.zabbix.com/documentation/current/manual/config/
items/itemtypes/simple_checks.
All of these checks are performed by the Zabbix server to collect data from a monitored
host. For example, when we do the Zabbix simple check to check whether a port is open,
our Zabbix server requests simply checks whether it can reach that port.
This means that if your monitored host's firewall is blocking port 22 from Zabbix server,
we'll get a service is down value. However, this does not mean that SSH isn't running on
the server itself:
Technet24
||||||||||||||||||||
||||||||||||||||||||
Tip
Keep in mind that working with simple checks is dependent on external factors
such as the firewall settings on the monitored host. When you build a custom
simple check, make sure to check these factors as well.
Trappers
When working with Zabbix sender, we are doing exactly the opposite of most checks.
We are building an item on our Zabbix server, which allows us to capture trap items.
This allows us to build some custom checks to send data to our Zabbix server from a
monitored host:
Getting ready
To work with calculated items and dependent items, we are going to need the Zabbix
server and monitored hosts from the previous recipes. We will add the items on the
lar-book-agent_passive host and our Zabbix server host, so we already have some items
available to calculate and make dependent.
How to do it…
Let's see how we can extend our items by getting started with the calculated items.
||||||||||||||||||||
||||||||||||||||||||
Technet24
||||||||||||||||||||
||||||||||||||||||||
4. Now if we go to check our Monitoring | Hosts page and select Latest data, we can
check out our value. Make sure to filter in the Name field for memory, so we see the
correct values:
Figure 2.26 – Zabbix Latest data page for host lar-book-agent_passive, memory items
Now we can clearly see that we are calculating the 15-minute average of the memory
utilization on our newly created item.
1. Let's start by creating the main check. Navigate to Configuration | Hosts, select our
host, and then let's click the Create item button to start creating our first new item.
We want an item with the following variables:
||||||||||||||||||||
||||||||||||||||||||
Tip
SSH checks can be used for a variety of cool scenarios, such as this one. We
simply log in to our CLI and execute a piece of code. Perfect for your custom
setups.
2. Go to Monitoring | Hosts and check out the Latest data page for our new check.
There should be a long list of MariaDB values. If so, we can continue with our next
step of creating the dependent item.
Technet24
||||||||||||||||||||
||||||||||||||||||||
3. To create the dependent item, navigate to Configuration | Hosts, select our host,
and let's click the Create item button. We want this item to get the following
variables:
||||||||||||||||||||
||||||||||||||||||||
How it works…
The types we've discussed in this How to do it… section can be quite complicated; let's go
over how the items actually work.
Calculated items
Working with calculated items can be a great way to get even more statistics out of your
existing data. Sometimes you just need to combine multiple items into one specific value.
What we did just now works by taking several values in a period of 15 minutes of 1 item
and calculating the average like this:
Dependent items
Dependent items work simply by taking the data from a master item and processing that
data into other data. This way, we can structure our data and keep our check interval for
all these items the same:
Technet24
||||||||||||||||||||