Virtual SNMP GET element

The virtual element snmpget is designed to read information from external equipment through the GET SNMP PDUThe sensor can be of analog or discrete. For the analog sensor, the value read by SNMP GET is converted to a numerical form. For a discrete sensor, the read value is compared with the string specified by the user, and according to the result of the comparison, its state is established.

Requests for managing virtual sensor snmpget analog:

addvirtual - add a virtual sensor. Extra options are:

  • k - user session ID;
  • id - the identifier of the element; if the identifier is absent, a new element is created; otherwise the existing one is modified;
  • name - the name of the element, the length is not more than 63 characters;
  • virtual_type - type of virtual sensor "snmpget analog";
  • vmax - maximum value for the measuring range;
  • vmin - minimum value for the measuring range;
  • low_alarm - threshold level for notification;
  • low_warning - threshold level for notification;
  • high_warning - threshold level for notification;
  • high_alarm - threshold level for notification;
  • hyst_type - the type of algorithm used to calculate the hysteresis:
    • disable - the hysteresis is disabled;
    • value - hysteresis by the value measured by the sensor value;
    • time - hysteresis using time (used by default).
  • hyst_value - the value of the deviation of the sensor value when calculating the hysteresis by value, the value with a floating point (minimum 0, maximum 10,000, default 0.3);
  • hyst_low_alarm - the time in seconds, during which the sensor should keep its value in this range, for transition of the sensor to this state (minimum 0, maximum 1000, default 1);
  • hyst_low_warning - same as previous (default 1);
  • hyst_normal - same as previous (default is 0);
  • hyst_high_warning - same as previous (default 1);
  • hyst_high_alarm - same as previous (default 1).
  • expr - expression for calculating the output value, by default "x";
  • um - unit of measurement of this element;
  • utype - custom type, defines the sensor icon: current, factor, frequency, humidity, power, temperature, vibration, voltage;
  • server - name or ip-address of the host, length is not more than 255 characters;
  • port - the port number (161 by default);
  • oid - numerical OID variable identifier, up to 255 characters in length;
  • period - the polling period, seconds;
  • version - protocol version, possible values: 1, 2c, 3 (default 2c);
  • comunity - a community with read access for the device being polled, up to 31 characters in length (for version 1 and 2c only);
  • usm_user - user name (for version 3 only);
  • sec_level - security level (for version 3 only), possible values:
    • 'noauth' - without authorization and encryption;
    • 'auth' - only authorization;
    • 'priv' - authorization and encryption;
  • auth_type - type of authorization (for version 3 only), possible values:
    • 'MD5';
    • 'SHA';
  • auth_pass - authorization password (for version 3 only), at least 8 characters;
  • priv_type - type of encryption (for version 3 only), possible values:
    • 'DES';
    • 'AES'
  • priv_pass - encryption password (for version 3 only), at least 8 characters.


Requests for managing virtual sensor snmpget discrete:

addvirtual - add a virtual sensor. Extra options are:

  • k - user session ID;
  • id - the identifier of the element; if the identifier is absent, a new element is created; otherwise the existing one is modified;
  • name - the name of the element, the length is not more than 63 characters;
  • virtual_type - type of virtual sensor "snmpget discrete";
  • utype - custom type, defines the sensor icon: current, factor, frequency, humidity, power, temperature, vibration, voltage;
  • reverse - inverse flag of sensor output (0 or 1), inverts sensor state;
  • control - the string with which the read value is compared, if the string is contained in value, the element has the state "normal", if not then the state is "alarm";
  • server - name or ip-address of the host, length is not more than 255 characters;
  • port - the port number (161 by default);
  • oid - numerical OID variable identifier, up to 255 characters in length;
  • period - the polling period, seconds;
  • version - protocol version, possible values: 1, 2c, 3 (default 2c);
  • comunity - a community with read access for the device being polled, up to 31 characters in length (for version 1 and 2c only);
  • usm_user - user name (for version 3 only);
  • sec_level - security level (for version 3 only), possible values: noauth, auth, priv;
  • auth_type - type of authorization (for version 3 only), possible values: MD5, SHA;
  • auth_pass - authorization password (for version 3 only);
  • priv_type - type of encryption (for version 3 only), possible values: DES, AES;
  • priv_pass - encryption password (for version 3 only).


