-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New opc ua client plugin #7213
New opc ua client plugin #7213
Conversation
cannot run Can someone help? |
Looks like you have it figured out? For that last failing test you need to add |
Did you need me to delete the .vscode/launch.json file? I forgot to do that prior to doing a pull request. Also, at what telegraf version will you release this plugin? |
very excited about this too. seems like a lot of users waiting for this plugin! |
Yes, looking forward to the final merge to the next release. |
Currently seeing the following error panic: runtime error: invalid memory address or nil pointer dereference goroutine 66 [running]: When trying to connect to an opc server. Using OPC simulator: With Telegraf config: [global_tags] [agent] [[outputs.file]] [[inputs.opcua_client]]
|
Chris, I'm not sure your setup enpoint has a valid IP address. Can you try localhost or 127.0.0.1 or the IP address to the container running your OPC UA server.
|
Same result with localhost and 127.0.0.1. To remove my simulator as a possibility, I tried configuring it to work with a separate KEPWare based simulator, too. Getting the same result there. The Telegraf config I'm using for that: [global_tags] [agent] [[outputs.file]] [[inputs.opcua_client]] |
@haylesnortal Ok, let me review. I was able to replicate your original error. the good news is that I'm able to read the data point using the examples from the gopcua library...so will trace out the bug. |
@fdamador think I've got it...
That seemed to fix it. |
@fdamador Thanks for taking a look and the quick response. Much appreciated. |
Still seeing issues... this time, it reads the first value fine, but then it never updates. I can see the OPC sim values changing in my OPC browser, but Telegraf never sees updated values. I think it's because the only call to readvalues() is in the Connect() function. I'll play around with it, see what I can do. |
Understood, I made these modifications. Let me know if this is what you were thinking. |
It would be helpful to customize the incoming schema. Examples include adding custom tags and monitoring multiple fields per measurement. There won't always be a 1:1 relationship between a monitored OPC-UA node and the desired measuremnt in InfluxDB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the plugin! Have some feedback for you.
@@ -0,0 +1,18 @@ | |||
( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't commit these dot-files.
@@ -0,0 +1,6525 @@ | |||
# Telegraf Configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be committed.
# # Time Inteval, default = 100 * time.Millisecond | ||
# # interval = "10000000" | ||
# | ||
# # Security policy: None, Basic128Rsa15, Basic256, Basic256Sha256. Default: auto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default says auto, but text says "None" these should match
### Example Output: | ||
|
||
``` | ||
$ ./telegraf -config telegraf.conf -input-filter opcua_client -test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be actual example output, not the command to run to get the output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an example input/output would be very useful for this README
var err error | ||
|
||
o.Name = "testing" | ||
o.Endpoint = "opc.tcp://opcua.rocks:4840" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is hitting a remote service on the internet? can we store and mock the response instead?
TimestampsToReturn: ua.TimestampsToReturnBoth, | ||
} | ||
|
||
err = o.getData() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Connect should not call getData, gather already does this.
return err | ||
} | ||
|
||
o.ReadError = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any reason to reset these.
switch u.Scheme { | ||
case "opc.tcp": | ||
o.state = Disconnected | ||
o.client.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unset o.client here so you know you need to reconnect. and you can drop o.state.
} | ||
|
||
func disconnect(o *OpcUA) error { | ||
u, err := url.Parse(o.Endpoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no reason to parse the endpoint or check the scheme here.
} | ||
o.NodeData[i].Quality = d.Status | ||
o.NodeData[i].TimeStamp = d.ServerTimestamp.String() | ||
o.NodeData[i].Time = d.SourceTimestamp.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string timestamps are notoriously difficult to work with. Not sure why you'd convert to a string here.
@@ -0,0 +1,57 @@ | |||
# Telegraf Input Plugin: opcua_client | |||
|
|||
The opcua_client plugin retrieves data from OPCUA slave devices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace the term slave
with replica
, secondary
or any of the following suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I’ll replace with server to match industry standards nomenclature
@fdamador do you think you could test your plugin with the Prosys simulator? Was trying to troubleshoot with @haylesnortal last week and was getting various errors.
|
Awesome! Glad I could be of service. |
related #3041
Required for all PRs: