How To Install and Use SNMP On Linux Tutorial with Examples?
Today we will look SNMP in Linux operating systems. Simple network management protocol named snmp is designed for getting info and setting configuration in it entities. These entities may be switch, router, pc, cabinet, printer etc. Snmp was very popular in 2000s. today it is popular too but used for information gathering. Especially monitoring which will be examined later is made today with snmp. Snmp has an index database which named Management Information Base (MIB) used for data classification. Vendors generally publish their MIBs. For example Cisco MIB can be found http://www.cisco.com/public/sw-center/netmgmt/cmtk/mibs.shtml . The system that gathers snmp info generally named Network management station. The systems that provides info or apply settings about yourself named Managed device. Agent is a tool that runs on Managed Device and responsible for snmp. Snmp works with udp, ip, tcp, unix, udp6, tcp6. Lets start typing command
Install SNMP Packages
Fedora, CentOS, RedHat
$ sudo yum install net-snmp-utils.x86_64 net-snmp.x86_64
Ubuntu, Debian, Mint, Kali
Firstly we install snmp daemon, library and tool with this command in fedora. Also we can install it Debian based distributions like Ubuntu from official repositories.
$ sudo apt install snmpd
Start SNMP Service
After installing check the status of snmp service named snmpd. As it shown it is not started so we start it and check again the status
$ sudo systemctl start snmpd
Check SNMP Service
We can check the SNMP daemon or service status with the following command.
$ sudo systemctl status snmpd
SNMP daemon configuration file is stored under
/etc/snmp with the name
$ vim /etc/snmp/snmpd.conf
Change Public Community String
We change the public community string with
ismailbaydan in this line
com2sec notConfigUser default ismailbaydan
Restart Service To Reload New Confguration
Restart the service for the changes effects configuration.
$ sudo systemctl restart snmpd
Here we run snmpwalk for system ouid with new password and snmp community version 2. So we getll all value in the system ouid and in its sub branches.
$ snmpwalk -v2c -c ismailbaydan localhost system