I have the gateway receiving SNMP traps (through Kymera’s SNMP driver) and initially I converted the trap message to a string and wrote it to a String tag. The tag stores it, but the historian refuses to take it, throwing errors that the string is too long. I tried splitting the trap into 2 parts, but it would still sometimes be too long and wouldn’t store in history…
java.lang.RuntimeException: java.sql.BatchUpdateException: String or binary data would be truncated in table '*********************************************', column 'stringvalue'. Truncated value: '{1.3.6.1.4.1.9.9.41.1.2.3.1.5.456: Interface GigabitEthernet0/17, changed state to down, 1.3.6.1.6.3'.
(Table name has been removed from above log message)
I then tried changing the tag type to Document and storing the information as a json. The tag write is successful again, but now I get this error:
java.lang.RuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from UNKNOWN to VARCHAR is unsupported.
If neither a longer string or a json tag are able to store history, the only way I see to move forward is to either brake down the trap into even smaller bits and write to multiple tags, or to store the trap string and the timestamp myself with a named query…
Has anyone had similar problems with storing tag history? Is there some detail that i’m missing or something that I’ve misconfigured?
The historian uses VARCHAR(255), or the equivalent of your flavor of SQL. You could try changing that, but its probably not a good idea, especially not if you have partitioning enabled. You could write your data to a table of your own design with scripting.
Hello @Daniel.Snyder I'm new on SNMP traps, would you mind sharing your knowledge or any documentation on how to integrate them to Ignition please. It would be really appreciated.
I didn't really end up utilizing traps, so I'm not an expert in them either.
To set up SNMP traps, you need SNMP agents and an SNMP manager. The agents send the traps, and the manager is a server that can receive them. Capable networked devices can be set up to act as agents, and you have to configure them to know what events to alert on and where to send those alerts. The specific details of what that looks like will differ between vendors and types of devices.
If you already have agents configured, and want a manager in Ignition, you could:
utilize an existing 3rd party module, such as Kymera's SNMP driver. Kymera's solution will fire a script whenever a trap is received and it is up to you to write the code and decide what to do with the contents.
Hello @Daniel.Snyder, thank you so much for your response. Actually, I have configured UPS as SNMP agents and I'm using the Kymera's SNMP driver, I'm curious about the fired script that you mentioned. I guess there are some system funcitons to use, do you have any aproach or example about that?
You should really reach out to Kymera; they can give you up-to-date advice and documentation on their module. Also, I believe @Kyle_Chase is from Kymera and a user of the forum if he wants to chime in.
In the designer, under scripting, you'll have Snmp Events, which open up their script workspace. In there, you can add a script, and then fill in with available functions from the "binding" icon in the top-right. Basically, all the information is in a trapParameters variable that has a bunch of "getter" methods. Here's an example script: