Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lpc921 committed Oct 11, 2021
1 parent 284b54b commit 2e9e67d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.exe

.vscode
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# telegraf-execd-opcda

[![License](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://github.com/lpc921/telegraf-execd-opcda/blob/master/LICENSE)

telegraf-execd-opcda is a [telegraf](https://github.com/influxdata/telegraf) external input plugin to gather data from OPC DA using the [konimarti/opc](https://github.com/konimarti/opc) library.

## Installation

Install the Graybox OPC Automation Wrapper. You can get the Graybox DA Automation Wrapper [here](http://gray-box.net/download_daawrapper.php?lang=en). Follow the installation instruction for this wrapper.
## Usage

For 32-bit OPC servers on 64-bit systems:
* Install OPC DA Automation Wrapper 2.02 by following the installation instruction from [konimarti/opc](https://github.com/konimarti/opc) library.

- copy the x86 version `gbda_aut.dll` to `C:\Windows\SysWOW64` folder;
- register this module - enter `%systemroot%\SysWoW64\regsvr32.exe gbda_aut.dll`
- Set go architecture - `$ENV:GOARCH=386` (powershell), or `SET GOARCH=386` (batch)
- Build the executable `go build -o opcda.exe .\cmd\opcda\main.go`
* Download the [latest release package](https://github.com/lpc921/telegraf-execd-opcda/releases/latest) for your platform.

Create your plugin.config file
* Edit opcda.conf as needed. Example:

```toml
[[inputs.opcda]]
Expand Down Expand Up @@ -48,6 +41,29 @@ Create your plugin.config file
]
```

* Edit execd plugin configuration as needed:

```toml
[[inputs.execd]]
command = ["/path/to/opcda", "-config", "/path/to/opcda.conf"]
signal = "none"
restart_delay = "10s"
data_format = "influx"
```

* Restart or reload Telegraf.

## Development

* Install and register OPC DA Automation Wrapper 2.02. For 32-bit OPC servers on 64-bit systems follow these steps:
* copy the x86 version `gbda_aut.dll` to `C:\Windows\SysWOW64` folder;
* register this module - enter `%systemroot%\SysWoW64\regsvr32.exe gbda_aut.dll`
* Set go architecture - `$ENV:GOARCH=386` (powershell), or `SET GOARCH=386` (batch)

* Build the executable `go build -o opcda.exe .\cmd\opcda\main.go`

* Edit opcda.conf as needed.

From here, you can already test the plugin with your config file.

```ps1
Expand All @@ -60,15 +76,3 @@ If everything is ok, you should see something like this
sim PORT.PLC.int=3i 1633624798000000000
sim,equipment=maker1,input=temperature randomFloat=10.511474609375 1633624798000000000
```

## Telegraf configuration

To use the plugin with telegraf, add this configuration to your main telegraf.conf file. telegraf-execd-opcda is an external plugin using [shim](https://github.com/influxdata/telegraf/blob/master/plugins/common/shim/README.md) and [execd](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/execd). Go see their doc for more information.

```toml
[[inputs.execd]]
command = ["/path/to/opcda", "-config", "/path/to/opcda.conf"]
signal = "none"
restart_delay = "10s"
data_format = "influx"
```

0 comments on commit 2e9e67d

Please sign in to comment.