Tut:snmpwalk

Содержание:

Specifying a MIB object

The examples above identified a particular object, either by providing the full list of MIB subidentifiers (numeric, textual or a mixture), or by specifying the relevant MIB module containing the desired MIB object.
However MIB objects are guaranteed to be unique within IETF standard MIBs (and are rarely duplicated across vendor-supplied MIBs either). So it would usually be sufficient to simply give the bare MIB object name, with no further qualifications. Snmptranslate uses the -IR flag to do this «random-access» lookup:

   % snmptranslate sysUpTime.0
   Invalid object identifier: sysUpTime.0
   % snmptranslate -IR sysUpTime.0
   SNMPv2-MIB::sysUpTime.0

(The other commands do this by default — only snmptranslate needs it to be explicitly turned on).

It’s even possible to provide a regex pattern, and have snmptranslate (or the other command-line tools) do a «best-match» search to find the appropriate MIB object. This uses the -Ib flag:

   % snmptranslate -Ib 'sys.*ime'
   system.sysUpTime

However these approaches do run the risk (however slight) of selecting the wrong MIB object. It’s safest to use one of the earlier forms.

To get a list of all the nodes that match a given pattern, use the -TB flag:

   % snmptranslate -TB 'sys.*ime'
   SNMPv2-MIB::sysORUpTime
   SNMPv2-MIB::sysUpTime
   HOST-RESOURCES-MIB::hrSystemUptime

Trap Definitions

There are two ways of defining a notification — one used in SMIv1 MIBs
and one used in SMIv2 MIBs. The two styles are basically equivalent,
and it is possible to convert between the two. In particular, it is
perfectly valid to send an SMIv2-defined notification as an SNMPv1 trap,
or an SMIv1-defined trap as an SNMPv2c (or SNMPv3) notification.

SMIv1 Traps

A trap is defined in an SMIv1 MIB file using the TRAP-TYPE macro,
as in the following example:

 UCD-TRAP-TEST-MIB DEFINITIONS ::= BEGIN
       IMPORTS ucdExperimental FROM UCD-SNMP-MIB;
 
 demotraps OBJECT IDENTIFIER ::= { ucdExperimental 990 }
 
 demoTrap TRAP-TYPE
       ENTERPRISE demotraps
       VARIABLES { sysLocation }
       DESCRIPTION "An example of an SMIv1 trap"
       ::= 17
 
 END

Note that the trap is identified by two values — the ENTERPRISE-oid (.1.3.6.1.4.1.2021.13.990 which is TRAP-TEST-MIB::demotraps)
and the specific-trap value of the TRAP-TYPE macro (17)

SMIv2 Notifications

A notification is defined in an SMIv2 MIB file using the NOTIFICATION-TYPE macro,
as in the following example:

 UCD-NOTIFICATION-TEST-MIB DEFINITIONS ::= BEGIN
       IMPORTS ucdExperimental FROM UCD-SNMP-MIB;
 
 ucdNotificationTestMib MODULE-IDENTITY
   -- omitted
 
 demotraps  OBJECT IDENTIFIER ::= { ucdExperimental 990 }
 demonotifs OBJECT IDENTIFIER ::= { demotraps 0 }
 
 demoNotif NOTIFICATION-TYPE
       OBJECTS { sysLocation }
       STATUS current
       DESCRIPTION "An example of an SMIv2 notification"
       ::= { demonotifs 18 }
 
 ucdNotificationGroup NOTIFICATION-GROUP
   -- omitted
 END

Note that this defines a single OID which will uniquely identify
the notification.

Variables

Both SMIv1 and SMIv2 definitions can specify additional information
that should be included within the trap.
The name of the clause is different between the two definitions
(VARIABLES vs OBJECTS), but the meaning is the same — the
notification should include a varbind (OID and value) for each
object listed, in the order that they appear.

<tasks> Object vs Instance</tasks>

Traps vs Notifications

Strictly speaking, we should probably refer to all such MIB definitions
as «notifications» — with the term «trap» being reserved for the
(unacknowledged) SNMP request used to transport the relevant information.
But people do tend to use the two terms interchangeably (as has been
the case in this tutorial as well!)

