Configuration¶
Configs¶
The diagram, below, illustrates that ExoEdge will continuously monitor configuration resources \(e.g. config_io
, config_applications
, etc.\) for updates.
The order of precedence is that the remote config is first, then local configs.
If using ExoEdge with the intent that it is to be configured with a local config, then it is imperative that it connects for the first time where the config resource has no value \(i.e. it has never been set by ExoSense\).
Once edged
is running, set the config_io
resource to the object below in the Murano Product UI:
config_io
{
"channels": {
"one": {
"display_name": "Temperature",
"description": "It's the temperature",
"properties": {
"max": 1000,
"data_unit": "DEG_CELSIUS",
"precision": 4,
"data_type": "TEMPERATURE",
"min": 0
},
"protocol_config": {
"application": "ExoSimulator",
"report_on_change": false,
"report_rate": 1000,
"sample_rate": 1000,
"down_sample": "ACT",
"app_specific_config": {
"function": "sin_wave",
"module": "exo_simulator",
"parameters": {
"period": 120,
"amplitude": 10,
"offset": 100,
"precision": 0
},
"positionals": []
}
}
}
}
}
Verify that the device started reporting a sin wave with those characteristics.
Argument Support¶
The edged
command supports supplying arguments via CLI flags, environment variables, and INI files.
Naming conventions differ slightly between these methods—for a generic argument some_argument
they are named as follows:
- CLI:
--some-argument
- Environment:
EDGED_SOME_ARGUMENT
- INI:
some_argument
Argument Precedence¶
In handling conflicting arguments from different sources, edged
evaluates arguments in the following order:
- CLI \(overrides Environment and INI\)
- Environent \(overriden by CLI, overrides INI\)
- INI \(overriden by CLI and Environment\)
Examples¶
With command line arguments and a local config_io
:
$ edged --host=https://abcdef123456.m2.exosite.io/ -s device01.ini -c my_config.json -i device01.ini go
...^C
$ cat device01.ini
[device]
murano_host = https://abcdef123456.m2.exosite.io/
murano_id = device01
murano_token = cz0wIrytgohIxa9YVxFWzsyXyeDaEexOdnYyd9mT
watchlist = config_io,data_out,config_applications
murano_port = 443
[edged]
config_io_file = my_config.json
config_applications_file = config_applications.json
With INI file:
$ cat device01.ini
[device]
murano_host = https://abcdef123456.m2.exosite.io/
murano_id = device01
debug = INFO
$ edged -i device01.ini -c my_config.json go
NOTE: The murano_token
option is not present in the .ini file prior to activation. If murano_token
is present, the client will attempt to use that token, even if it's blank, to communicate with Murano. The example, above, omits murano_token
, because it will be saved there after edged
provisions with Murano.
Local or Remote Configs¶
ExoEdge will always look for a local config_io
file first, then check to see if there's one in ExoSense. For more information on how edged
manages configs \(e.g. config_io
, config_applications
, etc.\), see edged -h
.
Logging¶
Log Rotation¶
ExoEdge can be configured to save and rotate its own logs, as opposed to dumping logging to 'stdout'.
# example
$ export EDGED_LOG_FILENAME=${PWD}/edged.log
$ edged -i f5330e5s8cho0000.ini go
Other supported environment variables for logging configuration are:
EDGED_LOG_DEBUG
\(default:CRITICAL\)EDGED_LOG_MAX_BYTES
\(default:1024000\)EDGED_LOG_MAX_BACKUPS
\(default:3\)
You might wish to save and rotate the underlying murano_client
logging as well. For help on this see murano-client.
A typical logging configuration for a production gateway looks like the following:
export EDGED_LOG_FILENAME=/var/log/edged.log
export MURANO_CLIENT_LOGFILE=/var/log/murano_client.log
A typical logging configuration for a development gateway might look like:
export EDGED_LOG_FILENAME=${PWD}/edged.log
export MURANO_CLIENT_LOGFILE=${PWD}/murano_client.log
TIP: If you don't care about the murano_client
logging, you can use the standard redirect since murano_client
defaults to logging on 'stderr':
edged -i f5330e5s8cho0000.ini go 2>/dev/null
Full Example¶
export EDGED_LOG_DEBUG=CRITICAL
export EDGED_LOG_FILENAME=/var/log/edged.log
export EDGED_LOG_MAX_BYTES=1024000
export EDGED_LOG_MAX_BACKUPS=3
export MURANO_CLIENT_DEBUG=warning
export MURANO_CLIENT_LOGFILE=/var/log/murano_client.log
export MURANO_CLIENT_LOG_MAX_BYTES=$((1024*100))
export MURANO_CLIENT_MAX_BACKUPS=2