Installation
A nodejs must be installed prior to omg
utility installation: https://nodejs.org/en/
After that, in your terminal run following command: npm i -g @ombori/ga-cli
. That will install omg
utility.
After utility is installed, you need to put an authorisation token into a config file:
OS X:echo AUTH_TOKEN=your-token >> ~/.gridapprc
Windows:
echo AUTH_TOKEN=your-token >> %HOME%/.gridapprc
The token can be obtained from ombori.
List of available commands
All commands are executed by running omg <commandName> <parameter1> <parameter2> …
command in terminal.
omg dev list
Lists all compute devices created in ombori grid.
Can be used with -l
option, i.e. omg dev list -l
to enable “long output”, in this mode organisation, app name and environment are also printed.
omg dev modules <device>
Lists all modules enabled on a device, their connection status and version. If module version is about to be changed, two versions are displayed as well.
omg dev log <device> <module>
Prints logs to a specified module running on a device. The device must be online and edgeAgent module must be running.
TODO: print timestamps
TODO: specify log limit and offset
NOTE: Log streaming is currently unsupported by a MS IoT Edge runtime. To stream logs login to a device using omg dev shell
command, and run sudo docker logs -f <moduleName>
omg dev shell <device>
Opens an interactive shell to a remote device. Device must be online and GdmAgent must be running.
This command can also be used to forward remote tcp ports to a local computer:
omg dev shell -L localhost:1234 some-device
will connect to a remote device, and then forward port 1234 to some port on a calling machine.
omg dev shell -L 192.168.1.100:443 some-device
will connect to a remote device, and then forward port 443 (https) from host 192.168.1.100 in device’s local network to some port on a calling machine.
TODO: execute a specified command on a remote machine
omg dev invoke <device> <module> <method> [<payload>]
Invokes a method on a module running on a device and print the result. Device must be online and module must be running.
Method payload can be specified as a last command line parameter in JSON5 format:
omg dev invoke some-device GdmAgent someMethod '{hello: "world"}'
. Note the use of single quotes to let the program process the JSON correctly.
The payload can also be provided to standard input of omg
command. To do so, specify -
as a payload value in command line:
omg dev invoke some-device GdmAgent someMethod - < payload.json
will load payload from “payload.json” and call someMethod.
List of available methods
Here are a few methods available for use (in <moduleName> <methodName> format):
<module> restart
Restart the module. Works for all modules. The module will be restarted after a certain interval, determined by edge runtime and based on how often the module was restarting recently.
GdmAgent ping
Return ‘pong’. Used to test if device is online and working properly.
GdmAgent reboot
Reboot the device
GdmAgent status
Return device telemetry.
Browser screenshot
Take a screenshot and upload it to an azure storage.
Mdns list
List all known grid-os peers.
Mdns ips
List device ip addresses
Relay on {relay: N}
Toggle a specified relay (value can be 1 or 2) on.
Relay off {relay: N}
Toggle a specified relay (value can be 1 or 2) on.
ThermalPrinter print {data: 'text to print'}
Print specified text. Data can be a string or an array of integer values (0..255) representing values of individual bytes in the message to be printed.