<tasks> describe {enterprises}.0.{value} <-> {oid} conversion</tasks> — see

Data Types

The list of valid datatypes can be found at the end of the snmpset help output:

   $ snmpset -h |& tail -4
   type - one of i, u, t, a, o, s, x, d, n
     i: INTEGER, u: unsigned INTEGER, t: TIMETICKS, a: IPADDRESS
     o: OBJID, s: STRING, x: HEX STRING, d: DECIMAL STRING
     U: unsigned int64, I: signed int64, F: float, D: double

Note that the last four types are only valid when talking to the
Net-SNMP agent. They are not part of the official SNMP specification.

Assuming that the MIB file is loaded, then it’s also possible to
specify the type as «=», and the command will
supply the appropriate type from the MIB file:

   $ snmpset test.net-snmp.org ucdDemoPublicString.0 = "Hello clouds"
   UCD-DEMO-MIB::ucdDemoPublicString.0 = "Hello clouds"

This doesn’t work if the MIB file isn’t loaded, of course — but then
referring to the MIB object by name wouldn’t either!

Failed Requests

The examples above show the successful retrieval of information from the
target system. But what about requests that are not successful?
How does SNMP handle failed requests?

A common mistake when using the snmpget command is to forget the index (or «instance subidentifier») of the data being requested. This is less likely when retrieving a value from within a table, where it is natural to include the index as part of the OID. But for scalar objects, there is only one value, so it doesn’t seem necessary to specify an index — surely the MIB object name alone should be sufficient?

However SNMP is consistent in requiring an instance for all MIB objects — even scalar objects. In this case, the instance subidentifier is always a simple (zero), as shown in the first example above.

Omitting this results in an error:

   % snmpget -v 1 -c demopublic test.net-snmp.org sysUpTime
   Error in packet
   Reason: (noSuchName) There is no such variable name in this MIB.
   This name doesn't exist: sysUpTime

Note that SNMPv2c gives a slightly more informative message:

   % snmpget -v 2c -c demopublic test.net-snmp.org sysUpTime
   SNMPv2-MIB::sysUpTime = No Such Instance currently exists

The other likely cause of failure is that the agent does not support the requested MIB object at all. With SNMPv1, the error is exactly the same («noSuchName«).
SNMPv2c uses a slightly different indication of this situation:

   % snmpget -v 2c -c demopublic test.net-snmp.org .1.3.6.1.2.1.1.99.0
   SNMPv2-MIB::system.99.0 = No Such Object available on this agent at this OID

SNMPv3 reports problems in the same way as SNMPv2c.

Timeouts

Another possible type of failure is that the request may timeout
without returning any information at all.
Assuming that the remote system is actually running an SNMP agent,
the most likely cause of this would be the access control settings
of the remote agent.
See the FAQ entries
Why doesn’t the agent respond? and
How do I configure access control? for further details.

Tutorial Sections

About the SNMP Protocol

These tutorial links talk about SNMP generically and how the protocol itself works. They are good introductory reading material and the concepts are important to understand before diving into the later tutorials about Net-SNMP itself.

  • How SNMP Works: About the protocol itself (GETs, GETNEXTs, etc)
  • What data is in SNMP: All about SNMP Management Information Bases (MIBs)
  • Securing SNMP: How to use the SNMP protocol securely

Net-SNMP Command Line Applications

These tutorial pages discuss the command line tools provided in the Net-SNMP suite of tools. Nearly all the example commands in these tutorials works if you try it yourself, as they’re all examples that talk to our online Net-SNMP test agent. Given them a shot!

  • snmptranslate: learning about the MIB tree.
  • snmpget: retrieving data from a host.
  • snmpgetnext: retrieving unknown indexed data.
  • snmpwalk: retrieving lots of data at once!
  • snmptable: displaying a table.
  • snmpset: peforming write operations.
  • snmpbulkget: communicates with a network entity using SNMP GETBULK request
  • snmpbulkwalk: retrieve a sub-tree of management values using SNMP GETBULK requests.
  • snmptrap: Sending and receiving traps, and acting upon them.
    • Traps/informs with SNMPv3/USM: Sending and receiving SNMPv3/USM TRAPs and INFORMs
    • Sending Traps/Informs via AgentX: Sending notifications from the command line through snmpd
  • Common command line options:
    • Using and loading MIBS
    • SNMPv3/USM Options
    • Using SNMPv3 over TLS and DTLS
    • Customized Output Formats
  • Writing mib2c config files

