From 40d4daa96be10a9c431ce354ecd95c24db0da1b0 Mon Sep 17 00:00:00 2001 From: Arksine Date: Mon, 3 May 2021 08:59:19 -0400 Subject: [PATCH] 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 --- docs/web_api.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/docs/web_api.md b/docs/web_api.md index 6640f26..3fa1cb7 100644 --- a/docs/web_api.md +++ b/docs/web_api.md @@ -989,7 +989,8 @@ An object in the following format: "throttled_state": { "bits": 0, "flags": [] - } + }, + "cpu_temp": 46.148 } ``` 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 `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 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 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 { "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 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 If the `[history]` module is enabled the following notification is sent when a job is added or finished: