Siemens library implementation

Lukas1

Member
Join Date
Apr 2024
Location
Prague
Posts
3
Hi,
I have PLC S7-1200 and switch XC-208 and Iam trying to implement this SNMP library:
SIOS

I am not sure, what I am doing wrong, but there is no activity, even though there should be.
Get next is always FALSE, there are no OIDs and status info is either no job active or follow-up call of the command or time-out.
Can you please help me? Thank you!
Snímek obrazovky 2024-04-15 161430.png
Snímek obrazovky 2024-04-15 161516.png
 
That likely means that it has sent the request to the target and never received a response. Based on the code I see, it looks like GetNext is only active once it successfully reads the first time, which it hasn't.

Maybe this is done "off camera", but you need to be sure you've set the OID and community string. I see those commented in your first screenshot, but with no assignment. There may be a sane default for the community string (very likely your device is at the default of public or private), but if there is a default OID it may not be valid for your

It could also be something super mundane like the IP address is wrong, or the PLC has no valid network path, SNMP is disabled on the device, etc. Oh, also, I think the library only supports v1/v2 of the SNMP protocol, the switches may default to something like V3 for security.
 
That likely means that it has sent the request to the target and never received a response. Based on the code I see, it looks like GetNext is only active once it successfully reads the first time, which it hasn't.

Maybe this is done "off camera", but you need to be sure you've set the OID and community string. I see those commented in your first screenshot, but with no assignment. There may be a sane default for the community string (very likely your device is at the default of public or private), but if there is a default OID it may not be valid for your

It could also be something super mundane like the IP address is wrong, or the PLC has no valid network path, SNMP is disabled on the device, etc. Oh, also, I think the library only supports v1/v2 of the SNMP protocol, the switches may default to something like V3 for security.
Oh, thank you. The mistake was, that I forgot to set OID and community string, now it seems like everything is fine.
I am a begginer to PLC, so I wont maybe ask correctly. From this library, I am expecting some demonstration of monitoring/ controlling network traffic, which goes through that switch. What should I read from that output numbers?

Snímek obrazovky 2024-04-15 182020.png
 
The app example below shows one way to use the SNMP blocks, with a wireless card.

You need to know the OID you want to request, which is a string of numbers that maps to some data in the SNMP server. One way to get this is via a MIB Browser. SNMPB is a free one out there, but it's a hobbyist project so it isn't exactly the most user friendly for beginners. Several companies have options that cost a little money, and may offer free trials. You can either load MIBs in and browse the tree, or use an walk to scan through all the OIDs of a device.

A MIB is a file that tells a MIB Browser what OIDs exist, so that you can browse them. There are many public MIBs related to networking standards. The switch's private MIB (data that Siemens has added on top of the public data) can be downloaded from the switch's webpage. If you want to change config info, you can also download the startup config from the switch and search through it, because it stores the config data in OID format.

Some OIDs are simple variables (INT/String/etc), some OIDs are whole tables that have several instances of an OID. Example, there might be a different instance for each device in the ARP table of the switch, and then each instance holds the data for that specific device. Could be something.1.1 for the IP of the first device, something.1.2 for the IP of the 2nd device, something.2.1 for the MAC of the first device, etc. You can either get-next your way through the whole table, or try to request specifically what you need based on known instance numbers.
 
The app example below shows one way to use the SNMP blocks, with a wireless card.

You need to know the OID you want to request, which is a string of numbers that maps to some data in the SNMP server. One way to get this is via a MIB Browser. SNMPB is a free one out there, but it's a hobbyist project so it isn't exactly the most user friendly for beginners. Several companies have options that cost a little money, and may offer free trials. You can either load MIBs in and browse the tree, or use an walk to scan through all the OIDs of a device.

A MIB is a file that tells a MIB Browser what OIDs exist, so that you can browse them. There are many public MIBs related to networking standards. The switch's private MIB (data that Siemens has added on top of the public data) can be downloaded from the switch's webpage. If you want to change config info, you can also download the startup config from the switch and search through it, because it stores the config data in OID format.

Some OIDs are simple variables (INT/String/etc), some OIDs are whole tables that have several instances of an OID. Example, there might be a different instance for each device in the ARP table of the switch, and then each instance holds the data for that specific device. Could be something.1.1 for the IP of the first device, something.1.2 for the IP of the 2nd device, something.2.1 for the MAC of the first device, etc. You can either get-next your way through the whole table, or try to request specifically what you need based on known instance numbers.
Thanks, for your advice. I am working from school devices on this, so downloading that SnmpB is not so easy for me.
I managed to upload MIB file from WBM of that switch to the different MIB file and it seems to be fine.

Now my problem is, that the only OID, which I can use is that predefined one in TIA (1.3.6.1.2.1.1.5.0), the response is "sysname not set" (I assume thats ok).
Any other OID, which I have tried are giving me status error 8502, which is not defined in documentation of the library. In fact, it is defined like 16#85xx: SNMP error received from partner. The SNMP error code is output in the lower byte and "diagnostics.subfunctionStatus".

On the internet, the only mention about this error is for G120X converter (G120X error 8502 "duration of the strobe pulse is exceeded" - 265102 - Industry Support Siemens), I am not sure if it is valid for switch and if yes, what should I try to check/repair.

Can you please help me with this problem? Thank you.

And maybe assure me, that solving this task with SNMP is correct: PROFINET communication and diagnostics to the controller
 
Thanks, for your advice. I am working from school devices on this, so downloading that SnmpB is not so easy for me.

Meaning the school won't let you install any software at all? SnmpB is open source/free, if cost is the issue.
Now my problem is, that the only OID, which I can use is that predefined one in TIA (1.3.6.1.2.1.1.5.0), the response is "sysname not set" (I assume thats ok).
Any other OID, which I have tried are giving me status error 8502, which is not defined in documentation of the library. In fact, it is defined like 16#85xx: SNMP error received from partner. The SNMP error code is output in the lower byte and "diagnostics.subfunctionStatus".
"sysname not set" is i think the factory default text for the sysname of a switch, that is probably correct.

"The SNMP error code is output in the lower byte" What that text is saying is if you see an error in the form of 85XX, then whatever fills in the XX is an error code from the SNMP protocol. Google lead me to this, which indicates that SNMP error code 02 means "Bad OID".


Finding the OID you want to access really is a big part of the TO DO for SNMP. It's like talking to a PLC without knowing what tag you want.

And maybe assure me, that solving this task with SNMP is correct: PROFINET communication and diagnostics to the controller
Ultimately, what problem are you trying to solve? Can you get network info from the switch via SNMP? yes. Does the PLC already have some diagnostics built in? Also yes. 1200 has less than 1500, but if you say what you're trying to do we might be able to help you get it via the PLCs system instructions.
 

Similar Topics

Hi all I need your help I have a project to connect a 1500 plc to a http connection I can’t seem to find the Lhttp_get or post instructions in...
Replies
2
Views
1,625
Hi. I would like to tell you about a modbus library I released recently, for Siemens S7-1200 PLC's. I made concept that called Station block...
Replies
0
Views
1,524
Can anyone give me a link so i can download ti to import the Library into the Pilz Safety software.
Replies
17
Views
40,765
hi, Could someone propose me a dotnet(C#) library(direct driver) which can communicate with siemens S5-316(memory mapping,read and write data...
Replies
0
Views
1,640
Not sure quite how to ask what i need an answer to without getting confusing! Basically i am creating some libraries I want when these libraries...
Replies
0
Views
6,300
Back
Top Bottom