Tags: 
M2M API
3rd party HW-SW

NETIO devices allow reading of outputs states and values of electrical measurements via SNMPv3 (SNMP get) and control of PDU outputs (SNMP set). AN59 describes how to implement reading and writing using SNMP v3 in MS Windows and Linux.

Do you have any questions?

Using the SNMP protocol, it is possible to get states of individual sockets, measure current consumption or control outputs. SNMP is a standard protocol for many third-party application monitoring softwares.

NETIO devices use default port 161 for communication via SNMP. The MIB file with objects descriptions can be downloaded from the web administration in the SNMP protocol settings.

SNMP v3 is supported by following NETIO devices:

 

 

Linux:
In Linux, utilities such as snmpwalk, snmpget or snmpset from the snmp package (http://www.net-snmp.org/) can be used for SNMP communication. For a brief installation manual, see the “Installing the Net-SNMP utility in Linux” section at the end of this document..

 

Windows:
In Windows, utilities such as SnmpWalk, SnmpGet or SnmpSet by the EZ Systems (https://ezfive.com/snmpsoft-tools) can be used for SNMP communication. The utilities are free-of-charge for non-commercial use. These utilities don’t work with MIBs, only with OIDs.

 

 

 

 

 

 

 

 

 

 

Objects in NETIO SNMP MIB

Monitoring (read access)

 

Object

OID

x – output number (1 - 8)

Type

Value example

Note

netioOutputID.x.0

1.3.6.1.4.1.47952.1.1.1.1.x.0

INTEGER

1

 

netioOutputName.x.0

1.3.6.1.4.1.47952.1.1.1.2.x.0

STRING

output_1

Based on user defined name

netioOutputState.x.0

1.3.6.1.4.1.47952.1.1.1.3.x.0

INTEGER

off(0), on(1)

 

netioOutputStateString.x.0

1.3.6.1.4.1.47952.1.1.1.4.x.0

STRING

"off", "on"

 

netioOutputLoad.x.0

1.3.6.1.4.1.47952.1.1.1.25.x.0

INTEGER

24

[W]

netioOutputEnergy.x.0

1.3.6.1.4.1.47952.1.1.1.26.x.0

INTEGER

13

[Wh]

netioOutputEnergyStart.x.0

1.3.6.1.4.1.47952.1.1.1.27.x.0

DateTime

2017-6-23,5:47:3.0,+0:0

Initial date and time. UTC based*

netioOutputCurrent.x.0

1.3.6.1.4.1.47952.1.1.1.28.x.0

INTEGER

195

[mA]

netioOutputPowerFactor.x.0

1.3.6.1.4.1.47952.1.1.1.29.x.0

INTEGER

534

Current power factor * 1000

netioOutputPhase.x.0

1.3.6.1.4.1.47952.1.1.1.30.x.0

INTEGER

120

Phase shift in range 0-360 [°]

netioOutputEnergyNR.x.0

1.3.6.1.4.1.47952.1.1.1.31.x.0

INTEGER

255

[Wh]

netioOutputReverseEnergy.x.0

1.3.6.1.4.1.47952.1.1.1.32.x.0

INTEGER

140

[Wh]

netioOutputReverseEnergyNR.x.0

1.3.6.1.4.1.47952.1.1.1.33.x.0

INTEGER

620

[Wh]

netioVoltage

1.3.6.1.4.1.47952.1.2.1.0

INTEGER

239100

Voltage in the power grid [mV]

netioFrequency

1.3.6.1.4.1.47952.1.2.2.0

INTEGER

49900

Frequency in the power grid [mHz]

netioTotalCurrent

1.3.6.1.4.1.47952.1.2.3.0

INTEGER

195

[mA]

netioOverallPowerFactor

1.3.6.1.4.1.47952.1.2.4.0

INTEGER

534

Current power factor * 1000

netioTotalLoad

1.3.6.1.4.1.47952.1.2.5.0

INTEGER

24

[W]

netioTotalEnergy

1.3.6.1.4.1.47952.1.2.6.0

INTEGER

13

[Wh]

netioEnergyStart

1.3.6.1.4.1.47952.1.2.7.0

DateTime

2017-6-23,5:47:3.0,+0:0

Initial date and time. UTC based

netioTotalPhase

1.3.6.1.4.1.47952.1.2.8.0

INTEGER

120

[°]

netioTotalReverseEnergy

1.3.6.1.4.1.47952.1.2.9.0

INTEGER

420

[Wh]

netioTotalEnergyNR

1.3.6.1.4.1.47952.1.2.10.0

INTEGER

3200

[Wh]

netioTotalReverseEnergyNR

1.3.6.1.4.1.47952.1.2.1.1.0

INTEGER

1020

[Wh]

netioInputID.x.0

1.3.6.1.4.1.47952.1.3.1.1.x.0

INTEGER

1

 

netioInputName.x.0

1.3.6.1.4.1.47952.1.3.1.2.x.0

STRING

Input 1

Based on user defined name

netioInputState.x.0

1.3.6.1.4.1.47952.1.3.1.3.x.0

INTEGER

off(0), on(1)

 

netioInputStateString.x.0

1.3.6.1.4.1.47952.1.3.1.4.x.0

STRING

"off", "on"

 

netioInputS0Counter.x.0

1.3.6.1.4.1.47952.1.3.1.5.x.0

INTEGER

30

Number of S0 pulses

*: The start time that Energy (cumulated consumption) is counted from. The value is the same for all outputs.

Note: Metered values are available only for device with metering support. Other devices return value “0”.

 

Control (write)

Object

OID

x – output number (1 - 8)

Type

Value

Action

netioOutputAction.x.0

1.3.6.1.4.1.47952.1.1.1.5.x.0

INTEGER

0

1

2

3

4

5

Turn OFF

Turn ON

Short OFF delay (restart)

Short ON delay

Toggle (invert the state)

No change

 

Examples

SET 1.3.6.1.4.1.47952.1.1.1.5.2.0 = 1           Output 2 = ON

SET 1.3.6.1.4.1.47952.1.1.1.5.1.0 = 4           Toggle Output 1

SET 1.3.6.1.4.1.47952.1.1.1.5.8.0 = 0           Output 8 = OFF

 

Net-SNMP utility for Linux

The following examples use the Net-SNMP utility. If you don’t have it already, you can easily install – see the “Installing the Net-SNMP utility for Linux” section at the end of this document.

Default MIB directories are: /root/.snmp/mibs, /usr/share/snmp/mibs/, /usr/share/snmp/mibs/iana/, /usr/share/snmp/mibs/ietf/, /usr/share/mibs/site/, /usr/share/snmp/mibs/, /usr/share/mibs/iana/, /usr/share/mibs/ietf/, /usr/share/mibs/netsnmp

We recommend to rename the NETIO MIB downloaded from the NETIO web administration to NETIO-PRODUCTS-NETIO-MIB and store it to /usr/share/snmp/mibs/ (the recommended default directory), in order to be consistent with the following examples.

Besides the NETIO MIB, the following MIBs are also required:
SNMPv2-SMI
SNMPv2-TC

For details about getting them, see the “Installing the Net-SNMP utility for Linux” section at the end of this document. 

SNMP utility for Windows

The examples use utilities from SnmpSoft Company (https://ezfive.com/snmpsoft-tools/). The programs can be used free of charge for non-commercial use.

It si simple as downloading the individual utilities, unpacking them and use. For proper function, you must run the utility from the folder where the utility is stored (or add to the PATH).

Note: The SnmpGet and SnmpSet utilities do work with MIBS, only with OIDs.

 

 

SNMP v3 settings

In the device web administration go to M2M API Protocols section, enable SNMP, select SNMP v3 version and set the following:

  • Enable SNMP – Enable/disable M2M API protocol
  • SNMP version
    • 3 – SNMP v3 uses authorization and encryption, allows monitoring and control
  • Location – Optional, description of NETIO device physical location
  • Security name – username used for authentication
  • Security level – security levels supported by SNMP agent
    • authPriv - Communication with authentication and privacy. Protocols used are MD5 and SHA for authentication and AES (AES-128) for privacy.
    • authNoPriv - Communication with authentication and without privacy. The protocols used for Authentication are MD5 and SHA.
    • noAuthnoPriv - Communication without authentication and privacy.
  • Auth protocol – Authorization protocol used
  • Auth key – Password used for authorization
  • Priv protocol – Privacy protocol used
  • Priv key – Password used for privacy
  • SNMP port is 161, can’t be edited.
  • Download MIB file (button) – download of NETIO MIB file

Confirm changes by hitting Save Changes button.

 

MIB file download

Click the Download MIB file button to get the MIB file for NETIO devices.
 

 

Examples of using SNMP v3

Listing all states/values (SNMP v3 - snmpwalk)

Linux - using MIB

snmpwalk -m <NETIO MIB name> [optionally -M <path to MIB>] -v <SNMP version: 3> -a <protocol: MD5|SHA> -A <Password> -I <Security: authNoPriv|authPriv> -u <Username> -x <Encryption: DES|AES> -X <Password> <NETIO IP address> <subtree specification: NETIOProducts>

Example:

snmpwalk -m NETIO-PRODUCTS-NETIO-MIB -v 3 -a SHA -A netiopass -l authPriv -u netio -x AES -X netiopass 192.168.101.159 NETIOProducts
  • snmpwalk v Linux, SNMP v3

If the MIBs are stored in other than the default directory (see above), the -M option with the path needs to be specified, too:

snmpwalk -m NETIO-PRODUCTS-NETIO-MIB -M /usr/share/snmp/mibs/ -v 3 -a SHA -A netiopass -l authPriv -u netio -x AES -X netiopass 192.168.101.159 NETIOProducts

 

Windows

SnmpWalk.exe -r:<NETIO IP address> -v:<SNMP version: 3> -sn:<Username> -ap:<protocol: MD5|SHA> -aw:<Password> -pp:<Encryption: DES|AES128> -pw:<Password> 

Example:

SnmpWalk.exe -r:192.168.101.159 -v:3 -sn:netio -ap:SHA -aw:netiopass -pp:AES128 -pw:netiopass
  • SnmpWalk ve Windows, SNMP v3

 

Displaying a specific value (SNMP v3)

Linux - using MIB and object name

snmpget -m <NETIO MIB name> [optionally -M <path to MIBs>] -v <SNMP version: 3> -a <protocol: MD5|SHA> -A <Password> -I <Security: authNoPriv|authPriv> -u <Username> -x <Encryption: DES|AES> -X <Password> <NETIO IP address> <Object to read according to the table above> 

Example – displaying the status of output No. 1:

snmpget -m NETIO-PRODUCTS-NETIO-MIB -v 3 -a SHA -A netiopass -l authPriv -u netio -x AES -X netiopass 192.168.101.159 netioOutputState.1.0
  • snmpget s MIB v Linux, SNMP v3

If the MIBs are stored in other than the default directory (see above), the -M option with the path needs to be specified, too:

snmpget -m NETIO-PRODUCTS-NETIO-MIB -M /usr/share/snmp/mibs/  -v 3 -a SHA -A netiopass -l authPriv -u netio -x AES -X netiopass 192.168.101.159 netioOutputState.1.0

 

Linux - using OID

snmpget -v <SNMP version: 3> -a <protocol: MD5|SHA> -A <Password> -I <Security: authNoPriv|authPriv> -u <Username> -x <Encryption: DES|AES> -X <Password> <NETIO IP address> <OID to read according to the table above>

Example – displaying the status of output No. 1:

snmpget -v 3 -a SHA -A netiopass -l authPriv -u netio -x AES -X netiopass 192.168.101.159 1.3.6.1.4.1.47952.1.1.1.3.1.0
  • snmpget s OID v Linux, SNMP v3

 

Windows - using OID

SnmpGet.exe -r:<NETIO IP address> -v:<SNMP version: 3> -sn:<Username> -ap:<protocol: MD5|SHA> -aw:<Password> -pp:<Encryption: DES|AES128> -pw:<Password> -o:<OID to read according to the table above>

Displaying the status of output No. 1:

SnmpGet.exe -r:192.168.101.159 -v:3 -sn:netio -ap:SHA -aw:netio -pp:AES128 -pw:netio -o:1.3.6.1.4.1.47952.1.1.1.3.1.0
  • SnmpGet ve Windows, SNMP v3

 

Controlling an output using SNMP v3 (AES 128)

Linux – using MIB and object name

snmpset -m <NETIO MIB name> [optionally -M <path to MIB>] -v <SNMP version: 3> -a <protocol: MD5|SHA> -A <Password> -I <Security: authNoPriv|authPriv> -u <Username> -x <Encryption: DES|AES> -X <Password> <NETIO IP address> <Object to write according to the table above> <corresponding Type> <Value>

Example: Turn ON Output No. 1:

snmpset -m NETIO-PRODUCTS-NETIO-MIB -v 3 -a SHA -A netiopass -l authPriv -u netio -x AES -X netiopass 192.168.101.159 netioOutputAction.1.0 i 1
  • snmpset s MIB a jménem objektu v Linux, SNMP v3

If the MIBs are stored in other than the default directory (see above), the -M option with the path needs to be specified, too.snmpset -m NETIO-PRODUCTS-NETIO-MIB -M 

snmpset -m NETIO-PRODUCTS-NETIO-MIB -M /usr/share/snmp/mibs/  -v 3 -a SHA -A netiopass -l authPriv -u netio -x AES -X netiopass 192.168.101.159 netioOutputAction.1.0 i 1

 

Linux - using OID

snmpset m <NETIO MIB name> [optionally -M <path to MIB>] -v <SNMP version: 3> -a <protocol: MD5|SHA> -A <Password> -I <Security: authNoPriv|authPriv> -u <Username> -x <Encryption: DES|AES> -X <Password> <NETIO IP address> <Object to write according to the table above> <corresponding Type> <Value>

Example: Turn ON Output No. 1:

snmpset -v 3 -a SHA -A netiopass -l authPriv -u netio -x AES -X netiopass 192.168.101.159 1.3.6.1.4.1.47952.1.1.1.5.1.0 i 1
  • snmpset s OID v Linux, SNMP v3

 

Windows - using OID

SnmpSet.exe -r:<NETIO IP address> -v:<SNMP version: 3> -sn:<Username> -ap:<protocol: MD5|SHA> -aw:<Password> -pp:<Encryption: DES|AES128> -pw:<Password> -o:<OID to read according to the table above> -val:<Value> -tp:<corresponding Type>

Example: Turn ON Output No. 1:

SnmpSet.exe -r:192.168.101.159 -v:3 -sn:netio -ap:SHA -aw:netiopass -pp:AES128 -pw:netiopass -o:1.3.6.1.4.1.47952.1.1.1.5.1.0 -val:1 -tp:int
  • SnmpSet ve Windows, SNMP v3

 

KS Soft MIB Browser

The MIB Browser utility by the K5 Soft package allows you to view structure of MIB files. For NETIO devices, it is possible to load a MIB file downloaded from any NETIO device and use it to communicate with the device.

The software allows (using MIB or not) reading and browsing variables in the device (ie. snmpget and snpwalk). The utility does not allow SNMP v3 write.

Loading the MIB file

In order to display MIB structure, first load the MIB file obtained from NETIO device (described in the chapters above). It can be loaded using the “Append MIB file” in the “File” tab. After selecting the option, find the file on your drive and confirm.

 

After successfully loading the file, click on “netio4” folder within the tree structure.
The path from the root directory is : iso.org.dod.internet.private.enterprises.netioProducts.netio4.

The “netio4” folder contains following objects:

  • netioOutputTable & netioOutputEntry - Contains information related to outputs
  • netioGlobalMeasure – Contains measurements for the entire device (available only for specific devices)
  • NetioInputTable s netioInputEntry – Contains information related to digital inputs (available only for specific devices)

Click on a variable (marked with a green & yellow arrows) to display its information.

  • MIB Browser – struktura MIB

 

KS Soft MIB Browser SNMP configuration

You can add devices by clicking on “Table” in the “View” tab.

  • MIB Browser – nastavení

By default, localhost is displayed as the Target system. It needs to be modified to IP address where the NETIO device is located. This can be done by clicking on the "book" to the right of the device description. In the popup window, change the IP address and click on the "book" to the right of "Profile" again. Here, by clicking on “new”, create a new profile, and fill in the following information analogous to the protocol settings in the device administration:

Variable name

NETIO variable name

Value

Profile name

 

optional

SNMP version

SNMP version

SNMP v3

Username

Security name

user-defined, required

Context

 

empty

Authorization

Auth protocol

SHA

Auth password

Auth key

user-defined, required

Privacy type

Priv protocol

AES

Privacy password

Priv key

user-defined, required

  • MIB Browser – nastavení

After successfully setting up the device, it is possible to view its general information using the "SysInfo" button:

  • MIB Browser – Systémové informace

 

SNMP GET in KS Soft MIB Browser

After entering target OID (obtained from the MIB structure), we can use the "Get" button to display values of individual objects in the device.

  • MIB Browser – snmpget

 

SNMP WALK in KS Soft MIB Browser

All objects in the device, the so-called SNMP WALK, can be obtained via the “Table” option in the “View” tab. This can be achieved by entering OID for the entire NETIO device: 1.3.6.1.4.1.47952.1. (the path can also be reached by clicking on netio4 in the tree structure). Click on "Get" to start the command. A table of all values marked with OIDs is displayed (below the table).

  • MIB Browser – snmpwalk

 

Installing the Net-SNMP utility for Linux

Tested on Debian GNU/Linux 8.

 

-> Install the snmp package

http://net-snmp.sourceforge.net/wiki/

https://wiki.debian.org/SNMP

 

Then, the following two MIBs are needed:

SNMPv2-SMI

SNMPv2-TC

-> Install the snmp-mibs-downloader package

-> Run download-mibs

MIBs are stored to /var/lib/mibs/ietf

-> Copy the two above-mentioned MIBs to /usr/share/snmp/mibs/ (recommended default directory)

 

NETIO MIB – downloaded from the NETIO web administration interface

-> Rename to NETIO-PRODUCTS-NETIO-MIB (recommended in order to simplify the use of our examples)

-> Store to /usr/share/snmp/mibs/ (recommended default directory)

FAQ:

1) Read/write functions do not work (Authentication or Privacy Error)

NETIO devices support following types of encryption protocols:

Authentication protocol:        SHA, MD5

Privacy protocol:                     AES128

Not supported: DES, 3DES, AES192, AES256

 

2) Why is not recommended to control devices using SNMP v1 / v2c?

SNMP v1 and v2c protocols do not use authorization and encryption. Writing using these versions is therefore not secure. Control access cannot be restricted for authorized users only. For reading, SNMP v1 / v2c can be used, however for writing (output control) we strongly recommend using SNMP v3.

 

Ask for a price or technical parameters

For device testing use name/password demo/demo