docs: update proc_stats API documentation

Document the "cpu_temp" field in the "/machine/proc_stats" request along with the new "notify_proc_stat_update" websocket notification.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-05-03 08:59:19 -04:00
parent 68b793f059
commit 40d4daa96b
1 changed files with 31 additions and 2 deletions

View File

@ -989,7 +989,8 @@ An object in the following format:
"throttled_state": { "throttled_state": {
"bits": 0, "bits": 0,
"flags": [] "flags": []
} },
"cpu_temp": 46.148
} }
``` ```
Process information is sampled every second. The `moonraker_stats` field Process information is sampled every second. The `moonraker_stats` field
@ -1025,6 +1026,10 @@ whereas the last four indicate a previous condition (may or
may not still be active). If `vcgencmd` is not available may not still be active). If `vcgencmd` is not available
`throttled_state` will report `null`. `throttled_state` will report `null`.
If the system reports CPU temp at `/sys/class/thermal/thermal_zone0`
then temperature will be supplied in the `cpu_temp` field. Otherwise
the field will be set to `null`.
### File Operations ### File Operations
Most file operations are available over both APIs, however file upload and Most file operations are available over both APIs, however file upload and
@ -2884,7 +2889,8 @@ Where `update_info` is an object that matches the response from an
#### CPU Throttled #### CPU Throttled
If the system supports throttled CPU monitoring Moonraker will send the If the system supports throttled CPU monitoring Moonraker will send the
following notification when it detectes an active throttled condition. following notification when it detects a change to the current throttled
state:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
@ -2899,6 +2905,29 @@ request. It is possible for clients to receive this notification multiple times
if the system repeatedly transitions between an active and inactive throttled if the system repeatedly transitions between an active and inactive throttled
condition. condition.
#### Moonraker Process Statistic Update
Moonraker will emit the following notification each time it samples its
process statistics:
```json
{
"jsonrpc": "2.0",
"method": "notify_proc_stat_update",
"params": [{
"moonraker_stats": {
"time": 1615837812.0894408,
"cpu_usage": 1.99,
"memory": 23636,
"mem_units": "kB"
},
"cpu_temp": 44.008
}]
}
```
As with the [proc_stats request](#get-moonraker-process-stats) the `cpu_temp`
field will be set to `null` if the host machine does not support retreiving CPU
temperatures at `/sys/class/thermal/thermal_zone0`.
#### History Changed #### History Changed
If the `[history]` module is enabled the following notification is sent when If the `[history]` module is enabled the following notification is sent when
a job is added or finished: a job is added or finished: