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 if the package is already installed, to check package installation status, run the command;
rpm -qa | grep net-snmp net-snmp-utils
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
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 .126.96.36.199.2.1.1 view systemview included .188.8.131.52.184.108.40.206.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
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 Configuration – List
After reloading firewall daemon, list the current rules set.
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:220.127.116.11 -q -c:public