Simple Network Management Protocol (SNMP

)
What is net-snmp ? Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment (eg. routers), computer equipment and even devices like UPSs. Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6. Servidor SNMP: aptitude install snmpd Cliente SNMP:
aptitude install snmp scli tkmib

The snmpget command can be used to retrieve data from a remote host given its host name, authentication information and an OID. As a simple example:
% snmpget -v 1 -c demopublic test.net-snmp.org system.sysUpTime.0 system.sysUpTime.0 = Timeticks: (586731977) 67 days, 21:48:39.77

In the above example, test.net-snmp.org is the host name we wanted to talk to, using the SNMP community string demopublic and we requested the value of the OID system.sysUpTime.0. Earlier versions of the ucd-snmp utilities used SNMPv1 by default and expected the community name to follow the host name. The net-snmp versions of these tools now typically use SNMPv3 by default, and require both the version and the community string to be given as command line options (as illustrated in these examples). SNMPv2c, which is similar in nature to SNMPv1 with small modifications, still used clear-text community names as "passwords" to authenticate the issuer of the command. The result from a command using the SNMPv2c version would have been the same:
% snmpget -v 2c -c demopublic test.net-snmp.org system.sysUpTime.0 system.sysUpTime.0 = Timeticks: (586752671) 67 days, 21:52:06.71

All of the utilities allow abbreviation of the OIDs and do random searches by default, and hence you can only specify a small portion of the oid if you would prefer:
% snmpget -v 2c -c demopublic test.net-snmp.org sysUpTime.0 system.sysUpTime.0 = Timeticks: (586752671) 67 days, 21:52:06.71

A common mistake when using the snmpget command is to leave off the index into the data you're looking for. In the above commands, the variable requested by the OID is a scalar and the index to scalars is always a simple '0' (zero), hence the trailing '.0' in all the oids above. If you had left it off, you would have gotten an error. Note that the errrors differ slightly between SNMPv1 and SNMPv2c:

0 ucdDemoUserList.ucdDemoUserList.net-snmp.org/download.net-snmp.conf /etc/snmp/snmpd.conf file for our configuration.configuration file for the Net-SNMP trap daemon.sysUpTime % snmpget -v 2c -c demopublic test. snmpd.ucdavis. /etc/snmp/snmptrapd. 22:17:12. This name doesn't exist: system.conf .orig .43 enterprises.0 system.% snmpget -v 1 -c demopublic test.ucdDemoPublic.sysUpTime = No Such Instance currently exists Multiple variables can be retrieved in one transaction as well: % snmpget -v 2c -c demopublic test.html Net-SNMP Documentation http://www.0 = Timeticks: (586903243) 67 days.sysUpTime. If you want to see the default snmpd.conf snmptrapd.net-snmp.net-snmp.html Installing SNMP Server in Debian If you want to install snmp server in debian you need to install snmpd package using the following command #apt-get install snmpd This will complete the installation process. Now we need to concentrate on snmpd.org sysUpTime Error in packet Reason: (noSuchName) There is no such variable name in this MIB.0 = " noAuthUser MD5User MD5DESUser SHAUser SHADESUser" Net-SNMP Tutorials http://www.org/docs/readmefiles.conf file take a copy of original file using the following command #cp /etc/snmp/snmpd.net-snmp.conf file.ucdDemoMIB.org/tutorial/tutorial-5/ Download Net-SNMP http://www.org sysUpTime system.conf .org sysUpTime.conf /etc/snmp/snmpd.ucdDemoMIBObjects.net-snmp.conf. Configuring SNMP Server in Debian Default Configuration files are located at /etc/snmp directory this contains the following files.configuration file for the Net-SNMP SNMP agent. Before doing any changes to your /etc/snmp/snmpd.

Second Step #### # Second.org.1 80 view system included .0 /24 public #com2sec readwrite default private you can define the source whichever way you want like only allow from local machine for that you need to add 127.iso. create a view for us to let the groups have rights to: # incl/excl subtree mask view all included . first step # sec.0.1 under source and you can define your community in this case we are using public as our community.name group MyROSystem v1 paranoid group MyROSystem v2c paranoid group MyROSystem usm paranoid group MyROGroup v1 readonly group MyROGroup v2c readonly group MyROGroup usm readonly group MyRWGroup v1 readwrite group MyRWGroup v2c readwrite group MyRWGroup usm readwrite to group group group group group group group group group MyROSystem v1 local MyROSystem v2c local MyROSystem usm local MyROGroup v1 localnet MyROGroup v2c localnet MyROGroup usm localnet MyRWGroup v1 local MyRWGroup v2c local MyRWGroup usm local Third Step #### # Third.conf change the following Configuration and save the file.Set up the snmp server to allow read access from the other machines in your network for this you need to open the file /etc/snmp/snmpd.dod.model sec.0.internet.mgmt.168.name source community com2sec paranoid default public #com2sec readonly default public #com2sec readwrite default private to #com2sec paranoid default public com2sec local localhost public com2sec localNet 192. map the security names into group names: # sec.mib-2.system Don't chnage anything here leave this one as default setting .0.

