Note
This API has been available since API level 22.
This API has been available since API level 22.
The sdkagent service controls Telegraf in webOS and communicates with SDK tools.
Operations:
Note: Telegraf is open source resource monitoring tool.
NA
API level 22
Gets configurations of the Telegraf service.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the 'API Error Codes Reference' section for details. |
config | Optional | Object | Telegraf configurations, converted to a JSON object. Similar to telegraf.conf, available @ https://docs.influxdata.com/telegraf/v1.21/administration/configuration/. Note: Besides the configs that are configured using setConfig method, this method also returns some read-only configurations. |
Example scenario
# luna-send -f -n 1 luna://com.webos.service.sdkagent/collector/getConfig '{}'
Response:
{
"returnValue": true,
"config": {
"inputs.processes": {
},
"inputs.kernel": {
},
"inputs.cpu": {
"collect_cpu_time": false,
"totalcpu": true,
"percpu": true,
"report_active": false
},
"inputs.socket_listener": {
"service_address": "unixgram:///tmp/telegraf.sock"
},
"agent": {
"omit_hostname": false,
"flush_jitter": "0s",
"round_interval": true,
"metric_buffer_limit": 10000,
"flush_interval": "10s",
"interval": "10s",
"collection_jitter": "0s",
"metric_batch_size": 1000,
"precision": "",
"hostname": ""
},
"inputs.diskio": {
},
"inputs.system": {
},
"inputs.disk": {
"ignore_fs": [
"tmpfs",
"devtmpfs",
"devfs",
"iso9660",
"overlay",
"aufs",
"squashfs"
]
},
"outputs.influxdb": {
"database": "telegraf",
"urls": [
"http://127.0.0.1:8086"
]
},
"global_tags": {
},
"inputs.mem": {
},
"inputs.swap": {
},
"webOS.webProcessSize": {
"enabled": true
},
"webOS.processMonitoring":{
"enabled":true,
"process_name":["com.webos.app.home"]
}
}
}
API level 22
Gets data from the Telegraf service.
Name | Required | Type | Description |
---|---|---|---|
inputs | Optional | String array | Indicates the inputs to get data from service. The inputs can be obtained from the "Input.*" of the collector/getConfig API. For example, the inputs can be as follows: {"processes", "kernel", "cpu", "system", "diskio", "disk", "mem", "swap"} If argument is empty, return all collected data Note: The inputs can be different depending on the target device. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the 'API Error Codes Reference' section for details. |
dataArray | Optional | Object array | JSON object with data about the specified input. |
Example scenario
# luna-send -f -n 1 luna://com.webos.service.sdkagent/collector/getData '{"inputs": ["processes", "kernel"]}'
Response:
{
"returnValue": true,
"dataArray": [
{
"kernel": {
"data": {
"boot_time": "1667892733i",
"context_switches": "11538598i",
"entropy_avail": "256i",
"interrupts": "94685940i",
"processes_forked": "19231i"
},
"time": "166797999600000000",
"host": "qemux86-64"
}
},
{
"processes": {
"data": {
"total": "143i",
"unknown": "0i",
"dead": "0i",
"blocked": "0i",
"stopped": "0i",
"paging": "0i",
"zombies": "0i",
"sleeping": "97i",
"running": "0i",
"total_threads": "313i",
"idle": "46i"
},
"time": "166797999600000000",
"host": "qemux86-64"
}
}
]
}
API level 22
Gets status of the Telegraf service.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the 'API Error Codes Reference' section for details. |
status | Optional | String | Indicates the status of the Telegraf service. Possible values are:
|
startOnBoot | Optional | Boolean | Indicates whether the service is configured to start on booting up of device. Possible values are:
|
Example scenario
# luna-send -n 1 -f luna://com.webos.service.sdkagent/collector/getStatus '{}'
Response:
{
"returnValue": true,
"status": "active",
"startOnBoot": false
}
API level 22
Restarts the Telegraf service.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the 'API Error Codes Reference' section for details. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.sdkagent/collector/restart '{}'
Response:
{
"returnValue": true
}
API level 22
Sets configurations of the Telegraf service.
Name | Required | Type | Description |
---|---|---|---|
agent | Optional | Object: agent | Config data for telegraf agent. Note:
|
outputs.influxdb | Optional | Object: outputs.influxdb | Config data for influxdb on host. Note:
|
webOS.webProcessSize | Optional | Object: webOS.webProcessSize | Config data for webProcessSize. Note:
|
webOS.processMonitoring | Optional | Object: webOS.processMonitoring | Config data for processMonitoring. Note:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the 'API Error Codes Reference' section for details. |
Example scenario
# luna-send -f -n 1 luna://com.webos.service.sdkagent/collector/setConfig '{
"agent":{"flush_interval":"5s","interval":"5s"},
"outputs.influxdb":{"database":"telegraf","urls":["http://192.168.0.6:8086"]},
"webOS.webProcessSize":{"enabled":true},
"webOS.processMonitoring":{"enabled":true,"process_name":["com.webos.app.home","com.webos.service.sdkagent"]}
}'
Response:
{
"returnValue": true
}
API level 22
Starts the Telegraf service.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the 'API Error Codes Reference' section for details. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.sdkagent/collector/start '{}'
Response:
{
"returnValue": true
}
API level 22
Automatically starts the Telegraf service on device boot-up and starts monitoring.
Name | Required | Type | Description |
---|---|---|---|
enable | Required | Boolean | Indicates if auto-start is enabled. Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the 'API Error Codes Reference' section for details. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.sdkagent/collector/startOnBoot '{"enable":true}'
Response:
{
"returnValue": true
}
API level 22
Stops the Telegraf service.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the 'API Error Codes Reference' section for details. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.sdkagent/collector/stop '{}'
Response:
{
"returnValue": true
}
Config data for telegraf agent.
Name | Required | Type | Description |
---|---|---|---|
interval | Optional | String | Indicates the interval time. |
flush_interval | Optional | String | Indicates the flush interval time. |
Config data for influxdb on host.
Name | Required | Type | Description |
---|---|---|---|
database | Optional | String | Indicates the database name. |
urls | Optional | String array | Indicates the influxdb host urls. |
Config data for processMonitoring.
Name | Required | Type | Description |
---|---|---|---|
enabled | Optional | Boolean | Enables process monitoring data. |
process_name | Optional | String array | Process names for monitoring. |
Config data for webProcessSize.
Name | Required | Type | Description |
---|---|---|---|
enabled | Optional | Boolean | Enables webProcessSize data. |
Error Code | Error Text | Error Description |
---|---|---|
1 | Unknown error. | Unknown error. |
2 | Invalid parameters. | Occurs when parameters are incorrect. |
3 | Malformed json. | Occurs when parameter has malformed JSON. |
4 | Invalid configurations. | Occurs when Telegraf has invalid configurations. |
5 | Collector is active (running). | Occurs when Telegraf is running. |
Contents