If the new analog element is successfully created, the response is:

<error type="no error" id="216002" />

Or for discrete element:

<error type="no error" id="110004" />

When creating a new sensor (id is not specified), some parameters are mandatory - name, virtual_typevmax (for analog only), vmin (for analog only), server, port, version, community, oid, period. The rest of the query parameters are optional, and if not set, they will be set to the default values.

When editing an element, you can change individual fields.


delvirtual - remove the virtual sensor. Extra options:

  • k - user session ID;
  • id - ID of the element.


getelement - read the element. Extra options are:

  • k - the user session ID;
  • id - the ID of the item.

Information about the analog element looks like:

<element id="216001" index="12" module="2008" clas="analog" type="snmpget" name="virtual get 01" state="low warning" um="Volts" hwport="1" value="24.54" vmax="457.2" vmin="-24.0" low_alarm="13.0" low_warning="36.0" high_warning="174.0" high_alarm="197.0" expr="x*2" hyst_type="time" hyst_low_alarm="1" hyst_low_warning="1" hyst_normal="0" hyst_high_warning="1" hyst_high_alarm="1" hyst_value="0.300" period="20" server="192.168.0.25" port="161" version="2c" comunity="read" oid=".1.3.6.1.4.1.39052.1.3.1.9.203001" valuestr="12.27" status="working" >

<time t="1579681575" last="1579681475" period="1">

<d v="24.540" t="1579681574"/>

<d v="24.540" t="1579681573"/>

</time>

<time t="1579681575" last="1579681455" period="60">

<d v="24.540" t="1579681515"/>

<d v="24.540" t="1579681455"/>

</time>

<time t="1579681452" last="1579681452" period="3600">

</time>

<time t="1579681453" last="1579681453" period="86400">

</time>

</element>

Information about the discrete element looks like:

<element id="110001" module="2008" clas="discrete" type="snmpget" name="virtual get 02" state="normal" hwport="2" value="0" reverse="0" period="20" server="192.168.0.25" port="161" version="2c" comunity="read" oid=".1.3.6.1.4.1.39052.1.3.1.7.201001" control="Onboard" valuestr="Onboard Temperature" status="working" >

<time t="1579682300" last="0">

<d v="0" t="0" /><d v="0" t="1579682300" />

</time>

</element>

Additional read only fields is:

  • valuestr - read by SNMP GET value, used for discrete sensors;
  • status - server connection status.


Deprecated commands

This command is no longer supported.

addsnmpget - add a virtual snmpget device. Extra options are:

  • k - user session ID;
  • id - the identifier of the element; if the identifier is absent, a new element is created, otherwise the existing one is modified;
  • name - the name of the element, the length is not more than 63 characters;
  • period - the polling period (it is recommended not less than 60, the minimum value is 15);
  • server - name or ip-address of the host, length is not more than 255 characters;
  • port - the port number (161 by default);
  • version - protocol version, possible values: 1, 2c (default 2c);
  • comunity - a community with read access for the device being polled, up to 31 characters in length;
  • oid - OID variable identifier;
  • vartype - the type of the variable, is specified only when creating a new element, the corresponding output type for the virtual device is:
    • analog - analog (creating the element clas=analog, type=snmpget);
    • discrete - discrete (clas=discrete, type=snmpget);
  • expr - depending on vartype, length is not more than 79 characters:
    • for an analog variable, an expression of the form f(x), to calculate the real value (x by default);
    • for a discrete value - the string value of the norm at which the element is in the normal state (requires mandatory input).
  • low_alarm - lowdown alarm;
  • low_warning - lowdown warning;
  • high_warning - high warning;
  • high_alarm - high alarm;
  • The hysteresis parameters are also set, as described here: Analog sensors.


If a new element is successfully created, the response contains the element identifier, and looks like:

<error type="no error" id="505001" />

When creating a new element (id is not specified), when defining vartype=analog, the following parameters are mandatory: low_alarm, low_warning, high_warning, high_alarm. When defining vartype=discrete, these parameters can be omitted. The rest of the query parameters are mandatory, empty fields are not allowed.

When editing an item, you can change individual fields.