Commands and Command Formats

Command formats for protobuf objects sent to Predix Machine and returned to the Cloud Gateway.

EdgeCommand Protobuf Object sent to Machine
{
    "id": "Command ID",
    "commandHandlerType": "Command Handler Name/Type",
    "appName": "Name of the Container this command is intended for",
    "command": "Command to execute",
    "url": "URL to post output",
    "params":{
        "Command parameter (i.e. PollingTime)": "Value (i.e. 30)"
    }
}
CommandStatus Protobuf Object returned to CloudGateway
{
    "taskId": "ID found in EdgeCommand received by Machine Command Handler",
    "status": "Status of type TaskStatus",
    "statusMessage": "Status Message",
    "statusDetailedMessage": "Status Detailed Message",
    "output": "Command String Output up to size 1KB. If output is returned through this status object, the output uploaded with the provided URL will be ignored."
}

Commands

The following commands are provided by the Predix Edge Command Handler.

Display NameCommandParametersOperation Description
Predix Machine: RefreshrefreshRestarts the Predix Edge OSGi container.
Predix Machine: RestartrestartRestarts the Predix Edge OSGi container process. This command is not permitted if the watchdog is not running.
Predix Machine: Upload ConfigurationsuploadconfigUploads the current machine configuration files.
HTTP Tunnel: EnableenablehttptunnelEnables the Http Tunnel Client.
HTTP Tunnel: DisabledisablehttptunnelDisables the Http Tunnel Client.
Technician Console: EnableenablewebEnables the Technician Console and restarts the container.
Technician Console: DisabledisablewebDisables the Technician Console and restarts the container.
Predix Machine: Get LoggetlogsFile Name: "machine:/machine/machine.log"Posts the specified log file from the Predix Edge OSGi Container to a predefined URL endpoint in device manager. If no name is specified, the current log file is posted. Log files follow a URI format: <application_name>:/<path_to_file>. The default application is machine, which posts machine.log. Other applications in containers can be referenced using the scheme portion of the URI.
Predix Machine: Set Polling IntervalsetpollingPolling Interval Time: 30

Sets the device manager polling interval to the value passed. This sets the configuration file: com.ge.dspmicro.cloud.gateway.config

Predix Machine: Get IP AddressipaddressPosts the network interface information with all available device IP addresses to the provided URL endpoint. Following is a sample format, which will be in the POST body of the return call:
[{
		"name": "lo0",
		"displayName": "TCP Loopback interface",
		"inet4": ["127.0 .0 .1 / 8"],
		"inet6": ["0:0:0:0:0:0:0:1", "fe80:0:0:0:0:0:0:1/64"]
	},
	{
		"name": "en0",
		"displayName": "Wireless Network Connection",
		"inet4": ["3.39.57.3/23"],
		"inet6": ["fe80:0:0:0:a299:9bff:fe10:4773/64"]
	},
	{
		"name": "utun0",
		"displayName": "utun0",
		"inet4": [],
		"inet6": ["fe80:0:0:0:59a7:74cb:9139:5aaa/64"]
	}
]
Predix Machine: Get Available Logsget_available_logsReturns a list of available logs on the machine. The format provides a URI. The scheme in the URI indicates which application the log pertains to and the path indicates which log file in that application. For all Predix Machine logs, the root of the path begins in the machine log folder. The following contents will be in the POST body of the return call.
[{
	"filepath": "machine:/installations/yeti1.log"
}, {
	"filepath": "machine:/machine/machine.log"
}, {
	"filepath": "machine:/machine/machine-1.log"
}]

Predix Machine: List installed packages

run_dpkgLists all packages installed on the device.
Note: Only for Linux devices that support dpkg.

Predix Machine: Run ifconfig command

run_ifconfigRuns the system command ifconfig on the device and returns the command output.
Note: This applies only to devices that support the ifconfig command.

Predix Machine: Run top command

run_topRuns the system command top on the device for one iteration.
Note: This applies only to devices that support the top command.

Predix Machine: Run journalctl command

run_journalctlFiltering parameters include:
  • component (String):
    • Shows entries generated by the specified component.
    • On Linux, the path of the executable, for example: /bin/systemd
  • priority (Integer from 0 to 7):
    • Shows entries with the specified log level, or a more important log level.
    • On Linux, valid log levels are:
      • Emergency (0)
      • Alert (1)
      • Critical (2)
      • Error (3)
      • Warning (4)
      • Notice (5)
      • Info (6)
      • Debug (7)
  • since (date time value in YYYY-MM-DD HH:mm:ss format):

    Shows entries on or newer than the specified timestamp.

  • until (date time value in YYYY-MM-DD HH:mm:ss format):

    Shows entries on or older than the specified timestamp.

Output Format parameters include:
  • useUTC – Shows entries with UTC timestamps.
  • useJSON – Shows entries in JSON format.
Uses system command journalctl to query the default system journal on the device according to the filtering and formatting values specified in the command parameters.

All command parameters are optional. However, journals usually contain a lot of entries, therefore, it is best practice to use the filtering parameters to reduce the size of the output to send to the cloud.

Note: Only for Linux devices that support journalctl.
Predix Machine: Refresh Device Detailrefresh_device_detailSends all device detail information in the next sync. This command overrides the Cloud Gateway's polling interval (com.ge.dspmicro.cloud.gateway.pollingInterval) and schedules a sync immediately.

This command also overrides the sync intervals of the following device detail categories. Information about the following, together with all other available device detail information, will be included in the next sync.

  • com.ge.dspmicro.cloud.gateway.machineInfoUploadInterval
  • com.ge.dspmicro.cloud.gateway.deviceStatusUploadInterval
  • com.ge.dspmicro.cloud.gateway.dockerInfoUploadInterval

Command Output

Output for a command should be returned only in one of the two ways listed below. If both ways are implemented for a command, only the output in the CommandStatus object (first way) will be displayed in the Edge Manager UI.
  1. Output is sent through the CommandStatus object in the Output field.
    Note: This is limited to String output of size < 1KB.
  2. Output is uploaded through the provided URL.