We not have any SNMP to Modbus converter, but our SlimLine and Netsyst products can manage the SNMP protocol. We have developped the eLLabSNMPLib library for that purpose. This topic (Unfortunaltely it’s in Italian) treats the argument with a source code example, the example contains also the library. In the library you can found 2 FBs.
The SNMPAgent FB, allows the systems to act as SNMP agent, so they can be reached by any standard SNMP manager programs (i.e. Nagios, Cacti, etc..). By program it’s possible to define all the OIDs must be published and assign to them any program variables. Here an example:
VDefs.Type:=16#02; (* Variable type (Integer) *)
VDefs.Writable:=TRUE; (* The variable can be written *)
VDefs.OID:=ADR(‘1.3.6.1.4.1.36955.1’); (* OID definition *)
VDefs.Address:=ADR(Value); (* Variable address *)
VDefs.Length:=SIZEOF(Value); (* Variable length *)
The SNMPManager FB, allows the system to act as SNMPManager, with this FB you can read any OID from any systems, you define the IP address, the Community, the OID and the type of variable to be read. The FB reads the OID value and stores the result on the defined program variable. Here an example:
SNMPMng.Address:=ADR(‘192.168.0.184’); (* Agent address *)
SNMPMng.Community:=ADR(‘public’); (* Community *)
SNMPMng.VType:=16#04; (* Variable type (Octect string) *)
SNMPMng.OID:=ADR(‘1.3.6.1.4.1.36955.2’); (* OID to be read *)