You are on page 1of 52

Install Zabbix Agent on Ubuntu 20.

04

Step 1: Enable Zabbix repository on remote host

sudo apt update

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

sudo dpkg -i zabbix-release_5.0-1+focal_all.deb

sudo apt update


Step 2: Install Zabbix agent

Once the repository is in place, install Zabbix agent.

sudo apt install zabbix-agent

sudo systemctl status zabbix-agent

Zabbix-agent listens to port 10050. You might want to confirm this using the netstat command:

sudo netstat -pnltu


Step 3: Configure Zabbix agent

sudo vim /etc/zabbix/zabbix_agentd.conf

Server=10.128.0.16

Here we are going to enable passive checks on the agent. First, locate the variable "Server" and "Hostname" in the
zabbix_agentd.conf file.
For example, My Zabbix server IP is 10.128.0.16 and the hostname (client system) is ubuntu-20.

sudo systemctl restart zabbix-agent


Step 4: Configure the firewall

sudo ufw allow 10050/tcp

sudo ufw reload

sudo ufw status


Step 5: Add host on Zabbix server

So, login in to your instance of Zabbix Server on the browser.

On the left navigation pane, Click on Configuration > Hosts

Navigate to the top-right corner and click on 'Create host'


On the window that appears, fill out the remote host details such as hostname. visible name, IP address, a brief description
and click on the 'Select' button adjacent to the 'Groups' text field.
On the list that appears , select 'Linux servers' and click on the 'Select' button.
his takes you back and you can view the newly added group as indicated.

Next, click on the 'Templates' tab and click the 'Select' button adjacent to the 'Link new Templates' text field.
Click on the 'Select' button next to the 'Host group' text field as shown.

Click on the 'Templates/Operating systems' option as shown.


Then select the 'Template OS Linux by Zabbix agent' option and click on 'Select'.

Then finally, click on the 'Add' button.


How to install zabbix agent on CentOS 8 / RHEL 8?
Step 1) Adding the Zabbix repository

$ sudo dnf install https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-agent-5.0.0-1.el8.x86_64.rpm

$ sudo dnf install -y zabbix-agent

Step 2) Configure zabbix agent

As demonstrated earlier, a few changes need to be made in the agent’s configuration which is
/etc/zabbix/zabbix_agentd.conf

Server=10.128.0.10
hostname=centos-8

$ sudo systemctl restart zabbix-agent


$ sudo systemctl status zabbix-agent
Step 3) Configure the firewall rule for zabbix-agent

$ sudo firewalld --add-port=10050/tcp --permanent


$ sudo firewalld --reload

Adding or Registering Remote Linux Host in Zabbix Server


Login to your Zabbix Server portal using admin user’s credentials .To add a host on the Zabbix server, click
on Configuration –> Hosts.
On the page that appears, fill out the remote Linux’s details as listed:

•Hostname
•Visible name
•IP address
•Description

Next, click on the ‘select’ button next to the ‘Groups’ text field. On the ‘Host groups’ list, click on
‘Linux servers’ and then click ‘Select’.
As you can see, the group has been added.

We also need to add a template for our server. So, click on the ‘Templates’ menu option.
On the ‘Templates’ list that appears, click on ‘Template OS Linux by Zabbix agent’ and hit the ‘Select’ button.
Zabbix Monitor Linux using SNMP

NTP on Ubuntu Linux

# dpkg-reconfigure tzdata

Install the Ntpdate package and set the correct date and time immediately.

# apt-get update
# apt-get install ntpdate
# ntpdate pool.ntp.br
The Ntpdate command was used to set the correct date and time using the server: pool.ntp.br

# apt-get install ntp

NTP is the service that will keep our server updated.

Use the command date to check the date and time configured on your Ubuntu Linux.

# date
SNMP Installation on Ubuntu
# apt-get update
# apt-get install snmpd snmp

Now, you should find the location of the snmpd.conf file on your system.
After finding, you need to edit the snmpd.conf file.
# updatedb
# locate snmpd.conf
# vi /etc/snmp/snmpd.conf
Here is the new file with our configuration.
rocommunity GokuBlack
syslocation Universe10 - IT Room
sysContact Zamasu <zamasu@dbsuper.com>;

# service snmpd stop


# service snmpd start
# service snmpd status

To test your SNMP configuration, use the following commands.

# snmpwalk -v2c -c GokuBlack 127.0.0.1


Zabbix Monitor Linux using SNMP
On the login screen, use the default username and default
password.

• Default Username: Admin


• Default Password: zabbix

On the dashboard screen, access the Configuration menu and select the Host option.

On the top right of the screen, click on the Create host button.

On the Host configuration screen, you will have to enter the following information:

• Host Name - Enter a Hostname to identify the Linux server.


• Visible Hostname - Repeat the hostname.
• New group - Enter a name to identify a group of similar devices.
• Agent Interface - Click on the Remove option.
• SNMP Interface - Enter the IP address of the Linux server.
Here is the original image, before our configuration. Here is the new image with our configuration.
Next, we need to configure the SNMP community that Zabbix will use to connect on the Linux computer.

