Snmpwalk linux ������� �������������

Примеры snmpwalk для Windows и Linux

В конце 1980-х, SNMP или Простой протокол управления сетью впервые возник как решение для управления узлами в сети. С тех пор данные SNMP использовались для измерения производительности устройств среди бесчисленных поставщиков, чтобы обеспечить работоспособность сетей. Сегодня SNMP является одним из самых популярных сетевых протоколов в мире и snmpwalk стал методом сканирования для сканирования нескольких узлов одновременно.

Как работает SNMP?

Однако, прежде чем мы рассмотрим команду snmpwalk, нам сначала нужно посмотреть, как работает SNMP. На устройствах с поддержкой SNMP Агент SNMP собирает информацию с устройства и хранит его в База управленческой информации (MIB) где хранятся эти данные, чтобы к ним можно было обращаться каждый раз, когда менеджер SNMP опрашивает агента SNMP.

Когда SNMP Manager запрашивает SNMP-агент, данные берутся из MIB и отправляются в SNMP Manager, где их можно просматривать с помощью инструмента сетевого мониторинга. Существует много разных команд, которые вы можете использовать для запроса агента SNMP. Наиболее распространенными способами являются использование ПОЛУЧИТЬ или GET-Next команда. Команда GET используется для Идентификатор объекта (OID) Из MIB. Команда GET-Next немного более продвинута и проходит через дерево MIB от OID до OID, получая информацию. Здесь приходит snmpwalk.

Что такое snmpwalk?

snmpwalk это имя, данное приложение SNMP, которое автоматически выполняет несколько запросов GETNEXT. Запрос SNMP GETNEXT используется для запроса устройства и получения данных SNMP с устройства. Команда snmpwalk используется потому, что она позволяет пользователю объединять запросы GETNEXT вместе, не вводя уникальные команды для каждого OID или узла в поддереве..

snmpwalk выдается корневому узлу поддерева так что информация собирается из каждого подключенного узла. Это предоставляет вам эффективный способ сбора информации с различных устройств, таких как маршрутизаторы и коммутаторы. Собираемая вами информация поступает в форме OID. OID — это объект, который является частью MIB в устройстве с поддержкой SNMP.

Установка snmpwalk в Windows

Для пользователей Windows процесс установки snmpwalk в Windows невероятно прост.

  1. Сначала вам нужно скачать и извлечь следующий файл из zip-файла:
    https://sourceforge.net/projects/net-snmp/files/net-snmp/
  2. Когда у вас есть файл snmpwalk.exe на вашем компьютере, нажмите Начало > поиск CMD и нажмите Войти. Это покажет окно командной строки.
  3. Перетащите snmpwalk.exe файл в черное окно.

Если вы не хотите запускать файл из командной строки, вы можете скачать установщик .exe по этой ссылке здесь (обратите внимание, что вы хотите выбрать самую последнюю версию, которую можете): http://sourceforge.net/projects/net-snmp/files/net-snmp/

Установка snmpwalk в Linux

На устройствах Linux snmpwalk доступен в виде пакета для установки. Процесс этого зависит от вашего дистрибутива Linux. Однако вы можете установить Linux, введя следующие команды:

  • Redhat / Fedora / CentOs: yum install net-snmp-utils
  • Ubuntu: apt-get установить snmp

Параметры и параметры Snmpwalk в Windows и Linux

Snmpwalk имеет ряд различных параметров, которые вы можете использовать. К ним относятся следующие:

  • имя хоста — Имя агента SNMP.
  • сообщество -Тип читаемого сообщества.
  • object_id — Укажите идентификатор объекта для возврата всех объектов SNMP под ним. Если NULL, то корень объектов SNMP принимается как object_id.
  • Тайм-аут — количество микросекунд до первого таймаута.
  • повторы — Сколько раз повторить попытку подключения в случае тайм-аута.
  • -Операционные системы — Показывает последний символический элемент OID.
  • -Устанавливает строку сообщества.
  • -v — указывает версию SNMP, которую вы хотите использовать.

Как минимизировать информацию, которую вы видите с помощью snmpwalk

Первое, что вы заметите при запуске snmpwalk, — это слишком много результатов, чтобы вы могли их прочитать. Вы можете легко получить тысячи разных результатов. Чтобы обойти это, поставщики помогут вам, предоставив вам MIB файл. Файл MIB используется для указания того, какие OID доступны на устройстве.. Многие поставщики предоставляют вам MIB-файл для каждого вашего устройства. Наличие файла MIB позволяет вам выполнить запрос, специфичный для этого файла, а не проходить через все.

Читайте также:  Установка альт линукс рядом с windows

Смотрите также: Инструменты SMNP

Примеры Snmpwalk

При использовании snmpwalk на устройстве агент SNMP предоставит вам диапазон значений. Вы будете проходить через OID от вашего начального OID и далее. Если вы введете команду snmpwalk на устройстве, отобразится результат, подобный следующему:

$ snmpwalk -v1 -c public 10.10.1.224
SNMPv2-MIB :: sysDescr.0 = STRING: APC Web / Карта управления SNMP
SNMPv2-MIB :: sysObjectID.0 = OID: SNMPv2-SMI :: enterprises.318.1.3.7
SNMPv2-MIB :: sysUpTime.0 = Timeticks: (47372422) 5 дней, 11: 35: 24.22
SNMPv2-MIB :: sysContact.0 = STRING: Comparitech
SNMPv2-MIB :: sysName.0 = STRING: APC-3425
SNMPv2-MIB :: sysLocation.0 = sTRING: 3425EDISON
SNMPv2-MIB :: sysServices.0 = INTEGER: 72
IF-MIB :: ifNumber.0 = INTEGER: 1
IF-MIB :: ifIndex.1 = INTEGER: 1
IF-MIB :: ifDescr.1 = STRING: veya
.
SNMPv2-MIB :: snmpOutGetResponses.0 = Counter32: 338
SNMPv2-MIB: snmpOutTraps.0 = Counter32: 0
SNMPv2-MIB :: snmpEnableAuthenTraps.0 = INTEGER: 0
$

Как видите, много информации генерируется одной командой. Большинство строк состоит из информации, полученной из MIB.

В приведенном ниже примере вы можете увидеть пример snmpwalk без MIB. Второе число в первой строке или .1.3.6.1.4.1.318 — это OID, с которого мы начали.

$ snmpwalk -v1 -c public 10.10.1.224 .1.3.6.1.4.1.318
SNMPv2-SMI :: enterprises.318.1.1.1.1.1.1.0 = STRING: «Silcon DP340E»
SNMPv2-SMI :: enterprises.318.1.1.1.1.1.2.0 = STRING: «UPS_IDEN»
SNMPv2-SMI :: enterprises.318.1.1.1.1.2.1.0 = STRING: «314.10.D
.

Однако, если у вас есть определенный MIB, вы можете получить более подробную информацию, возвращенную вам из объектов, которые вы хотите просмотреть. В приведенном ниже примере команда -m обозначает MIB, который будет запрашиваться.

$ snmpwalk -v1 -c public -m «./APC-POWERNET.txt» 10.10.1.224 apc
PowerNet-MIB :: upsBasicIdentModel.0 = STRING: «Silcon DP340E»
PowerNet-MIB :: upsBasicIdentName.0 = STRING: «UPS_IDEN»
PowerNet-MIB :: upsAdvIdentFirmwareRevision.0 = STRING: «314.10.D»
.

Ниже приведен пример команды snmpwalk для Linux. Как вы можете видеть, эта функция работает примерно так же, проходя через OID для извлечения соответствующей информации из подключенных устройств:

#% snmpwalk-v 1 локальная публичная система # system.sysDescr.o = «SunOS name sun4c»
# system.sysObjectID.o = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4
# system.sys.UpTime.o = Timeticks (595637548) 68 дней, 22:32:55
# system.sysContact.o = «[email protected]>»
# system.sysName.o = «Ridyadh_o8_WS»
# system.sysLocation.o = «Ридьяд, КСА»
# system.sysServices.o = 72

Экономьте время с snmpwalk

snmpwalk кажется сложной концепцией, но на самом деле это не так. Команда snmpwalk просто сокращенный способ использовать несколько запросов GETNEXT без необходимости вводить множество различных команд. С помощью одной команды snmpwalk вы можете запустить множество различных GETNEXT и просмотреть состояние своей инфраструктуры..

Если вы используете команду snmpwalk, важно помнить, чтобы максимально сократить объем получаемой информации. Указание MIB позволит вам видеть конкретную информацию, а не данные, собранные из всей базы данных идентификаторов объектов!

Таким образом, получая данные SNMP с устройств по всей вашей сети, вы можете быть уверены, что не пропустите ничего важного в вашей сети. В конце концов, есть команда snmpwalk, которая поможет вам максимально эффективно извлекать данные SNMP с устройств в вашей сети..

Использование MIB с агентом SNMP

Агенты SNMP собирают информацию о сетевых устройствах и сохраняют ее в базе управляющей информации (MIB) и становятся доступными для мощных инструментов SNMP.

Мониторинг SNMP, MIB и OID Paessler с помощью PRTG (БЕСПЛАТНАЯ ПРОБНАЯ ВЕРСИЯ)

С Paessler’s PRTG Сетевой монитор, Вы можете развернуть SNMP, MIBS и OID с одной интуитивно понятной панели. PRTG использует SNMP для мониторинга вашей сети и для обработки ваших MIB и OID. После настройки PRTG может начать сбор всех соответствующих данных на каждом из устройств в вашей сети и на программном обеспечении, с которым они работают. Информация хранится в древовидной и ветвистой структуре, при этом каждый поставщик составляет ветвь дерева, помогая вам идентифицировать и устранять неполадки на каждом из устройств в вашей сети..

Сетевой монитор PRTG доступен на 30-дневной бесплатной пробной версии..

Мониторинг SNMP, MIB и OID Paessler с помощью PRTG Загрузить 30-дневную бесплатную пробную версию

Смотрите также: Лучшие инструменты мониторинга SNMP

Источник

snmpwalk

SNMP query tool.

Query the system information of a remote host using SNMPv1 and a community string

Query system information on a remote host by OID using SNMPv2 on a specified port

Query system information on a remote host by OID using SNMPv3 and authentication without encryption

Query system information on a remote host by OID using SNMPv3, authentication, and encryption

Query system information on a remote host by OID using SNMPv3 without authentication or encryption

SYNOPSIS

snmpwalk [APPLICATION OPTIONS] [COMMON OPTIONS] AGENT [OID]

DESCRIPTION

snmpwalk is an SNMP application that uses SNMP GETNEXT requests to query a network entity for a tree of information.

An object identifier (OID) may be given on the command line. This OID specifies which portion of the object identifier space will be searched using GETNEXT requests. All variables in the subtree below the given OID are queried and their values presented to the user. Each variable name is given in the format specified in variables(5).

If no OID argument is present, snmpwalk will search the subtree rooted at SNMPv2-SMI::mib-2 (including any MIB object values from other MIB modules, that are defined as lying within this subtree). If the network entity has an error processing the request packet, an error packet will be returned and a message will be shown, helping to pinpoint why the request was malformed.

Читайте также:  Blink локальный сервер windows

If the tree search causes attempts to search beyond the end of the MIB, the message «End of MIB» will be displayed.

OPTIONS

Do not check whether the returned OIDs are increasing. Some agents (LaserJets are an example) return OIDs out of order, but can complete the walk anyway. Other agents return OIDs that are out of order and can cause snmpwalk to loop indefinitely. By default, snmpwalk tries to detect this behavior and warns you when it hits an agent acting illegally. Use -Cc to turn off this check.

End the walk at the specified OID, rather than a simple subtree. This can be used to walk a partial subtree, selected columns of a table, or even two or more tables within a single command.

Include the given OID in the search range. Normally snmpwalk uses GETNEXT requests starting with the OID you specified and returns all results in the MIB subtree rooted at that OID. Sometimes, you may wish to include the OID specified on the command line in the printed results if it is a valid OID in the tree itself. This option lets you do this explicitly.

In fact, the given OID will be retrieved automatically if the main subtree walk returns no useable values. This allows a walk of a single instance to behave as generally expected, and return the specified instance value. This option turns off this final GET request, so a walk of a single instance will return nothing.

Upon completion of the walk, print the number of variables found.

Upon completion of the walk, print the total wall-clock time it took to collect the data (in seconds). Note that the timer is started just before the beginning of the data request series and stopped just after it finishes. Most importantly, this means that it does not include snmp library initialization, shutdown, argument processing, and any other overhead.

In addition to these options, snmpwalk takes the common options described in the snmpcmd(1) manual page.

EXAMPLES

Note that snmpwalk REQUIRES an argument specifying the agent to query and at most one OID argument, as described there. The command:

snmpwalk -Os -c public -v 1 zeus system

will retrieve all of the variables under system:

sysDescr.0 = STRING: «SunOS zeus.net.cmu.edu 4.1.3_U1 1 sun4m»
sysObjectID.0 = OID: enterprises.hp.nm.hpsystem.10.1.1
sysUpTime.0 = Timeticks: (155274552) 17 days, 23:19:05
sysContact.0 = STRING: «»
sysName.0 = STRING: «zeus.net.cmu.edu»
sysLocation.0 = STRING: «»
sysServices.0 = INTEGER: 72
(plus the contents of the sysORTable).

snmpwalk -Os -c public -v 1 -CE sysORTable zeus system

will retrieve the scalar values, but omit the sysORTable.

Источник

Linux snmpwalk: An Overview of SNMP and the snmpwalk Utility

Simple Network Management Protocol (SNMP) was created in the late eighties as a short-term solution to manage the growing number of network nodes on the Internet. The network community quickly took to SNMP, and it is now the standard network management protocol used by just about every network device.

SNMP is now a popular protocol for managing networks of all sizes. It is used to collect information from devices, such as throughput and utilization, but it’s also used to configure devices by setting options. SNMP is available on all types of devices from servers, switches, routers, firewalls, printers, to laptops and tablets.

By using SNMP to monitor network performance and collect statistics and performance data, network management systems can present the information in graphical form for human network managers to review.

The SNMP architecture is based on a manager/agent model consisting of a manager element, an agent element and a central database of device management information. The SNMP manager (SERVER) interfaces with the SNMP agent, which resides on the remote device alongside a local management information base (MIB).

As they are on the same device, the agent interfaces directly with the local MIB, which is a collection of information regarding the device, such as vendor, model & revision, configuration, performance, capabilities, throughput, status, and much more, all collected in a hierarchal structure. The agent interrogates the MIB and retrieves information or set configuration parameters. There are two types of MIBs: scaler and tabular. Scalar MIBs represent a single object instance whereas tabular MIBs define multiple related object instances grouped together in MIB tables.

Читайте также:  Kali linux recovery mode

Object identifiers, OIDs, uniquely identify managed objects within a MIB hierarchy. The MIB hierarchy is organized like a tree with top-level MIB objects IDs (OIDs) belong to different standard organizations with lower level branches assigned to vendors. The vendors define their own private branches for their own managed objects. MIBs are normally preconfigured on the device along with SNMP applications, but they are also available through the vendor’s websites for developers to study.

SNMP works on the bases that the manager element sends out a request and the remote managed device, through the SNMP agent, interrogates the MIB and returns a response. This simple protocol is managed using four simple statements: GET, GET-NEXT, SET and TRAP.

Consider a simple scenario:

  1. A human network manager wishes to know the throughput and utilization percentage on the Internet WAN interface on the gateway router
  2. He requests the SNMP network manager element to supply that information via a NMS (Network Management System) or through the CLI.
  3. The SNMP network manager sends a request to the SNMP agent that resides on the gateway router to GET that information from the local MIB
  4. The SNMP agent obliges and retrieves the required information regarding the OIDs for the Internet interface, namely throughput and utilization, and sends the data back to the NMS
  5. The NMS updates its central database and displays the results.

SNMP community strings are the technique used by SNMP to granularly allow or restrict access to the SNMP agents and the local MIB on the remote devices. The agents must not reply to just anyone. Usually, information will be public and unrestricted. Therefore, some devices are configured with public strings that are read-only on some OIDs. There are other community strings set by access lists that allow read/write functions and some which are private.

  • GET – is the command to retrieve an OID from the MIB
  • GET-Next – is the command to walk through the MIB tree going from one OID to the next, this is the command SNMP-walk is based on.
  • SET – write a value in a parameter
  • TRAP – send an error message or alert due to a configurable threshold being passed or a trigger activated

SNMP is typically used as the source for a Network Management System as the NMS can mine the wealth of vendor specific SNMP status and configuration information regarding each device to provide a holistic view of the network.

The tool snmpwalk is not a part of the SNMP protocol, but it does use SNMP as its method of interrogating a network device. If the network device is configured with a public string then snmpwalk can communicate with it. By using the SNMP agent request, Get-Next, snmpwalk can specify an OID as a starting point in the tree that it wishes information to get information from.

The snmpwalk command essential makes a connection to the device using the public community string. Within the command, snmpwalk issues will be an OID reference point from which, by using Get-next commands, it can walk its way through the MIB’s OID branches of the hierarchal tree collecting all the information made available on the public null password.

The package snmpwalk is on most Linux repositories, so installing the package should not be a problem.

On RedHat/Fedora/Centos: yum install net-snmp-utils

Ubuntu: apt-get install snmp

Once loaded the snmpwalk command reference is shown below,

USAGE: snmpwalk [OPTIONS] AGENT [OID]

-h, –help display this help message

-H display configuration file directives understood

-v 1|2c|3 specifies SNMP version to use

-V, –version display package version number

SNMP Version 1 or 2c specific

-c COMMUNITY set the community string

SNMP Version 3 specific

-a PROTOCOL set authentication protocol (MD5|SHA)

-A PASSPHRASE set authentication protocol pass phrase

-e ENGINE-ID set security engine ID (e.g. 800000020109840301)

-E ENGINE-ID set context engine ID (e.g. 800000020109840301)

-l LEVEL set security level (noAuthNoPriv|authNoPriv|authPriv)

-n CONTEXT set context name (e.g. bridge1)

-u USER-NAME set security name (e.g. bert)

-x PROTOCOL set privacy protocol (DES|AES)

-X PASSPHRASE set privacy protocol pass phrase

-Z BOOTS,TIME set destination engine boots/time

General communication options

-r RETRIES set the number of retries

An snmpwalk example command

Example output of snmpwalk will retrieve all of the variables under system:

# % snmpwalk -v 1 localhost public system

Источник

Оцените статью