Professional Documents
Culture Documents
ZCS5 Day 2 Lab Manual
ZCS5 Day 2 Lab Manual
www.zabbix.com
Zabbix 5.0
Certified Specialist course
Hosts Training-VM-XX and Training Resources does not have any passive agent items, the Zabbix
passive agent availability icon is gray
Zabbix server internal items are working, they do not depend on Zabbix agent !
======================================================================================================
Package Architecture Version
======================================================================================================
Installing:
zabbix-agent x86_64 5.0.0.el8
Transaction Summary
======================================================================================================
Install 1 Package
...
Installed:
zabbix-agent-5.0.0.el8.x86_64
Complete!
You can install Zabbix agent with a simple command because Zabbix official repository was
installed on day one, when Zabbix server was installed
If you do not have official Zabbix repository installed on monitored servers, it is possible to use
rpm files to install Zabbix agent locally, but in this case, Zabbix agent will be not auto updated !
Start Zabbix-agent
systemctl start zabbix-agent
The items now shows more details, like item key and type
• Look for items which have type "Zabbix agent"
The most part of graph is empty, because it displays last hour of collected data, and we have just
started to collect some metrics a few minutes ago
ZABBIX 5.0 Lab Manual 12
CONGRATULATIONS!
Zabbix Agent installation lab is finished
LAB 6
Zabbix Agent passive checks
LAB6 - ZABBIX AGENT PASSIVE CHECKS
Go to Configuration -> Hosts
Enter Training-VM into Name field and press Apply to filter hosts
Click on Items for Training-VM-XX
The availability icon is currently gray because we do not have any Zabbix passive agent
items created on this host.
Press Test
Look at the error message - agent dropped connection because of access permissions !?
Where are these access permissions ?
ZABBIX 5.0 Lab Manual 17
LAB6 - ZABBIX AGENT PASSIVE CHECKS
Switch to SSH console and open Zabbix agent configuration file
# vi /etc/zabbix/zabbix_agentd.conf
Search for server parameter and append your DNS name (or IP address) to the Server list
### Option: Server
# List of comma delimited IP addresses or DNS names of Zabbix servers and Zabbix proxies.
# Incoming connections will be accepted only from the hosts listed here.
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
# and '::/0' will allow any IPv4 or IPv6 address.
# '0.0.0.0/0' can be used to allow any IPv4 address.
# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
Server=127.0.0.1,student-XX
remember to always check that agent started successfully after configuration changes !
The item is working now ! Press Cancel to close the test form
Press Add at the bottom of item configuration form to create the item
The availability icon is still gray, because we have just created the item. Zabbix server needs to
collect the value of the item at least one time before it detects that agent is up
You can wait for a minute and press Apply on filter section, the ZBX will turn green
This item requires network interface name, you can find interfaces with following command
# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT......
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode .......
Press Test
Something feels wrong here... It does not look like a typical network traffic graph...
Because this item is a counter, it just counts outgoing traffic bytes. To display speed per
second, we need to process the collected data on Zabbix server !
Test item form will open. The values are empty, check the Get value from host checkbox
Now in the Result field you can see the actual speed per second
Zabbix will collect 2 values, calculate the difference and divide by seconds between checks
Go back to Monitoring - > Hosts and look at Latest data for Training-VM-XX host
Now here comes another problem - the old data does not allow to see any updated traffic
data because scaling is too different
Now the item reports correct data, and the graphs look nice
Press Add
The second item is created just like the previous one, just with different name and key
Be careful when cloning, preprocessing steps are hidden under Preprocessing tab, but they are also
cloned !
Go to Monitoring -> Hosts and open Latest data for Training-VM-XX host
Select both items and press Display graph to show them on graph
Running transaction
Preparing :
Installing : zabbix-get-5.0.0-1.el8.x86_64
Verifying : zabbix-get-5.0.0-1.el8.x86_64
Installed:
zabbix-get-5.0.0-1.el8.x86_64
Zabbix-get is a standalone command-line utility, it does not require Zabbix server or agent to be
installed on the host
This utility is for troubleshooting purposes, or can be used in your scripts to collect data from
passive Zabbix agents
This utility still requires the "Server=" parameter to be correctly set in agent configuration file,
otherwise agent will refuse connection from host which executed zabbix_get command !
999542784
The reported data is a raw value in bytes just like it is specified in documentation
Use zabbix_get utility to get current swap size in percentage from local agent
# zabbix_get -s 127.0.0.1 -k system.swap.size[,pfree]
93.090031
You can get data from any remote agent if it will accept connection from your host!
ZABBIX 5.0 Lab Manual 40
LAB6 - ZABBIX AGENT PASSIVE CHECKS
You could also use Zabbix agent binary to test your items from command line
Type following command to show all available keys with values
# zabbix_agentd -p
You can test any of the item keys locally to see if they work
Why the same key is working from agent command line but not working with zabbix_get ?
To quickly select all items at once, just check the upper checkbox
You can update all items one-by-one, but mass update is more efficient way
Scroll down and press Update at the bottom of the mass update form
But wait - are the data changing ? Look at the Last check column, the time is in a past !
When working with latest data, always check that values are current !
Click on the graph for CPU load item
After you changed the item type to Zabbix agent (active) the data collection stopped
Our items are correct, because we just cloned the working ones !
It is not possible to Execute now or Test active agent type items
ServerActive=127.0.0.1
Hostname=Zabbix server
The ServerActive is 127.0.0.1, which is correct (we have Zabbix server on the same host)
The Hostname is Zabbix server !!! (it is by default when you install a new Zabbix agent)
What Hostname should be used?
ZABBIX 5.0 Lab Manual 54
ZABBIX AGENT ACTIVE CHECKS
Change the Hostname to student-XX (replace XX with your student number)
alternatively, you can just comment out this line, the system hostname will be used
Hostname=student-XX
Check zabbix agent status (always check the status after configuration changes)
# systemctl status zabbix-agent
The active checks are working now, but the availability icon stays gray for student-XX
Zabbix availability icons are displayed for Zabbix passive agent only, you do not have any passive
agent items on this host
When you are creating items and collecting data, problems are not detected. You need to
define triggers with thresholds to start getting alerts
Press Insert
Press Insert
Two test examples are provided, which one will fire the trigger ?
Entire trigger expression must become TRUE for trigger to fire !
When the tests are finished, press Cancel to close trigger test form
Press Add on trigger configuration form to create trigger
The Operational data column will be displayed, which contains last value received
The graph will display history and you will clearly see when problem started
Add two macros for CPU load (click on Add to add more macros)
• Macro: {$CPU.LOAD.WARNING} Value: 1 Description: High CPU load
• Macro: {$CPU.LOAD.HIGH} Value: 2 Description: Very high CPU load
Press Update
Press Add
Press Add
ZABBIX 5.0 Lab Manual 88
ADVANCED PROBLEM DETECTION
Two Triggers are created
Go to Monitoring -> Problems page and wait a few minutes until problem will appear
And in a few minutes a second problem with high severity will appear
If you will look at the graphs, you will see trigger lines
Press Update
Try to solve the problem by simply closing it - click on No in the Ack column, check Close
problem and press Update in the Update problem form
Closing the problem will not help, because the problem is detected again with next item
update
Press Update
All actions are logged, click on the arrow -> to see the list of actions
It is possible to create Host groups directly from Hosts or Templates configuration screen
ZABBIX 5.0 Lab Manual 100
TEMPLATES
Switch to Tags tab
• Enter Name: Environment Value: Training
• Press Add
The template is created. Enter Basic in the filter field to show our new template only
Open Configuration -> Hosts and click on Items for Training-VM-XX host
Press Copy
Repeat the same steps with Triggers (copy from Training-VM-XX host to Template Basic)
Assign Network application to network traffic items (by using mass update)
You can update items one by one by editing them directly or using mass update
Press Update
All items are the same, but now they are linked to template
It is the best practice to use templated macros and only re-define them per host if you need to
adjust some macros on this particular host level
Press Update
Press Add
You have created two more hosts. But why they are red ? You have cloned a working host...
ZABBIX 5.0 Lab Manual 115
TEMPLATES
Click on the red ZBX icon, the error will be displayed
Your neighbors are not allowing incoming connections to their agents from your host !
They must fix it by adding your DNS name to zabbix_agentd.conf
The following configuration changes needs to be done on your neighbor's machines !
# vi /etc/zabbix/zabbix_agentd.conf
Zabbix agent restart is always required after configuration file changes !!!
Click on Latest data, you will see that data are collected from the remote hosts
Uptime: 409981 Threads: 26 Questions: 5641477 Slow queries: 32 Opens: 130 Flush tables: 2 Open
tables: 156 Queries per second avg: 13.760
It is also recommended to test that Zabbix user can execute this command
# sudo -u zabbix mysqladmin -uzabbix -pP455w0RD status
Uptime: 409981 Threads: 26 Questions: 5641477 Slow queries: 32 Opens: 130 Flush tables: 2 Open
tables: 156 Queries per second avg: 13.760
From this moment all our items will be created using templates
• This is regular expression, which means search for Uptime: followed by single space \s and then
capture one or multiple digits (\d+) into first capturing group \1
Press Test
But this is not secure ! They are visible to any user with Zabbix admin access rights to this host !
Can you make this more secure ?
Press Update
413033
If you have good command line knowledge, you can use more complex commands for user
parameters, otherwise, you can use preprocessing with regex
Create user parameter
# vi /etc/zabbix/zabbix_agentd.d/userparameter_training.conf
mysql.uptime.f[zabbix,P455w0RD] [t|441258]
Use different units (unixtime) this time to show the difference how Zabbix can display the same
information using different units
Notice that username and password are specified using macros, which are protected by Zabbix
Press Test at the bottom of the page
This time use get value from host and specify host address
ZABBIX 5.0 Lab Manual 130
USER PARAMETERS
You are testing item from template, which does not have any physical IP address
It is possible to specify host from where to test the value
• Check Get value from host
• Enter Host address: student-xx Port: 10050
• Enter P455w0RD into password Macro field
• Press Get value
The value is received, which means username and password are accepted
Now press Get value and test
Zabbix 5.0
Certified Specialist course
End of Day 2