Skip to content

Usage

To display the list of available arguments, run:

$ agent-alemca --help
Usage of agent-alemca:
  -arch
        get architecture of the agent
  -config string
        path to the configuration file (default "config.yaml")
  -d
        run the agent as a daemon
  -daemon
        run the agent as a daemon
  -debug
        run the agent in debug mode
  -desactivate-autoenroll
        deactivate the auto-enroll feature
  -log-level string
        log level for the logger (default "info")
  -log-output string
        output destination for the logger
  -log-size int
        maximum size of the log file in megabytes (default 100)
  -name string
        device name for auto-enroll
  -once
        run the agent only once
  -serial-number string
        serial number of the device for auto-enroll
  -version
        print the version and exit

To start the agent, run:

agent-alemca --config /etc/alemca/config.yaml

See the agent configuration.

Using the Lua Script

To use the Lua script, create a file at the path specified in the configuration. It will be executed every X seconds (where X is set in the configuration under trigger).

Example Lua script:

local modbus = require("modbus1")      -- load the modbus module with configuration modbus1

local data = modbus.readHoldingRegisters(0, 10, "uint32") -- read registers 0-10 as uint32 (automatically split per the specified type)

for i, v in ipairs(data) do
    print(i, v)
end

Refer to the modules documentation for more details.