Data Collection Script
For troubleshooting and support purposes, the gwa-troubleshoot.lua
script allows you to collect key information about the operating system, the hardware, the installed Gateway Agent components and their configuration files and logs.
The script publishes the gathered data to the relayr Cloud Blob Storage as a .zip
archive:
- The
blobCategory
isedge-logs
. - The
blobName
isgwa-info.zip
.
You can also extend the script to collect any other project-specific data.
Requirements
The data collection script is provided as the Task Executor's script. To use it, you must install the Task Executor component.
To use the data collection script, you must also install the following dependencies:
- zip
- curl
- telnet
- netstat
Using the Script
After the Gateway Agent installation, you can find the data collection script here:
/usr/share/relayr/gwa-task-executor-cpp/examples/gwa-troubleshoot.lua
You can run the script either manually or as a task from the Task Executor. Depending on how you run it, there are two methods of passing parameters. See the sections below for information on the command line arguments and the task parameters.
Command Line Arguments
When you run the data collection script manually, directly from shell, you can use the following arguments:
Argument | Description |
---|---|
--credentials <base64(username:password)> | Base64 encoded Cloud credentials. You must provide them if you want to upload the collected information to the Cloud. |
--did <device_id> | Device ID for uploading data to the Cloud. You must provide it if you want to upload the collected information to the Cloud. |
--stdout | Turn on logging to the standard output. Apart from generating the .zip archive, the script prints the collected information in the console window. |
--storage-path <path> | Directory where the script saves temporary logs. They are removed when the script exits, after it uploads the .zip archive to the Cloud. If the script doesn't upload the archive to the Cloud, it is not removed from the temporary directory. The default value is /tmp/ . |
--days <number> | Number of days from which the script stores diagnostic messages and Gateway Agent logs. The default value is 1 . |
If you start the script manually without
credentials
and/ordid
, the archive won't be uploaded to the Cloud, but saved in thestorage-path
. By default,/tmp/gwa-{unix timestamp}.zip)
.
Task Parameters
When you run the data collection script as the Task Executor's task, you can use the following task parameters:
Parameter | Description |
---|---|
storage-path | String. Directory where the script saves temporary logs. They are removed when the script exits, after it uploads the .zip archive to the Cloud. The default value is /tmp/ . |
days | String. Number of days from which the script stores diagnostic messages and Gateway Agent logs. The default value is 1 . |
Example:
"parameter": [{"id": "storage-path", "value": "/tmp/"}, {"id": "days", "value": "1"}]
Downloading the Collected Data
To download data collected by the data collection script, use the following command:
curl -X GET "https://cloud.relayr.io/devices/{device-id}/blobs/edge-logs/gwa-info.zip" -H "accept: application/octet-stream" -H "Authorization: Bearer $TOKEN" --output gwa-info.zip