0% found this document useful (0 votes)
32 views12 pages

Monitoring Linux Using SNMP 2024

Uploaded by

byron7cueva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views12 pages

Monitoring Linux Using SNMP 2024

Uploaded by

byron7cueva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

Monitoring Linux using SNMP in Nagios XI 2024

Install SNMP On The Remote Linux Machine


Before you can monitor a Linux machine using SNMP, you'll need to install and configure the
necessary. First, you'll need to install the net-snmp package on the Linux machine. Login to
the Linux machine as the root user to complete the next steps.
On RHEL / CentOS systems use the following command:

yum install net-snmp

On Debian / Ubuntu based systems use the following command:

sudo apt-get install snmpd libsnmp-dev

Configure SNMP Access On The Remote Linux Machine


Now you must configure access permissions for SNMP on the Linux machine. This
guide will focus on SNMP v2c and SNMP v3.
l SNMP v2c
l Access is granted using a permission, community string and address
l This documentation will use the following values:
l Permission: rocommunity
l Community String: Str0ngC0mmunity
l Address: 10.25.5.12
l This address is the Nagios XI server address

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 1
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

l SNMP v3
l Access is granted with a username, permission, security level, authen-
tication and privacy pass-phrases
l More complicated but also more secure
l This documentation will use the following values:
l Username: nagios
l Permission: rouser
l Security Level: authPriv
l Authentication Protocol: SHA
l Authentication Pass-phrase: Str0ng@uth3ntic@ti0n
l Privacy Protocol: AES
l Privacy Pass-phrase: Str0ngPriv@cy
SNMP v2c

Using the values defined earlier, the following line will be added to the /etc/s-
nmp/snmpd.conf file:

rocommunity Str0ngC0mmunity 10.25.5.12

The following commands will create a backup of the original file and create a new con-
fig file with that line.
On RHEL / CentOS / Oracle Linux systems execute the following commands:

cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.bak

echo 'rocommunity Str0ngC0mmunity 10.25.5.12' > /etc/snmp/snmpd.conf

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 2
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

On Debian / Ubuntu systems execute the following commands:

sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.bak

sudo sh -c "echo 'rocommunity Str0ngC0mmunity 10.25.5.12' > /etc/s-


nmp/snmpd.conf"

Now restart the snmpd service using one of the following commands.
On RHEL / CentOS / Oracle Linux systems execute the following commands:

systemctl restart snmpd.service

On Debian and Ubuntu systems execute the following commands:

sudo systemctl restart snmpd.service

SNMP v3

Using the values defined earlier, the following command will create the SNMP v3 user
and be added to the /etc/snmp/snmpd.conf file AND the /var/lib/net-snmp/snmpd.conf
file. The following commands will create a backup of the original files, create a new
config file with that line, add the SNMP v3 user and then restart the service.
On RHEL / CentOS / Oracle Linux systems execute the following commands:

cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.bak

systemctl stop snmpd.service

echo '' > /etc/snmp/snmpd.conf

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 3
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

net-snmp-create-v3-user -ro -a SHA -A Str0ng@uth3ntic@ti0n -x AES -X


Str0ngPriv@cy nagios

sudo systemctl start snmpd.service

On Debian and Ubuntu systems execute the following commands:

sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.bak

sudo systemctl stop snmpd.service

sudo sh -c "echo '' > /etc/snmp/snmpd.conf"

sudo net-snmp-create-v3-user -ro -a SHA -A Str0ng@uth3ntic@ti0n -x AES


-X Str0ngPriv@cy nagios

sudo systemctl start snmpd.service

Configure Inbound Firewall Rules On The Remote Linux Machine

If you have the operating system firewall enabled you'll need to allow UDP port 161
inbound. The commands for this vary depending on your operating system.
On RHEL / CentOS / Oracle Linux systems execute the following commands:

firewall-cmd --zone=public --add-port=161/udp

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 4
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

firewall-cmd --zone=public --add-port=161/udp --permanent

On Ubuntu systems execute the following commands:

