Monitoring Linux Using SNMP 2024
Monitoring Linux Using SNMP 2024
© 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
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:
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
© 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
Now restart the snmpd service using one of the following commands.
On RHEL / CentOS / Oracle Linux systems execute the following commands:
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
© 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
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:
© 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
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 automatically start when the Linux machine reboots.
On RHEL / CentOS / Oracle Linux systems execute the following commands:
© 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
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
SNMP v3
This check should return disk usage information from the remote Linux server, some-
thing like:
© 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
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.
© 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
2. On Step 1 you will be asked to supply the address of the server you will monitor via
SNMP.
© 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
© 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
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
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
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.