diff --git a/internal/opcua/util.go b/internal/opcua/util.go index 579ed088c8d79..e58f0796fedee 100644 --- a/internal/opcua/util.go +++ b/internal/opcua/util.go @@ -144,7 +144,6 @@ func pemBlockForKey(priv interface{}) (*pem.Block, error) { } } -//revive:disable-next-line func (o *OpcUAClient) generateClientOpts(endpoints []*ua.EndpointDescription) ([]opcua.Option, error) { opts := []opcua.Option{} appuri := "urn:telegraf:gopcua:Client" diff --git a/plugins/inputs/opcua/README.md b/plugins/inputs/opcua/README.md index 67cdd6e15270e..8805a6e4bd1c7 100644 --- a/plugins/inputs/opcua/README.md +++ b/plugins/inputs/opcua/README.md @@ -16,9 +16,9 @@ Plugin minimum tested version: 1.16 ## OPC UA Endpoint URL # endpoint = "opc.tcp://localhost:4840" # - ## The service set to use to retrieve/receive the values from the OPC UA server + ## The service set to use to retrieve/receive the values from the + ## OPC UA server. One of "request" or "subscribe" # connection_service = "request" - # connection_service = "subscribe" # ## Maximum time allowed to establish a connect to the endpoint. # connect_timeout = "10s" @@ -27,11 +27,9 @@ Plugin minimum tested version: 1.16 # request_timeout = "5s" # ## The interval at which the server should at least update its monitored items - ## https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.1/ ## Only used when connection_service = "subscribe" # subscription_interval = "100ms" # - # ## Security policy, one of "None", "Basic128Rsa15", "Basic256", ## "Basic256Sha256", or "auto" # security_policy = "auto" @@ -124,7 +122,6 @@ This node configuration produces a metric like this: ```text opcua,id=n\=3;s\=Temperature temp=79.0,quality="OK (0x0)" 1597820490000000000 - ``` ## Group Configuration @@ -162,6 +159,19 @@ This example group configuration has two groups with two nodes each: ] ``` +## Connection Service + +This plugin supports the Request and the Subscription service +to retrieve data from the OPC server. The difference between +these two services are described in the [OPC Foundation +Part 4 Chapter 5]( +https://reference.opcfoundation.org/v104/Core/docs/Part4/#5) + +The subscription service allows clients to set the set uses +maximum interval at which they want to receive updates. +This interval can be set through the `subscription_interval` +setting. + ## Metrics The metrics collected by this input plugin will depend on the @@ -169,7 +179,7 @@ configured `nodes` and `group`. ## Example Output -```shell +```text group1_metric_name,group1_tag=val1,id=ns\=3;i\=1001,node1_tag=val2 name=0,Quality="OK (0x0)" 1606893246000000000 group1_metric_name,group1_tag=val1,id=ns\=3;i\=1002,node1_tag=val3 name=-1.389117,Quality="OK (0x0)" 1606893246000000000 group2_metric_name,group2_tag=val3,id=ns\=3;i\=1003,node2_tag=val4 Quality="OK (0x0)",saw=-1.6 1606893246000000000 diff --git a/plugins/inputs/opcua/read_client_test.go b/plugins/inputs/opcua/read_client_test.go deleted file mode 100644 index b0c6fcd0f15d9..0000000000000 --- a/plugins/inputs/opcua/read_client_test.go +++ /dev/null @@ -1 +0,0 @@ -package opcua diff --git a/plugins/inputs/opcua/sample.conf b/plugins/inputs/opcua/sample.conf index e57b0e6be0fbc..8ea8eb290946f 100644 --- a/plugins/inputs/opcua/sample.conf +++ b/plugins/inputs/opcua/sample.conf @@ -6,9 +6,9 @@ ## OPC UA Endpoint URL # endpoint = "opc.tcp://localhost:4840" # - ## The service set to use to retrieve/receive the values from the OPC UA server + ## The service set to use to retrieve/receive the values from the + ## OPC UA server. One of "request" or "subscribe" # connection_service = "request" - # connection_service = "subscribe" # ## Maximum time allowed to establish a connect to the endpoint. # connect_timeout = "10s" @@ -17,11 +17,9 @@ # request_timeout = "5s" # ## The interval at which the server should at least update its monitored items - ## https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.1/ ## Only used when connection_service = "subscribe" # subscription_interval = "100ms" # - # ## Security policy, one of "None", "Basic128Rsa15", "Basic256", ## "Basic256Sha256", or "auto" # security_policy = "auto"