...
ImportScript must be run in the same folder with ApiClient.
The There is an examples folder that includes a csv and json export with matching names, as expected by the script
...
Code Block |
---|
python ImportScript.py |
Or, on a system with both Python 2 and 3 installed:
Code Block |
---|
python3 ImportScript.py |
It will connect to each device in order, import the provided configuration json, and restart all currently running apps. Note that this process may take several minutes per device.
...
The CSV file’s top row must be include the headerfollowing headers:
Code Block |
---|
Site Name,Edge Device IP,reachable,eACM username,eACM password,OS username,OS password,MQTT GroupID,MQTT NodeID,Broker IP |
Each columns column's meaning is detailed below
...
Complete - The script has run succesfully on at least one of the devices in the csv. A report.txt file is also generated in this folder to detail which sites are updated, which are not, and what prevented the update. Note that if it took longer than the specified timeout, a site may report the apps failed to restart despite the updates being applied succesfully.
Error - Either the script did not recognize the formatting of the csv or one of the devices in the csv did not recognize the formatting of the json file. Check log for details.
Process - Files should only be here while the script is running; they will be collected from Import, moved to Process, then sent to Error or Complete. Any files that remain here when the program is done indicate an unexpected exception. Check log for further details and contact support if necessary.
Unrecognized - Files that are not csv or json, as well as csv and json files without matching names, will be moved here.
Logs
Two log files will be created in the Logs subfolder, ApiClient.log and This script will generate its logs in ImportScript.log. They It can be checked for further details if an error appears in the Complete report.
Troubleshooting
If you experience a timeout durring the process, there are 3 variables at the top of ImportScript.py that can be adjusted. The script can be edited in any text editing software, eg. notepad or notepad++.
Code Block |
---|
#Shared timeout and retry parameters to tune if network is difficult
timeOut=40
importTimeOut=1200
retries=Retry(
total=3,
status_forcelist=[429, 500, 502, 503, 504],
method_whitelist=["HEAD", "GET", "POST"]
) |
...
timeOut is used for the timeout of all communications except the json import
...
importTimeOut only controlls the timeout for the json import
...
.