Function block for gathering SNMP values from managed switches
Available with AXC F 2152 and AXC F 3152
General concept
By means of this function block, SNMP values from managed switches with up to 8 ports can be read directly by the PLC via the SNMP protocol.
arrPartnerList
The IP addresses and the number of ports (maximum 16) of the managed switches must be applied to the arrPartnerList
input parameter. This input parameter is an Array of Struct with 30 elements, so that a maximum number of 30 IP addresses can be used. The proper syntax for an IP address is: ‘/IP=www.xxx.yyy.zzz’ (e.g. ‘/IP=192.168.0.21’).
xActivate
TRUE
at the xActivate
input parameter activates the function block. After the activation, the function block requests cyclically the SNMP values from the indicated managed switches. The desired scanning time can be adjusted via the iScanTimeSP
input parameter. The received SNMP values are stored at the arrSnmpInfo
output parameter.
FALSE
at the xActivate
input parameter deactivates the function block and requesting the SNMP values is stopped.
xError
The appearance of an error is indicated by the xError
output parameter. The wDiagCode
and wAddDiagCode
output parameters display the cause of the error. The values are valid within the cycle, in which the rising edge of the xError
output parameter occurred. The acknowledgment of an error message is carried out by a rising edge of the xQuit
input parameter.
Prerequisites
From the PLCnext Store, download the ASR AXC F 2152 or the ASR AXC F 3152 function block library (free of charge) and import it into PLCnext Engineer on your computer.
Description of inputs and outputs
Name |
Data type |
Data direction |
Description |
|
BOOL |
Input |
With
|
|
BOOL |
Input |
With a rising edge at this input parameter error messages, which occurred during requesting the SNMP values, are acknowledged. |
|
INT |
Input |
Desired scanning cycle time in seconds. |
|
ASR_ARR_PARTNER_LIST1_30 |
Input |
List of IP addresses and the number ports of the managed switches from which the SNMP values should be collected. This input parameter is an Array of Struct with 30 elements, so that a maximum number of 30 IP addresses can be used. |
|
BOOL |
Output |
|
|
BOOL |
Output |
This output indicates with a rising edge that an error has occurred. You can read the corresponding error codes at the |
|
WORD |
Output |
Indicates the cause of the error. |
|
DWORD |
Output |
Indicates additional information to the cause of the error. |
|
INT |
Output |
Actual scanning cycle time in seconds. |
|
ASR_ARR_SNMP_INFO_1_30 |
Output |
SNMP values from the specified managed switches. This output parameter is an Array of Struct, in which each field contains the SNMP values of a managed switch corresponding to the IP addresses at the |
Description of the elements of the SnmpInfo
structure
Most elements are available for each port and therefore presented in an array.
Name |
Data type |
Description |
|
UDINT |
Time in hundreds of seconds since the last reset of the managed switch. |
|
UDINT |
Current bandwidth of the port in bits per second. |
|
USINT |
Current operational state of the port. Typical possible values: |
|
UDINT |
Total number of received octets. |
|
UDINT |
Total number of received unicast packets. |
|
UDINT |
Total number of received broad and multicast packets. |
|
UDINT |
Total number of discarded inbound packets. |
|
UDINT |
Total number of inbound packets with errors. |
|
REAL |
Calculated inbound utilization in percent. |
|
UINT |
Calculated number of received broad and multicast packets per second. |
|
REAL |
Calculated error rate of received packets in percent. |
|
UDINT |
Total number of transmitted octets. |
|
UDINT |
Total number of transmitted unicast packets. |
|
UDINT |
Total number of transmitted broad and multicast packets. |
|
UDINT |
Total number of discarded outbound packets. |
|
UDINT |
Total number of outbound packets with errors. |
|
REAL |
Calculated outbound utilization in percent. |
|
UINT |
Calculated number of transmitted broad and multicast packets per second. |
|
REAL |
Calculated error rate of transmitted packets in percent. |
Error Codes
Error Code |
Description |
C401 |
Indicates that the syntax of an applied string for the IP address at the input parameter The acknowledgement of this error message is carried out at a rising edge of the |
C402 |
Indicates that the SNMP client function block reported an error while a SNMP request was sent to a managed switch. The output parameter The acknowledgement of this error message is carried out at a rising edge of the |
C403 |
Time-out detection of the internal state machine (3s). The output parameter The acknowledgement of this error message is carried out at a rising edge of the |