-
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
Opcua input plugin + authentication options #8009
Changes from all commits
36cda2c
610087b
8bf22b6
f89e30f
925887c
32ed4de
82f20c4
2f734bd
814d554
140873c
26c3c6b
8ce0858
0bb927b
bb1055b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Telegraf Input Plugin: opcua_client | ||
|
||
The opcua_client plugin retrieves data from OPCUA slave devices | ||
|
||
### Configuration: | ||
|
||
```toml | ||
|
||
sjwang90 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# ## Connection Configuration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clean up the comments in the example config here and in sampleConfig. They need to match the commenting and indentation style because they are used when generating a config. See https://github.com/influxdata/telegraf/wiki/SampleConfig Accurate default values should be included here and commented out with a single hash. Documentation is commented out with two hashes, not hash space hash hash |
||
# ## | ||
# ## The plugin supports connections to PLCs via OPCUA | ||
# ## | ||
# ## Device name | ||
name = "opcua_rocks" | ||
# | ||
# # OPC UA Endpoint URL | ||
endpoint = "opc.tcp://opcua.rocks:4840" | ||
sjwang90 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# | ||
# ## Read Timeout | ||
# ## add an arbitrary timeout (seconds) to demonstrate how to stop a subscription | ||
# ## with a context. | ||
timeout = 30 | ||
# | ||
# # Time Inteval, default = 10s | ||
sjwang90 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
time_interval = "5s" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code in opcua_client.go says time_interval defaults to opcua.DefaultSubscriptionInterval. The gopcua docs say that's 100ms. https://godoc.org/github.com/gopcua/opcua#pkg-constants Which default is right? 10s, 5s, 100ms? |
||
# | ||
# # Security policy: None, Basic128Rsa15, Basic256, Basic256Sha256. Default: auto | ||
security_policy = "None" | ||
# | ||
# # Security mode: None, Sign, SignAndEncrypt. Default: auto | ||
security_mode = "None" | ||
# | ||
Comment on lines
+27
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include auto in the list of valid values. Don't set them to "None" in the sample config if they default to auto. Also, where in the code do these default to auto? I didn't find it in a quick review. |
||
# # Path to cert.pem. Required for security mode/policy != None. If cert path is not supplied, self-signed cert and key will be generated. | ||
# # certificate = "/etc/telegraf/cert.pem" | ||
# | ||
# # Path to private key.pem. Required for security mode/policy != None. If key path is not supplied, self-signed cert and key will be generated. | ||
# # private_key = "/etc/telegraf/key.pem" | ||
# | ||
# # To authenticate using a specific ID, select chosen method from 'Certificate' or 'UserName'. Else use 'Anonymous.' Defaults to 'Anonymous' if not provided. | ||
# # auth_method = "Anonymous" | ||
# | ||
# # Required for auth_method = "UserName" | ||
# # username = "myusername" | ||
# | ||
# # Required for auth_method = "UserName" | ||
# # password = "mypassword" | ||
# | ||
# ## Measurements | ||
# ## node id to subscribe to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use full sentences with punctuation and capitalization. |
||
# ## name - the variable name | ||
# ## namespace - integer value 0 thru 3 | ||
# ## identifier_type - s=string, i=numeric, g=guid, b=opaque | ||
# ## identifier - tag as shown in opcua browser | ||
# ## data_type - boolean, byte, short, int, uint, uint16, int16, uint32, int32, float, double, string, datetime, number | ||
# ## Template - {name="", namespace="", identifier_type="", identifier="", data_type="", description=""}, | ||
nodes = [ | ||
{name="ProductName", namespace="0", identifier_type="i", identifier="2261", data_type="string", description="open62541 OPC UA Server"}, | ||
{name="ProductUri", namespace="0", identifier_type="i", identifier="2262", data_type="string", description="http://open62541.org"}, | ||
{name="ManufacturerName", namespace="0", identifier_type="i", identifier="2263", data_type="string", description="open62541"}, | ||
] | ||
Comment on lines
+56
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this out of the sample config. It's a good config example and it makes sense to have it in the readme but we don't want to include it in everyone's config. |
||
|
||
## Guide: | ||
## An OPC UA node ID may resemble: "n=3,s=Temperature" | ||
## In this example, n=3 is indicating the namespace is '3'. | ||
## s=Temperature is indicting that the identifier type is a 'string' and the indentifier value is 'Temperature' | ||
## This temperature node may have a current value of 79.0, which would possibly make the value a 'float'. | ||
## To gather data from this node you would need to enter the following line into 'nodes' property above: | ||
## {name="SomeLabel", namespace="3", identifier_type="s", identifier="Temperature", data_type="float", description="Some description."}, | ||
Comment on lines
+62
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be in the sample config? Could bring it out as just plain text in the README There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds clearer to me too. Maybe make a subsection under configuration to describe how to use the nodes setting. See https://github.com/influxdata/telegraf/blob/master/plugins/inputs/EXAMPLE_README.md |
||
|
||
``` | ||
### Example Output: | ||
|
||
``` | ||
opcua,host=3c70aee0901e,name=Random,type=double Random=0.018158170305814902 1597820490000000000 | ||
chrishayles marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
``` |
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.
change "slave devices" to "client devices"