Access the Macros tab on the top of the screen.

Create a macro named: {$SNMP_COMMUNITY}

The {$SNMP_COMMUNITY} macro value should be the Linux Computer SNMP community.
Next, we need to associate the host with a specific network monitor template.

By default, Zabbix comes with a large variety of monitoring templates.

Access the Templates tab on the top of the screen.

Click on the Select button and locate the template named: Template OS LINUX SNMPv2

Click on the Add button (1).


Click on the Add button (2).
After a few minutes, you will be able to see the initial result on the Zabbix Dashboard.
The final result will take at least one hour.
By default, Zabbix will wait 1 hour to discover the number of interfaces available on the Linux computer.
By default, Zabbix will wait 1 hour before collect information from the network interfaces.
In order to test your configuration, access the Monitoring menu and click on the Graphs option.
Wait 1 hour before trying to access the Linux computer graph.
SNMP Installation on Windows
First, we need to install and configure the SNMP service on Windows.
Open the Server Manager application.
Access the Manage menu and click on Add roles and features.
The SNMP feature was installed on your computer but we still need to configure the SNMP service.

Open the Windows service management screen and access the SNMP service properties.

Access the Agent tab, select all the options and enter the device contact information.
Access the Security tab and select the Accept SNMP packets from any host option.

Here is a summary of our configuration example:

The GokuBlack Community has read-only permission on the Windows server.

The contact person responsible for this Windows computer was configured as
Zamasu.

The location of the equipment was configured as the IT Room of Universe 10.

You have successfully installed the Windows SNMP service.

You have successfully configured the Windows SNMP service.

To test your SNMP configuration, use the following commands on a computer running Ubuntu Linux.
# apt-get install snmp
# snmpwalk -v2c -c GokuBlack 192.168.0.50
Zabbix Monitor Windows using SNMP

On the login screen, use the default username and default password.

• Default Username: Admin


• Default Password: zabbix

On the dashboard screen, access the Configuration menu and select the Host option.

On the top right of the screen, click on the Create host button.

On the Host configuration screen, you will have to enter the following information:

• Host Name - Enter a Hostname to identify the Windows server.


• Visible Hostname - Repeat the hostname.
• New group - Enter a name to identify a group of similar devices.
• Agent Interface - Click on the Remove option.
• SNMP Interface - Enter the IP address of the Windows server.
Here is the new image with our configuration.
Next, we need to configure the SNMP community that Zabbix will use to connect on the Windows computer.

Access the Macros tab on the top of the screen.

Create a macro named: {$SNMP_COMMUNITY}

The {$SNMP_COMMUNITY} macro value should be the Windows Computer SNMP community.
Next, we need to associate the host with a specific network monitor template.

By default, Zabbix comes with a large variety of monitoring templates.

Access the Templates tab on the top of the screen.

Click on the Add button (1).


Click on the Add button (2).
After a few minutes, you will be able to see the initial result on the Zabbix Dashboard.
The final result will take at least one hour.
By default, Zabbix will wait 1 hour to discover the number of interfaces available on the Windows computer.
By default, Zabbix will wait 1 hour before collect information from the network interfaces.
Monitor a Website

On the login screen, use the default username and default password.

• Default Username: Admin


• Default Password: zabbix
On the dashboard screen, access the Configuration menu and select the Host option.

Locate and click on the Host named: ZABBIX SERVER

On the Host properties screen, access the Applications tab.

On the top right part of the screen, click on the Create application button.
On the Host applications screen, create a new application named WEBSITE.

After finishing the Application creation, access the Web scenarios tab.

On the top right part of the screen, click on the Create web scenario button.

On the web scenario screen, you need to configure the


following items:

• Name: Enter a website identification.


• Application: Website
• Update interval: 1 Minute
• Agent: Zabbix
• Enabled: Yes
Access the Steps tab and Add new step.

You need to configure the following items:

• Name: Enter an identification.


• URL: Enter the website URL
• Follow redirects: Yes
• Require status code: 200

Click on the Add button and finish the web scenario configuration.
Wait 5 minutes.

In order to test your configuration, access the Monitoring menu and click on the Latest data option.

Use the filter configuration to select the Zabbix server host.


Use the filter configuration to select the Website application.
Click on the apply button.
You should be able to see the results of your website
monitoring using Zabbix.
Zabbix Email Notification Setup
Gmail Integration

First, we need to enable your Gmail account to receive connections from external programs.
Open your browser and access your Gmail account.
In our example, the following URL was entered in the Browser:
• http://gmail.google.com
On the login screen, enter your Gmail username and password.

After the login, you need to access the following URL:

• https://myaccount.google.com/lesssecureapps

Select the option to enable the use of less secure applications.


Now, we need to test if we can use the Linux command-line to send an email using Gmail.

Use the following command to install the required packages.


sudo apt-get update
sudo apt-get install ssmtp

Edit the SSMTP configuration file to connect to our Gmail account.

# vi /etc/ssmtp/ssmtp.conf