Application Configuration

All of our applications support configuration to allow you to customize how they behave.

Configuration files for Net-SNMP applications

Net-SNMP Daemons

Net-SNMP comes with two long-running daemons: a SNMP agent (snmpd) for responding to management requests and a notification receiver (snmptrapd) for receiving SNMP notifications.

  • SNMP Agent (snmpd) Configuration
    • Configuration Basics
    • Access Control (VACM)
    • snmpconf
  • SNMP Notification Receiver (snmptrapd)
    • Configuring snmptrapd
    • Configuring SNMPv3 notifications
    • Configuring snmptrapd to understand vendor-specific MIBS (Cisco)
  • Agent Monitoring
    • DisMan Monitoring
    • Monitoring with MRTG

Coding Tutorials

Net-SNMP comes with a highly flexible and extensible API. The API allows you to create your own commands, add extensions to the agent to support your own MIBs and perform specialized processing of notifications.

  • Client / Manager Coding Tutorials
    • Writing a simple application
    • Writing a simple asynchronous application
  • Agent Coding Tutorials
    • The Agent Architecture page might be worth reading before or after the agent coding tutorials, and describes how the Agent Helpers work under the hood.
    • Writing a mib module to serve information described by an SNMP MIB, and how to compile it into the net-snmp snmpd agent.
    • Writing a Dynamically Loadable Object that can be loaded into the SNMP agent.
    • Writing a Subagent that can be run to attach to the snmpd master agent.
    • Writing a perl plugin to extend the agent using the NetSNMP::agent module.
    • Writing shell scripts to extend the agent
    • Using mib2c to help write an agent code template for you
      • General mib2c Overview
      • Using the mib2c-update script to recode your code
  • Header files and autoconf

Debugging SNMP Applications and Agents

All our tools and applications have extensive debugging output. These tutorials talk about how the debugging system works and how you can add your own debugging statements to you code:

  • Debugging output printed using the -D command line option

    Putting DEBUGMSG tokens in your code

  • Using -Ddump to display packet breakdowns
  • Debugging using GDB

Using MIB with an SNMP agent

SNMP agents collect network device information and store it in a Management Information Base (MIB) and become accessible to powerful SNMP tools.

Paessler SNMP, MIBs and OIDs monitoring with PRTG (FREE TRIAL)

With Paessler’s PRTG Network Monitor, you can deploy SNMP, MIBS, and OIDs all from within the one intuitive dashboard. PRTG uses SNMP to monitor your network and to handle your MIBs and OIDs. Once set up PRTG can begin collecting all the relevant data on each of the devices on your network and the software they operate. The system information is stored in a tree and branch structure with each vendor making up a branch of the tree, helping you identify and troubleshoot each of the network devices.

PRTG Network Monitor is available on a 30-day free trial.

OID Conversion

In its simplest form, snmptranslate takes a numeric OID and displays the corresponding textual MIB name:

     % snmptranslate .1.3.6.1.2.1.1.3.0
     SNMPv2-MIB::sysUpTime.0

It can also perform the reverse translation, taking the textual MIB name and displaying the numeric OID. This uses the -On flag:

     % snmptranslate -On SNMPv2-MIB::sysUpTime.0
     .1.3.6.1.2.1.1.3.0

There are several other ways of displaying an OID, which are described in TUT:Customized_Output_Formats. One of these is to show the full list of MIB subidentifier names, using the -Of flag:

     % snmptranslate -Of SNMPv2-MIB::sysUpTime.0
     .iso.org.dod.internet.mib-2.system.sysUpTime.0

Note that these flags determine how the OID should be displayed, regardless of how it was originally specified:

 % snmptranslate .iso.3.6.1.private.enterprises.2021.2.1.prNames.0
 NET-SNMP-MIB::prNames.0
 % snmptranslate -On .iso.3.6.1.private.enterprises.2021.2.1.prNames.0
 .1.3.6.1.4.1.2021.2.1.2.0
 % snmptranslate -Of .iso.3.6.1.private.enterprises.2021.2.1.prNames.0
 .iso.org.dod.internet.private.enterprises.ucdavis.procTable.prEntry.prNames.0