conf man page If you want to monitor your server or desktop machine resources like disk capacity.00 SNMPv2-MIB::sysORID. Testing your Configuration #snmpwalk localhost -c public -v1 SNMPv2-MIB::sysDescr.0 = STRING: Linux sritest 2.9 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance If you want more options and how to use snmpd.5 = OID: UDP-MIB::udpMIB SNMPv2-MIB::sysORID.uk SNMPv2-MIB::sysName.level match read write notif access MyROSystem "" any noauth exact system none none access MyROGroup "" any noauth exact all none none access MyRWGroup "" any noauth exact all all none Don't chnage anything here leave this one as default setting.Final Step #### # Finally.7 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.local. Optional Configuration # System contact information syslocation Unknown (configure /etc/snmp/snmpd.model sec.27-2-386 #1 Wed Aug 17 09:33:35 UTC 2005 i686 SNMPv2-MIB::sysObjectID.0 = Timeticks: (656698) 1:49:26.conf) to syslocation MainDatacenter syscontact webmaster@debianhelp.8 = OID: SNMP-MPD-MIB::snmpMPDCompliance SNMPv2-MIB::sysORID.0 = STRING: webmaster@debianhelp.10 SNMPv2-MIB::sysUpTime.local.d/snmpd restart Now the SNMP server configuration is active and running.process check here .168.6 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup SNMPv2-MIB::sysORID.uk Now the above configuration able to access local and 192.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.3 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID. Now you need to restart the snmp services using the following command #/etc/init.1 = OID: IF-MIB::ifMIB SNMPv2-MIB::sysORID.conf) syscontact Root <root@localhost> (configure /etc/snmp/snmpd.98 SNMPv2-MIB::sysContact.load. grant the 2 groups access to the 1 view with different # write permissions: # context sec.4 = OID: IP-MIB::ip SNMPv2-MIB::sysORID.0 = Timeticks: (0) 0:00:00.co.2 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.4.0 = STRING: debiantest SNMPv2-MIB::sysLocation.0 /24 network machines to use full functionality of MIB's this is very important if you want to collect the information from existing machines in above network.co.0.conf file you need to check snmpd.0 = STRING: Maindatacenter SNMPv2-MIB::sysORLastChange.

0 = STRING: debiantest SNMPv2-MIB::sysLocation.2 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.3 = STRING: The MIB module for managing TCP implementations SNMPv2-MIB::sysORDescr.9 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance SNMPv2-MIB::sysORDescr.Edit the /etc/snmp/snmp.00 SNMPv2-MIB::sysORID.4 = OID: IP-MIB::ip SNMPv2-MIB::sysORID. #scli localhost .uk SNMPv2-MIB::sysName. you can use scli.4 = STRING: The MIB module for managing IP and ICMP implementations SNMPv2-MIB::sysORDescr.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.SNMP Client installation in debian Now we have seen how to configure SNMP server in above section now we need to install client in other machines for this you need to install snmp or scli packages #apt-get install snmp scli tkmib This will complete the snmp client installation.d/snmp restart Testing your Configuration #snmpwalk -v 2c -c public remotemachineipaddress system SNMPv2-MIB::sysDescr.0 = Timeticks: (0) 0:00:00.27-2-386 #1 Wed Aug 17 09:33:35 UTC 2005 i686 SNMPv2-MIB::sysObjectID.3 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID.2 = STRING: The MIB module for SNMPv2 entities SNMPv2-MIB::sysORDescr.71 SNMPv2-MIB::sysContact.0 = STRING: maindatacenter SNMPv2-MIB::sysORLastChange.6 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup SNMPv2-MIB::sysORID. Configuration The system wide configuration file is /etc/snmp/snmp.1 = OID: IF-MIB::ifMIB SNMPv2-MIB::sysORID.conf check the community name is same as server if not you need to change the community name and you need to restart the snmp service.0 = Timeticks: (168871) 0:28:08.0 = STRING: Linux sritest 2.0 = STRING: webmaster@debianhelp.5 = STRING: The MIB module for managing UDP implementations SNMPv2-MIB::sysORDescr.5 = OID: UDP-MIB::udpMIB SNMPv2-MIB::sysORID.conf file and change the following settings and save the file com2sec paranoid default public #com2sec readonly default public #com2sec readwrite default private to: #com2sec paranoid default public com2sec readonly 127.7 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.1 = STRING: The MIB module to describe generic objects for network interface sub-layers SNMPv2-MIB::sysORDescr.co.0.8 = OID: SNMP-MPD-MIB::snmpMPDCompliance SNMPv2-MIB::sysORID.0. Alternately.4.1 public #com2sec readwrite default private Now you need to restart the snmp service using the following command #/etc/init.6 = STRING: View-based Access Control Model for SNMP.10 SNMPv2-MIB::sysUpTime.

This will confirm the SNMP service is active and working properly. .and then type in show or monitor.