Red hat linux

How To Install and Configure SNMP on RHEL 7 or CentOS 7

SNMP stands for “Simple Network Management Protocol”, it can be utilized to monitor any devices that support snmp, few of the devices are server, router, network printers, firewalls. SNMP can monitor a variety of parameters for these devices such as server performance, network usage, disk utilization.

Check Package
Check if the package is already installed, to check package installation status, run the command;

rpm -qa | grep net-snmp net-snmp-utils

Install Package
After checking the package installation status, if the package is not installed. Install the package to install run the command;

yum install net-snmp net-snmp-utils -y

Verify Installation
After installing the net-snmp packages verify if the package is installed, to check package installation status, run the command;

rpm -qa | grep net-snmp*

SNMP – Configuration File
Default configuration file that is configured as per the below. To display current configuration without comments and lines non-blank lines, run command;

grep -v "^$" /etc/snmp/snmpd.conf | grep -v '^ *#'
Default Configuration File – Snippet
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes

Firewall Configuration
SNMP protocol works on UDP port “161” and this port needs to be opened in order to listen and scan the report from remote servers and for latest version of snmp service supports running on TCP port which is again on “161”.
Firewall Configuration – Open UDP Port
After installing and checking the default configuration, the next step that needs to be done is to open firewall port, snmp protocol run on UDP port 161.

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

Firewall Configuration – Reload
Reload the firewall configuration.

firewall-cmd --reload

Firewall Configuration – List
After reloading firewall daemon, list the current rules set.

firewall-cmd --list-alll

snmpwalk – localhost Query
After configuring the firewall, you can go ahead and test the snmp query data on the localhost it should be able to retrieve the OID values when you run. To retrieve the information run the command;

snmpwalk -v 1 -c public -O e 127.0.0.1

snmpwalk – Remote Query
To query from a remote client to retrieve the OID values when you run. To retrieve the information run the command; in this case we are querying from a windows machine.

snmpwalk -r:54.165.245.172 -q -c:public

Leave a Reply

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