docs_in_draft:tempmon

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
docs_in_draft:tempmon [2026/08/16 13:06] – created crashtestdocs_in_draft:tempmon [2026/08/16 13:08] (current) crashtest
Line 1: Line 1:
-a+***Was under OMV7 and an OMV8 plugin*** 
 + 
 +====== Temp Monitor (openmediavault-tempmon) ====== 
 + 
 +A flexible temperature monitoring plugin for OpenMediaVault 7/8. Unlike fixed-sensor plugins, Temp Monitor lets you define any number of sensors using custom shell scripts — one script per sensor, each outputting raw numeric value. Dashboard gauge widgets and RRD performance charts are generated automatically per sensor. 
 + 
 +===== Installation ===== 
 + 
 +Install via omv-extras in the OMV web interface under **System → omv-extras**, or from the command line: 
 + 
 +<code bash> 
 +apt-get install openmediavault-tempmon 
 +</code> 
 + 
 +After installation, click **Apply Changes**. 
 + 
 +===== Adding a Sensor ===== 
 + 
 +Navigate to **Services → Temp Monitor**. 
 + 
 +Click the **+** (Create) button to open the sensor form. 
 + 
 +==== Sensor Fields ==== 
 + 
 +^ Field ^ Description ^ 
 +| **Name** | Display label used on the dashboard widget and performance chart. Set on creation only — cannot be changed after saving. | 
 +| **Script path** | Full path where the script will be written on disk (e.g. ''/usr/sbin/cputemp1''). Must be writable by root. | 
 +| **Script** | Shell script that outputs a single raw numeric value on stdout. See [[#example_scripts|Example Scripts]] below. | 
 +| **Divisor** | The raw value is divided by this number to produce degrees Celsius. Use ''1000'' for millidegree sources (e.g. Linux thermal zones), ''1'' if the script already outputs Celsius. | 
 +| **Dashboard widget** | When enabled, a gauge widget is added to the dashboard showing the current temperature. | 
 +| **Performance chart** | When enabled, an RRD graph is added under **Diagnostics → Performance Statistics → Temp Monitor**. | 
 +| **Current reading** | Live reading from the sensor script, shown when editing an existing sensor. | 
 + 
 +After saving, click **Apply Changes** to deploy the scripts and regenerate the collectd configuration, dashboard widgets, and performance chart pages. 
 + 
 +<note important> 
 +The **Name** field can only be set when creating a sensor. To rename a sensor, delete it and recreate it. 
 +</note> 
 + 
 +===== Example Scripts ===== 
 + 
 +==== Linux Thermal Zone (millidegrees) ==== 
 + 
 +Most ARM boards, Intel, and AMD CPUs expose temperatures via the kernel's thermal framework. Values are in millidegrees Celsius, so use **Divisor: 1000**. 
 + 
 +<code bash> 
 +#!/bin/sh 
 +cat /sys/devices/virtual/thermal/thermal_zone0/temp 
 +</code> 
 + 
 +To find the right thermal zone: 
 + 
 +<code bash> 
 +for z in /sys/devices/virtual/thermal/thermal_zone*/; do 
 +    echo "$z: $(cat ${z}type) = $(cat ${z}temp)" 
 +done 
 +</code> 
 + 
 +==== lm-sensors (degrees, already Celsius) ==== 
 + 
 +If ''lm-sensors'' is installed and configured, use **Divisor: 1**: 
 + 
 +<code bash> 
 +#!/bin/sh 
 +sensors -u | awk '/temp1_input:/ { printf "%.0f", $2 * 1000; exit }' 
 +</code> 
 + 
 +Adjust the ''awk'' pattern to match the specific sensor name shown by ''sensors -u''
 + 
 +==== Hard Drive Temperature via hddtemp ==== 
 + 
 +<code bash> 
 +#!/bin/sh 
 +hddtemp -n /dev/sda 
 +</code> 
 + 
 +Use **Divisor: 1**. 
 + 
 +==== Hard Drive Temperature via smartctl ==== 
 + 
 +<code bash> 
 +#!/bin/sh 
 +smartctl -A /dev/sda | awk '/Temperature_Celsius/ { print $10 }' 
 +</code> 
 + 
 +Use **Divisor: 1**. 
 + 
 +==== Fixed / Test Value ==== 
 + 
 +Useful for verifying the widget and chart pipeline without real hardware: 
 + 
 +<code bash> 
 +#!/bin/sh 
 +echo "42000" 
 +</code> 
 + 
 +Use **Divisor: 1000** → displays 42.0 °C. 
 + 
 +==== NVMe Drive Temperature ==== 
 + 
 +<code bash> 
 +#!/bin/sh 
 +nvme smart-log /dev/nvme0 | awk '/^temperature/ { gsub(/[^0-9]/, "", $3); print $3 * 1000 }' 
 +</code> 
 + 
 +Use **Divisor: 1000**. 
 + 
 +===== Dashboard Widgets ===== 
 + 
 +Each sensor with **Dashboard widget** enabled gets a circular gauge on the OMV dashboard showing the current temperature. The gauge fills from 0–100 °C. 
 + 
 +Widgets are generated automatically when **Apply Changes** is run. They appear under the widget picker on the dashboard — click the grid icon at the top right of the dashboard to add or arrange them. 
 + 
 +Colors are assigned deterministically from the sensor's UUID so they remain stable across deploys. 
 + 
 +===== Performance Charts ===== 
 + 
 +Sensors with **Performance chart** enabled are recorded by collectd and graphed under **Diagnostics → Performance Statistics → Temp Monitor**. 
 + 
 +The chart page appears automatically after **Apply Changes** once at least one chart-enabled sensor exists. It is removed if all sensors have the chart option disabled. 
 + 
 +Charts are updated every 60 seconds (collectd's default interval). Data is retained in RRD files and covers the standard OMV time ranges: 1 hour, 1 day, 1 week, 1 month, and 1 year. 
 + 
 +<note> 
 +After clicking **Apply Changes**, it takes up to 60 seconds for the first data point to appear. The chart page will show a placeholder image until data is available. A browser refresh (Ctrl+Shift+R) may be needed to see newly added chart pages. 
 +</note> 
 + 
 +===== How It Works ===== 
 + 
 +  - Each sensor's script is written to its **Script path** by Salt when **Apply Changes** runs. 
 +  - collectd's exec plugin runs ''/usr/share/openmediavault-tempmon/scripts/collectd-tempmon'' as user ''nobody''. This script loops continuously, calling each sensor script and emitting ''PUTVAL'' lines in collectd's protocol. 
 +  - collectd writes the values to RRD files under ''/var/lib/collectd/rrd/''
 +  - ''omv-mkrrdgraph'' reads those RRD files to generate PNG graph images served in the workbench. 
 +  - The dashboard widget uses a live RPC call (''TempMon.getAll'') that runs all sensor scripts on demand — it does **not** use the RRD data. 
 + 
 +===== Troubleshooting ===== 
 + 
 +==== Widget shows "–" or no value ==== 
 + 
 +  * Check that **Apply Changes** has been run since the sensor was created. 
 +  * Verify the script file exists and is executable: <code bash>ls -la /usr/sbin/cputemp1</code> 
 +  * Test the script manually: <code bash>/usr/sbin/cputemp1</code> It should print a single number. 
 +  * Check for errors in the script path or script content in the sensor form. 
 + 
 +==== Performance chart page missing ==== 
 + 
 +  * Ensure at least one sensor has **Performance chart** enabled and **Apply Changes** has been run. 
 +  * Try a hard browser refresh (Ctrl+Shift+R). 
 + 
 +==== Performance chart shows no data / placeholder image ==== 
 + 
 +  * Wait up to 60 seconds after **Apply Changes** for the first data point. 
 +  * Check collectd is running: <code bash>systemctl status collectd</code> 
 +  * Check collectd can execute the sensor script as ''nobody'': <code bash>sudo -u nobody /usr/sbin/cputemp1</code> 
 +  * Check the collectd configuration was written: <code bash>cat /etc/collectd/collectd.conf.d/tempmon.conf</code> 
 +  * Check the sensor conf was written: <code bash>cat /etc/openmediavault/tempmon.conf</code> 
 + 
 +==== Sensor name is greyed out when editing ==== 
 + 
 +This is by design. The name is locked after creation because it is used to identify the sensor's widget and chart. Delete and recreate the sensor to change the name. 
 + 
 +===== Multiple Sensors ===== 
 + 
 +There is no fixed limit on the number of sensors. Add one sensor per thermal source. Each gets its own: 
 + 
 +  * Row in the **Services → Temp Monitor** datatable with live reading 
 +  * Dashboard gauge widget (if enabled) 
 +  * RRD graph on the performance page (if enabled) 
 + 
 +Example multi-sensor setup: 
 + 
 +^ Name ^ Script path ^ Script ^ Divisor ^ 
 +| CPU | ''/usr/sbin/temp-cpu'' | ''cat /sys/devices/virtual/thermal/thermal_zone0/temp'' | 1000 | 
 +| NVMe | ''/usr/sbin/temp-nvme'' | ''nvme smart-log /dev/nvme0 | awk ...'' | 1000 | 
 +| HDD | ''/usr/sbin/temp-hdd'' | ''smartctl -A /dev/sda | awk ...'' | 1 | 
 +| Board | ''/usr/sbin/temp-board'' | ''cat /sys/bus/i2c/drivers/.../temp1_input'' | 1000 | 
  • docs_in_draft/tempmon.1786885572.txt.gz
  • Last modified: 2026/08/16 13:06
  • by crashtest