Table Indexes

One thing missing from the tables above, is any indication of the index values for each row. The earliest MIB tables (and some more recent, but poorly designed tables) did
define the indexes as accessible objects, which would therefore appear in the snmptable output. But current MIB design has recognised that the index values are included in the instance OIDs, so it is not necessary to explicitly retrieve them as a separate column object.

By default, the snmptable command ignores these index values, but it will display them if invoked with the -Ci option:

  % snmptable -v 2c -c demopublic -Os -Cw 70 -Ci test.net-snmp.org sysORTable
  SNMP table: sysORTable
   index    sysORID                                         sysORDescr
       1    snmpMIB                The Mib module for SNMPv2 entities.
       2      ifMIB   generic objects for network interface sub-layers
       4         ip            The MIB module for managing IP and ICMP
       5     udpMIB    The MIB module for managing UDP implementations
  
  SNMP table: sysORTable, part 2
   index   sysORUpTime
       1  0:0:00:00.82
       2  0:0:00:00.81
       4  0:0:00:00.83
       5  0:0:00:00.82

Note that the index is listed for each block of a width-limited (and hence multi-sectioned) table display.

What is snmpwalk?

snmpwalk is the name given to an SNMP application that runs multiple GETNEXT requests automatically. The SNMP GETNEXT request is used to query an enabled device and take SNMP data from a device. The snmpwalk command is used because it allows the user to chain GETNEXT requests together without having to enter unique commands for each and every OID or node within a sub-tree.

The snmpwalk is issued to the root node of the sub-tree so that system information is gathered from every connected node. This provides you with an efficient way to collect information from a range of devices like routers and switches. The information you collect arrives in the form of OIDs. An OID is an object which is part of the MIB within an SNMP-enabled device.

Specifying the Table OID

Unlike the other command line applications
(snmpget, snmpgetnext, snmpwalk etc),
snmptable can only be used with a MIB table object.
If this command is given any other OID (including the tableEntry object,
one of the table columns, or a particular instance within a table),
then this will be rejected:

   % snmptable -v 2c -c demopublic -Os test.net-snmp.org sysOREntry
   Was that a table? sysOREntry
   % snmptable -v 2c -c demopublic -Os test.net-snmp.org sysORID
   Was that a table? sysORID
   % snmptable -v 2c -c demopublic -Os test.net-snmp.org sysORID.3
   Was that a table? sysORID.3
   % snmptable -v 2c -c demopublic -Os test.net-snmp.org system
   Was that a table? system

Also, snmptable relies on having the relevant MIB file available
(and loaded), in order to know which columns to retrieve. It is not
possible to run it without this MIB — even if numeric OIDs are used
(which would otherwise be fine):

   % snmptable -v 2c -c demopublic -m ' ' test.net-snmp.org .1.3.6.1.2.1.1.9
   Was that a table? iso.3.6.1.2.1.1.9
   % snmptable -v 2c -c demopublic        test.net-snmp.org .1.3.6.1.2.1.1.9
   SNMP table: SNMPv2-MIB::sysORTable
       etc, etc

Tutorial Sections

About the SNMP Protocol

These tutorial links talk about SNMP generically and how the protocol itself works. They are good introductory reading material and the concepts are important to understand before diving into the later tutorials about Net-SNMP itself.

  • How SNMP Works: About the protocol itself (GETs, GETNEXTs, etc)
  • What data is in SNMP: All about SNMP Management Information Bases (MIBs)
  • Securing SNMP: How to use the SNMP protocol securely

Net-SNMP Command Line Applications