sudo ufw allow snmp

sudo ufw reload

On Debian systems execute the following commands:

iptables -I INPUT -p udp --destination-port 161 -j ACCEPT

apt-get install iptables-persistent

Answer yes to saving existing rules.

On some systems you may need to add the address of your Nagios
server to the allowed hosts file /etc/hosts.allow.

Configure The SNMP Daemon To Start On Boot

Configure the SNMP daemon to automatically start when the Linux machine reboots.
On RHEL / CentOS / Oracle Linux systems execute the following commands:

systemctl enable snmpd.service

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 5
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

On Debian and Ubuntu systems execute the following commands:

sudo systemctl enable snmpd.service

Testing SNMP Communication


Before you continue, you'll need to make sure that the Nagios XI server can com-
municate with the remote Linux server using SNMP.

To do this, establish a terminal session to your Nagios XI server and execute the fol-
lowing commands to run a test query. The examples here are targeting the Linux
server 10.25.13.38 and they are using the values defined above:

cd /usr/local/nagios/libexec

SNMP v2c

./check_snmp_storage.pl -H 10.25.13.37 -C Str0ngC0mmunity -m "^/$" -w


2 -c 4

SNMP v3

./check_snmp_storage.pl -H 10.25.13.37 -l nagios -x


Str0ng@uth3ntic@ti0n -X Str0ngPriv@cy -L SHA,AES -m "^/$" -w 2 -c 4

This check should return disk usage information from the remote Linux server, some-
thing like:

/: 11%used(1550MB/13892MB) (>4%) : CRITICAL

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 6
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

If the command doesn't return data, it likely means that SNMP is not configured prop-
erly, or that a firewall issue exists on the remote server. In that case, go through the
steps in the previous section to ensure everything is configured properly.

Using The Linux SNMP Wizard


1. To begin using the Linux SNMP wizard navigate via the top menu bar to Configure
> Run a configuring wizard, and select the Linux SNMP wizard. In the following
screenshot you can see how the search field allows you to quickly find a wizard.

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 7
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

2. On Step 1 you will be asked to supply the address of the server you will monitor via
SNMP.

3. You will also have to provide the appropriate SNMP Settings.

This screenshot shows SNMP v2c settings.

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 8
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

This screenshot shows SNMP v3 settings.

4. Click Next to progress to step 2.

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 9
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

5. When you proceed to Step 2, the wizard will perform an SNMP query against the
Linux server to get a list of the available disks and processes.

6. Select the server metrics you wish to monitor and adjust the thresholds as
required.

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 10
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

7. With the Disk Usage checks, double click a disk in the Scanned Disk List to add it
to the Drive field. Adjust the thresholds as required.

8. With the Processes checks, double click a process in the Scanned Process List to
add it to the Linux Process field. Adjust the thresholds as required.

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 11
erty of their respective owner.
The Industry Standard In Infrastructure Monitoring

Monitoring Linux using SNMP in Nagios XI 2024

9. When you enter one number in each of the Warning and Critical fields, a
WARNING alert will be generated when the amount of processes is below the number
specified in the Warning field. A CRITICAL alert will be generated when the number
of processes is equal to or below the number specified in the Critical field.

When you enter two numbers (delimited by a comma), you are specifying a range
that is acceptable for the number of processes to be running. In the instance of the
sshd in the example screenshot, a WARNING alert will be generated if there are (1 or
less) or (3 or more) instances of sshd running. A CRITICAL alert will be generated if
if there is (1 or less) or (4 or more) instances running.

10. Once you've finished selecting all the items you wish to monitor click Next and
then complete the wizard by choosing the required options in Step 3 - Step 5.

11. To finish up, click on Finish in the final step of the wizard. This will create the new
hosts and services and begin monitoring. Once the wizard applies the configuration,
click the View status details for xxxxx link to see the new host and services that were
created.

More Information:
Using Configuration Wizards

© 2024 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks,

www.nagios.com
trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the prop- Page: 12
erty of their respective owner.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy