Перейти к содержанию

Навигация

SNMP/en: различия между версиями

м
FuzzyBot переименовал страницу Драйвер SNMP/en в SNMP/en без оставления перенаправления: Часть переводимой страницы Драйвер SNMP.
(Новая страница: «== Templates ==»)
м (FuzzyBot переименовал страницу Драйвер SNMP/en в SNMP/en без оставления перенаправления: Часть переводимой страницы Драйвер SNMP.)
 
(не показано 13 промежуточных версий 1 участника)
Строка 158: Строка 158:
== Templates ==
== Templates ==


Для описания устройств удобно (хотя и не обязательно) использовать ''шаблоны''. ''Шаблон (тип устройства)'' - это внешний конфигурационный файл (располагается в /usr/share/wb-mqtt-snmp/templates  
It is convenient (though not necessary) to use templates to describe devices. The template (device type) is an external configuration file (located in /usr/share/wb-mqtt-snmp/templates and named config-[device-type-name].json, for example, config-test-snmp.json), which contains a basic description of the device (such as the SNMP community name) and a basic description of all its channels.
и имеет имя config-[device-type-name].json, например, config-test-snmp.json), в котором содержится базовое описание устройства (например, имя сообщества SNMP) и базовое описание всех его каналов.


Для использования шаблона в описании устройства в конфигурационном файле укажите поле "''device_type''". Среди всех представленных шаблонов будет выбран шаблон с таким же значением ''device_type'', при этом
To use the template in the device description in the configuration file, specify the field ''''device_type''''. Among all presented templates, a template with the same ''device_type'' value will be selected, and all fields that were not defined in the configuration file will take values from the template.
все поля, которые не были определены в конфигурационном файле, примут значения из шаблона.


Точно так же это работает с каналами. Сравнение каналов происходит по обязательному полю ''name''; если имя канала из конфигурационного файла совпадёт с именем канала в шаблоне, из шаблона будут взяты
It works the same way with channels. The channels are compared by the mandatory field name; if the channel name from the configuration file matches the channel name in the template, all unspecified values will be taken from the template.
все неуказанные значения.


=== Пример ===
=== Example ===


Шаблон config-my-device.json:
Config-my-device.json template:


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
Строка 189: Строка 186:
</syntaxhighlight>
</syntaxhighlight>


Конфигурационный файл:
Configuration file:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
{
{
Строка 215: Строка 212:
</syntaxhighlight>
</syntaxhighlight>


В данном случае мы описали один шаблон my-device, по которому определили два разных устройства ''Device 1'' и ''Device 2'' с одинаковым набором каналов.
In this case, we have described one my-device template, by which we have defined two different devices Device 1 and Device 2 with the same set of channels.


Поскольку ''Device 1'' находится в локальной сети, логично выставить ему небольшое значение таймаута, чтобы быстрее определить неисправность устройства. Все остальные настройки берутся из шаблона.
In this case, we have described one my-device template, by which we have defined two different devices Device 1 and Device 2 with the same set of channels.


''Device 2'' - удалённый сервер, потому для него стоит увеличить таймаут, чтобы не считать устройство неисправным при задержке пакета. Более того, для канала ''Channel 2'' здесь мы переопределяем
Since Device 1 is on the local network, it is logical to set it a small timeout value to quickly determine the malfunction of the device. All other settings are taken from the template.
интервал опроса на бОльший, чтобы снизить нагрузку на сеть.


Таким образом, шаблоны очень удобно использовать для описания группы однотипных устройств.
Device 2 and the remote server, because for him, it is necessary to increase the timeout to not think the device is faulty if the delay of the package. What's more, for channel 2 here, we are redefining the polling interval to a larger one to reduce the load on the network.


= Список шаблонов =
So, it is very convenient to use templates to describe a group of similar devices.


В поставке wb-mqtt-snmp прилагается набор шаблонов для типовых устройств (список будет расширяться):
= Template list =
 
The WB-mqtt-snmp package includes a set of templates for typical devices (the list will be expanded):


{| class="wikitable"
{| class="wikitable"
|-
|-
! Устройство !! Имя шаблона !! Протестировано !! Комментарии
! Device !! Template !! Tested !! Comments
|-
|-
| Тестовый сервер Net-SNMP || test-snmp || style="background: #22EE44;" | Да || адрес тестового сервера test.net-snmp.org
| Test server  Net-SNMP || test-snmp || style="background: #22EE44;" | Yes || Test server address test.net-snmp.org
|-
|-
| APC UPS || apc-ups || Нет ||  
| APC UPS || apc-ups || Нет ||  
* Требуется локально установленный PowerNet-MIB
* Requires locally installed PowerNet-MIB
* Описание устройства такое же, как в wb-mqtt-apcsnmp
*   The device description is the same as in wb-mqtt-apcsnmp
|-
|-
|}
|}
wb_editors
14 355

правок