These tutorial pages discuss the command line tools provided in the Net-SNMP suite of tools. Nearly all the example commands in these tutorials works if you try it yourself, as they’re all examples that talk to our online Net-SNMP test agent. Given them a shot!

  • snmptranslate: learning about the MIB tree.
  • snmpget: retrieving data from a host.
  • snmpgetnext: retrieving unknown indexed data.
  • snmpwalk: retrieving lots of data at once!
  • snmptable: displaying a table.
  • snmpset: peforming write operations.
  • snmpbulkget: communicates with a network entity using SNMP GETBULK request
  • snmpbulkwalk: retrieve a sub-tree of management values using SNMP GETBULK requests.
  • snmptrap: Sending and receiving traps, and acting upon them.
    • Traps/informs with SNMPv3/USM: Sending and receiving SNMPv3/USM TRAPs and INFORMs
    • Sending Traps/Informs via AgentX: Sending notifications from the command line through snmpd
  • Common command line options:
    • Using and loading MIBS
    • SNMPv3/USM Options
    • Using SNMPv3 over TLS and DTLS
    • Customized Output Formats
  • Writing mib2c config files

Application Configuration

All of our applications support configuration to allow you to customize how they behave.

Configuration files for Net-SNMP applications

Net-SNMP Daemons

Net-SNMP comes with two long-running daemons: a SNMP agent (snmpd) for responding to management requests and a notification receiver (snmptrapd) for receiving SNMP notifications.

  • SNMP Agent (snmpd) Configuration
    • Configuration Basics
    • Access Control (VACM)
    • snmpconf
  • SNMP Notification Receiver (snmptrapd)
    • Configuring snmptrapd
    • Configuring SNMPv3 notifications
    • Configuring snmptrapd to understand vendor-specific MIBS (Cisco)
  • Agent Monitoring
    • DisMan Monitoring
    • Monitoring with MRTG

Coding Tutorials

Net-SNMP comes with a highly flexible and extensible API. The API allows you to create your own commands, add extensions to the agent to support your own MIBs and perform specialized processing of notifications.

  • Client / Manager Coding Tutorials
    • Writing a simple application
    • Writing a simple asynchronous application
  • Agent Coding Tutorials
    • The Agent Architecture page might be worth reading before or after the agent coding tutorials, and describes how the Agent Helpers work under the hood.
    • Writing a mib module to serve information described by an SNMP MIB, and how to compile it into the net-snmp snmpd agent.
    • Writing a Dynamically Loadable Object that can be loaded into the SNMP agent.
    • Writing a Subagent that can be run to attach to the snmpd master agent.
    • Writing a perl plugin to extend the agent using the NetSNMP::agent module.
    • Writing shell scripts to extend the agent
    • Using mib2c to help write an agent code template for you
      • General mib2c Overview
      • Using the mib2c-update script to recode your code
  • Header files and autoconf

Debugging SNMP Applications and Agents

All our tools and applications have extensive debugging output. These tutorials talk about how the debugging system works and how you can add your own debugging statements to you code:

  • Debugging output printed using the -D command line option

    Putting DEBUGMSG tokens in your code

  • Using -Ddump to display packet breakdowns
  • Debugging using GDB

Further Information

To get extended information about a particular MIB node, use the -Td flag to display the full description from the MIB file:

  % snmptranslate -On -Td SNMPv2-MIB::sysUpTime
  .1.3.6.1.2.1.1.3
  sysUpTime OBJECT-TYPE
    -- FROM       SNMPv2-MIB, RFC1213-MIB
    SYNTAX        TimeTicks
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION   "The time (in hundredths of a second) since the network
              management portion of the system was last re-initialized."
  ::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) system(1) 3 }

This can be combined with the other flags described earlier:

  % snmptranslate -On -Td -IR sysUpTime
  % snmptranslate -On -Td -Ib 'sys.*ime'

to give the same results.

Finally, it’s possible to display a formatted diagram of a selected subset of the MIB tree, using the -Tp flag:

   % snmptranslate -Tp -IR system
   +--system(1)
      |
      +-- -R-- String    sysDescr(1)
      |        Textual Convention: DisplayString
      +-- -R-- ObjID     sysObjectID(2)
      +-- -R-- TimeTicks sysUpTime(3)
      +-- -RW- String    sysContact(4)
      |        Textual Convention: DisplayString
      +-- -RW- String    sysName(5)
      |        Textual Convention: DisplayString
      +-- -RW- String    sysLocation(6)
      |        Textual Convention: DisplayString
      +-- -R-- Integer   sysServices(7)
      +-- -R-- TimeTicks sysORLastChange(8)
      |        Textual Convention: TimeStamp
      |
      +--sysORTable(9)
         |
         +--sysOREntry(1)
            |
            +-- ---- Integer   sysORIndex(1)
            +-- -R-- ObjID     sysORID(2)
            +-- -R-- String    sysORDescr(3)
            |        Textual Convention: DisplayString
            +-- -R-- TimeTicks sysORUpTime(4)
                     Textual Convention: TimeStamp

This shows the accessibility (read-only, or read-write), syntax, name and subidentifier of each MIB object within the specified subtree, together with the internal structure of those MIB objects.

Running snmptranslate -Tp without an OID argument will display this information for the known MIB tree in its entirety. This is left as an exercise for the student!

Пакет net-snmp

Установка snmp консоли

Debian/Ubuntu

server# apt install snmp snmp-mibs-downloader

server# :> /etc/snmp/snmp.conf
MIBDIRS=C:\usr\share\snmp\mibs

Настройка snmp агента

Debian/Ubuntu

gate# apt install snmpd

gate# cat /etc/default/snmpd
...
#export MIBS=
...
SNMPDRUN=yes
...
gate# cd /etc/snmp/

FreeBSD

gate# pkg install net-snmp

gate# service snmpd rcvar

gate# mkdir /usr/local/etc/snmp/

gate# cd /usr/local/etc/snmp/
gate# cat snmpd.conf
rocommunity public  0.0.0.0/0

Настройка snmptrapd сервиса

Debian/Ubuntu

server# apt install snmptrapd

server# systemctl enable snmptrapd

Debian/Ubuntu

server# cat /etc/snmp/snmptrapd.conf
#traphandle default mail -s snmptrap userX@isp.un

traphandle default /usr/bin/traptoemail -s mail.isp.un userX@isp.un

traphandle default cat >> /tmp/traps

authCommunity execute writetrap

Debian/Ubuntu

# service snmptrapd start

# snmptrap -v 1 -c writetrap 127.0.0.1 '.1.3.6.1.6.3.1.1.5.3' '0.0.0.0' 6 33 '55' .1.3.6.1.6.3.1.1.5.3 s "teststring000"

# tail -f /tmp/traps

!!! На стенде при первой итерации большие задержки

Варианты использования snmp консоли в режиме чтения

Определение имени устройства

server# snmpget -c public -v2c router .1.3.6.1.2.1.1.5.0

server# snmpget -c public -v2c router SNMPv2-MIB::sysName.0

server# snmpget -c public -v2c router sysName.0

server# snmpwalk -c public -v2c router sysName

Вывод количества байт, прошедших через порт устройства с момента его включения

server# snmpget -c public -v2c router ifInOctets.2
server# snmpget -c public -v2c router ifHCInOctets.2

server# snmpget -c public -v2c router ifOutOctets.2
server# snmpget -c public -v2c router ifHCOutOctets.2

Информация по протоколу CDP

server# snmpwalk -c public -v2c router .1.3.6.1.4.1.9.9.23.1.2.1.1

Варианты использования протокола SNMP в режиме записи

Отключение/включение интерфейсов

server# snmpwalk -c write -v2c switch ifDescr

server# snmpwalk -c write -v2c switch ifOperStatus

server# snmpwalk -c write -v2c switch ifAdminStatus

server# snmpset -c write -v2c switch ifAdminStatus.3 integer 2

server# snmpset -c write -v2c switch ifAdminStatus.3 integer 1

Копирование файла конфигурации по tftp

server# cat /srv/tftp/firewall.acl

server# snmpset -c write -v2c router .1.3.6.1.4.1.9.2.1.53.192.168.X.10 string "firewall.acl"

значение 192.168.X.10 в конце OID содержит адрес tftp сервера

Walking tables

The first example above contains both scalar and table instances.
Snmpwalk can also be used for retrieving a single column of a table,
by specifying the column object as the starting point.

 % snmpwalk -v 2c -c demopublic test.net-snmp.org sysORID
 SNMPv2-MIB::sysORID.1 = OID: SNMPv2-MIB::snmpMIB
 SNMPv2-MIB::sysORID.2 = OID: IF-MIB::ifMIB
 SNMPv2-MIB::sysORID.4 = OID: IP-MIB::ip
 SNMPv2-MIB::sysORID.5 = OID: UDP-MIB::udpMIB

