Aller au contenu

Utilisation

Pour voir la liste des arguments disponibles, utiliser la commande suivante:

$ agent-alemca --help
Usage of agent-alemca:
  -arch
        get architecture of the agent
  -config string
        path to the configuration file (default "/etc/alemca/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
        desactivate autoenroll feature
  -log-level string
        log level for the logger (default "info")
  -log-output string
        output for the logger
  -log-size int
        maximum size of the log file in megabytes (default 100)
  -name string
        name of the device for autoenroll
  -once
        run the agent only once
  -serial-number string
        serial number of the device for autoenroll
  -status
        Print AMQP connection status and exit
  -status-file string
        path to the status file (default "/etc/alemca/status.json")
  -version
        print the version and exit

Pour lancer l'agent, utiliser la commande suivante:

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

Voir la configuration de l'agent.

Utilisation du Script Lua

Pour utiliser le script Lua, vous devez créer un fichier dans le chemin spécifié dans la configuration. Il sera exécuté toutes les X secondes (X est spécifié dans la configuration sous trigger).

Exemple de script Lua:

local modbus = require("modbus1") -- charge le module modbus avec la configuration modbus1

local data = modbus.readHoldingRegisters(0, 10, "uint32") -- lit les registres de 0 à 10 en format uint32 (divise automatiquement en fonction du type spécifié)

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

Voir la documentation des modules pour plus d'informations.