Triggering Commands
From Edge Manager with Custom Commands
Once the commands, handlers, and capabilities have been created, the next step is to trigger them remotely from Edge Manager. (See Adding a Custom Command.)
- Enter a name and description that clearly indicates what the commmand does.
- Set the COMMAND and HANDLER fields to match what is set in the JSON, in this case 'date' and 'host' respectively.
- Select Has output in order to see the results of this command from the system.
You can then execute the command (see Executing Commands).
The new command will be included in the Commands History table. The status should cycle through Pending, to In Progress, and Success. The command's results can be downloaded from the Output column.
Locally with the Edge Core API
Commands can be triggered locally without enrolling to Edge Manager by using the Edge Core API available at /var/run/edge-core/edge-core.sock. Once loaded, the command will be available at http://localhost/api/v1/host/commands/<handler>/<command>.
curl --unix-socket /var/run/edge-core/edge-core.sock \
http://localhost/api/v1/host/commands/host/date \
-X POST
{"output": "Service predix-edge-broker removed."}
{ "error_message": "Not Found", "status_code": 404}