fbpx
  • Win a Fitbit Inspire HR when you move your hosting to us. Competition ends 30 November 2019

How to set up SNMP for CentOS

Background

This guide explains how to install SNMP on CentOS.

Procedure

Install the libraries:

yum install net-snmp

By default the service won’t be started. You can check it and then start it:

service snmpd status
service snmpd start

The baseline smtpd.conf has too much information. You probably only want to read the public community and not the entire manual so let’s backup the config file and do a one liner:

mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.backup
vi /etc/snmp/snmpd.conf

Add just this line:

rocommunity secret_password

Restart the service:

service snmpd restart

Checking the Service

The snmpwalk utility can be used to see if the SNMP service is operational.

Often systems are checked from remote locations, which is also a good way to see if the firewall access is correct.

Here is an example test:

snmpwalk -c secret_password -v1 www.hostname.com

Firewall Considerations

SNMP uses UDP port 161 so make sure this is open on your firewall.

WHM/cPanel CSF

If you’re using WHM/cPanel, add the remote IP address of your testing server like below:

csf -a 1.2.3.4

Automatic Restart after Server Reboot

SNMP has a habit of not starting up after a server is shutdown. Avoid that by doing the command below:

chkconfig snmpd on

The output of chkconfigshould be:

Created symlink from /etc/systemd/system/multi-user.target.wants/snmpd.service to /usr/lib/systemd/system/snmpd.service.

Reference

https://support.managed.com/kb/a2390/how-to-install-snmp-and-configure-the-community-string-for-centos.aspx

How To Install and Configure SNMP on CentOS

How to get SNMP daemon working on Ubuntu 18.04 LTS

Additional Information

This article was updated to remove the reference to net-snmp-utils as it’s not needed for a baseline install.

Share this article

Share on facebook
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top