root=virtualcoin.videos@gmail.com
mailhub=smtp.gmail.com:465
FromLineOverride=YES
AuthUser=virtualcoin.videos@gmail.com
AuthPass=kamisama123
UseTLS=YES
In our example, we are using the Gmail account virtualcoin.videos@gmail.com.

In our example, the Gmail account virtualcoin.videos@gmail.com is using the password kamisama123.

You need to change the Gmail account and password to reflect your account.

Use the following command to send an email using the command-line.

echo "E-Mail using the command-line" | ssmtp virtualcoin.videos@gmail.com

Check your Gmail inbox for the test message that you just sent.
If the test was successful you may advance to the next section of this tutorial.

If the test was unsuccessful, the following message may be presented.

• ssmtp: Authorization failed (534 5.7.14 https://support.google.com/mail/answer/78754 v24-


v6sm2921112pfl.31 - gsmtp)

To solve this problem, you need to access the following URL .

• https://accounts.google.com/DisplayUnlockCaptcha
Select the option to unblock your account.

Try again to send the email using the command-line.

If the test was successful you may advance to the next section of this tutorial.
Zabbix Email Notification Setup

On the login screen, use the default username and default password.

• Default Username: Admin


• Default Password: zabbix

On the dashboard screen, access the Administration menu and select the Media Types option.

Locate and click on the option named Email.


On the Email properties screen, you need to enter the following configuration.

• SMTP server - Enter the E-mail server IP address or Hostname.


• SMTP server port - Enter the SMTP TCP port of the e-mail server.
• SMTP helo - Enter the domain name of your e-mail address.
• SMTP email - The e-mail address that will send Zabbix notifications.
• Connection Security - The security protocol that should be used to connect to the e-mail server.
• Authentication - The username and password of the e-mail account that will send Zabbix notifications.

Here is the original image, before our configuration.


Here is the new image with our configuration.

• SMTP server - SMTP.GMAIL.COM


• SMTP server port - 465
• SMTP helo - gmail.com
• SMTP email - virtualcoin.videos@gmail.com
• Connection Security - SSL/TLS
• Authentication Username - virtualcoin.videos@gmail.com
• Authentication Password - kamisama123

Click on the Update button.


On the dashboard screen, access the Configuration menu and select the Action option.

Locate and the option named: Report problems to Zabbix administrators

In order to enable this action, you need to click on the word Disabled in red.

It will turn on the word Enabled in green.


This will configure Zabbix to send e-mail notifications to the users that are members of the Zabbix Administrator group.
By default, only the user Admin is a member of the Zabbix administrators group.
By default, the Admin user has no e-mail address associated to the account.
Now, we need to associate an e-mail address to the Admin account.
Login on the Zabbix web interface as the Admin user.
On the top right part of the screen, access the user profile settings.

On the user profile screen, access the Media tab and add a new Email configuration.

Here is an image with our configuration.


Here is the summary of the Admin user e-mail configuration.

Testing Zabbix Notification


Now, we are going to show you how to test your trigger notification configuration.

In our example, we are going to create a fake ICMP problem.

On the dashboard screen, access the Configuration menu and select the Host option.
Access the Templates tab and add the following template.
• Template module ICMP Ping

After finishing the host configuration go back to the Zabbix dashboard initial screen and wait 5 minutes.

Wait for the ICMP problem trigger to activate.

Take a look at the email inbox of user Admin.

Check if the Zabbix server sent you an email notification


reporting this problem.
Monitoring a Cisco Switch using SNMP

Cisco Switch - SNMP Configuration

Switch> enable
Switch# configure terminal
Switch(config)# snmp-server community GokuBlack ro
Switch(config)# snmp-server contact Zamasu <zamasu@dbsuper.com>
Switch(config)# snmp-server location Universe10 - IT Room
Switch(config)# exit

Switch# copy running-config startup-config

On the Zabbix server console, use the following commands to install and test the SNMP communication.

# apt-get install snmp


# snmpwalk -v2c -c GokuBlack 192.168.0.200
Zabbix Configuration

On the login screen, use the default username and default password.

• Default Username: Admin


• Default Password: zabbix

Here is the new image with our configuration.


Next, we need to configure the SNMP community that Zabbix will use to connect on the Cisco Switch.

Access the Macros tab on the top of the screen.

Create a macro named: {$SNMP_COMMUNITY}

The {$SNMP_COMMUNITY} macro value should be the Cisco Switch SNMP community.
In our example, the {$SNMP_COMMUNITY} value is GokuBlack

Next, we need to associate the host with a specific network monitor template.

By default, Zabbix comes with a large variety of monitoring templates.

Access the Templates tab on the top of the screen.

Click on the Select button and locate the template named: Template Net Cisco IOS SNMPv2
Click on the Add button (1).

Click on the Add button (2).

After a few minutes, you will be able to see the initial result on the Zabbix Dashboard.

The final result will take at least one hour.

By default, Zabbix will wait 1 hour to discover the number of interfaces available on the switch.

By default, Zabbix will wait 1 hour before collect information from the Cisco Switch interfaces.

You might also like