Note that when retrieving a full table (either alone, or as part of a wider walk),
all the values for one column are displayed before moving on to the next.
This can be seen in the output of walking the system group above.

This is precisely the behaviour described in the
snmpgetnext tutorial for a chain of GETNEXT requests.
However it sometimes comes as a surprise to those new to SNMP, who expect
such tables to be displayed one row at a time.
The snmptable command may provide a more familiar view of such tables.

Tutorial Sections

About the SNMP Protocol

These tutorial links talk about SNMP generically and how the protocol itself works. They are good introductory reading material and the concepts are important to understand before diving into the later tutorials about Net-SNMP itself.

  • How SNMP Works: About the protocol itself (GETs, GETNEXTs, etc)
  • What data is in SNMP: All about SNMP Management Information Bases (MIBs)
  • Securing SNMP: How to use the SNMP protocol securely

Net-SNMP Command Line Applications

These tutorial pages discuss the command line tools provided in the Net-SNMP suite of tools. Nearly all the example commands in these tutorials works if you try it yourself, as they’re all examples that talk to our online Net-SNMP test agent. Given them a shot!

  • snmptranslate: learning about the MIB tree.
  • snmpget: retrieving data from a host.
  • snmpgetnext: retrieving unknown indexed data.
  • snmpwalk: retrieving lots of data at once!
  • snmptable: displaying a table.
  • snmpset: peforming write operations.
  • snmpbulkget: communicates with a network entity using SNMP GETBULK request
  • snmpbulkwalk: retrieve a sub-tree of management values using SNMP GETBULK requests.
  • snmptrap: Sending and receiving traps, and acting upon them.
    • Traps/informs with SNMPv3/USM: Sending and receiving SNMPv3/USM TRAPs and INFORMs
    • Sending Traps/Informs via AgentX: Sending notifications from the command line through snmpd
  • Common command line options:
    • Using and loading MIBS
    • SNMPv3/USM Options
    • Using SNMPv3 over TLS and DTLS
    • Customized Output Formats
  • Writing mib2c config files

Application Configuration

All of our applications support configuration to allow you to customize how they behave.

Configuration files for Net-SNMP applications

Net-SNMP Daemons

Net-SNMP comes with two long-running daemons: a SNMP agent (snmpd) for responding to management requests and a notification receiver (snmptrapd) for receiving SNMP notifications.

  • SNMP Agent (snmpd) Configuration
    • Configuration Basics
    • Access Control (VACM)
    • snmpconf
  • SNMP Notification Receiver (snmptrapd)
    • Configuring snmptrapd
    • Configuring SNMPv3 notifications
    • Configuring snmptrapd to understand vendor-specific MIBS (Cisco)
  • Agent Monitoring
    • DisMan Monitoring
    • Monitoring with MRTG

Coding Tutorials

Net-SNMP comes with a highly flexible and extensible API. The API allows you to create your own commands, add extensions to the agent to support your own MIBs and perform specialized processing of notifications.

  • Client / Manager Coding Tutorials
    • Writing a simple application
    • Writing a simple asynchronous application
  • Agent Coding Tutorials
    • The Agent Architecture page might be worth reading before or after the agent coding tutorials, and describes how the Agent Helpers work under the hood.
    • Writing a mib module to serve information described by an SNMP MIB, and how to compile it into the net-snmp snmpd agent.
    • Writing a Dynamically Loadable Object that can be loaded into the SNMP agent.
    • Writing a Subagent that can be run to attach to the snmpd master agent.
    • Writing a perl plugin to extend the agent using the NetSNMP::agent module.
    • Writing shell scripts to extend the agent
    • Using mib2c to help write an agent code template for you
      • General mib2c Overview
      • Using the mib2c-update script to recode your code
  • Header files and autoconf

Debugging SNMP Applications and Agents

All our tools and applications have extensive debugging output. These tutorials talk about how the debugging system works and how you can add your own debugging statements to you code:

  • Debugging output printed using the -D command line option

    Putting DEBUGMSG tokens in your code

  • Using -Ddump to display packet breakdowns
  • Debugging using GDB
Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *