Would you like to learn how to monitor a Linux computer using SNMP? In this tutorial, we are going to show you how to install SNMP on Ubuntu and how to configure the Zabbix server to monitor a Linux computer without the need to install the Zabbix agent.

Hardware List:

The following section presents the list of equipment used to create this Zabbix tutorial.

Every piece of hardware listed above can be found at Amazon website.

Zabbix Playlist:

On this page, we offer quick access to a list of videos related to Zabbix installation.

Don’t forget to subscribe to our youtube channel named FKIT.

Tutorial – NTP on Ubuntu Linux

First, we are going to configure the system to use the correct date and time using NTP.

On the Linux console, use the following commands to set the correct timezone.

# 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

Let’s install the NTP service.

# 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

If the system shown the correct date and time, this means that you followed all the steps correctly.

Tutorial – SNMP Installation on Ubuntu

Now, we need to install and configure the SNMP service on Ubuntu Linux.

On the Linux console, use the following commands to install the required packages.

# 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 original file, before our configuration and without the comments.

agentAddress udp:127.0.0.1:161
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
rocommunity public default -V systemonly
rocommunity6 public default -V systemonly
rouser authOnlyUser
sysLocation Sitting on the Dock of the Bay
sysContact Me <me@example.org>
sysServices 72
proc mountd
proc ntalkd 4
proc sendmail 10 1
disk / 10000
disk /var 5%
includeAllDisks 10%
load 12 10 5
trapsink localhost public
iquerySecName internalUser
rouser internalUser
defaultMonitors yes
linkUpDownNotifications yes
extend test1 /bin/echo Hello, world!
extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
master agentx

Here is the new file with our configuration.

rocommunity GokuBlack
syslocation Universe10 – IT Room
sysContact Zamasu <zamasu@dbsuper.com>;

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

The contact person responsible for this Linux was configured as Zamasu.

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

You should also restart SNMP manually and verify the service status.

# service snmpd stop
# service snmpd start
# service snmpd status

Here is an example of the SNMP service status output

● snmpd.service – Simple Network Management Protocol (SNMP) Daemon.
Loaded: loaded (/lib/systemd/system/snmpd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-08-07 11:15:48 -03; 9min ago
Process: 13534 ExecStartPre=/bin/mkdir -p /var/run/agentx (code=exited, status=0/SUCCESS)

You have successfully installed the Ubuntu SNMP service.

You have successfully configured the Ubuntu SNMP service.

To test your SNMP configuration, use the following commands.

# snmpwalk -v2c -c GokuBlack 127.0.0.1

Here is a small sample of the SNMPWALK output.

iso.3.6.1.2.1.1.1.0 = STRING: “Linux ubuntu18 4.15.0-29-generic #31-Ubuntu SMP 2018 x86_64”
iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.8072.3.2.10
iso.3.6.1.2.1.1.3.0 = Timeticks: (69872) 0:11:38.72
iso.3.6.1.2.1.1.4.0 = STRING: “Zamasu <zamasu@dbsuper.com>;”
iso.3.6.1.2.1.1.5.0 = STRING: “ubuntu18”
iso.3.6.1.2.1.1.6.0 = STRING: “Universe10 – IT Room”

Congratulations! you have installed the SNMP service on a computer running Ubuntu Linux.

You can now use the Zabbix server dashboard to add this computer to the network monitoring service.

Tutorial – Zabbix Monitor Linux using SNMP

Now, we need to access the Zabbix server dashboard and add the Linux computer as a Host.

Open your browser and enter the IP address of your web server plus /zabbix.

In our example, the following URL was entered in the Browser:

• http://35.162.85.57/zabbix

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

• Default Username: Admin
• Default Password: zabbix

zabbix login

After a successful login, you will be sent to the Zabbix Dashboard.

zabbix dashboard

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

zabbix add host

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

Zabbix Create Host

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.

zabbix linux - Antes

Here is the new image with our configuration.

Zabbix Linux Host SNMP

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.

Zabbix SNMP Macro Linux

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

Zabbix Linux Template SNMP

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.

Zabbix graphic

On the top right of the screen, select the group named ALL.

Select your Linux computer host name.

Select the graph named: CPU UTILIZATION

linux memory utilization

You should be able to see the graphic of Memory utilization.

Zabbix windows monitor memory

Congratulations! You have configured the Zabbix server to monitor a Linux computer using SNMP.