{"id":536,"date":"2026-10-08T10:30:00","date_gmt":"2026-10-08T08:30:00","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/?page_id=536"},"modified":"2026-11-15T12:06:19","modified_gmt":"2026-11-15T11:06:19","slug":"raspberry-pi-monitoring-with-prometheus-and-grafana","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/","title":{"rendered":"Raspberry Pi Monitoring with Prometheus and Grafana"},"content":{"rendered":"<h2>Load monitoring and its limits<\/h2>\n<p>Prometheus stores measurements over time, while Grafana displays those measurements. On a Raspberry Pi, node_exporter makes Linux measurements available for retrieval. A small collection script adds temperature and warning flags reported by the firmware, the device\u2019s built-in control software. Monitoring helps investigate bottlenecks. A dashboard does not prevent overheating, repair a power supply or predict the failure date of a storage device.<\/p>\n<p>The example targets a separate, new Raspberry Pi OS setup with Python 3, Docker Engine and Compose. Existing accounts, collector directories and services require reconciliation before installation. Administrative privileges are needed for the host service configuration. All network endpoints below listen on the local address 127.0.0.1, called loopback. Devices elsewhere on the network cannot connect directly; browser access uses an encrypted SSH tunnel to the Pi.<\/p>\n<figure class=\"lw-diagram\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/dia-536-monitoring-20261024.png?v=20261115\" width=\"1120\" height=\"580\" alt=\"Firmware collector, node exporter, Prometheus and Grafana with separate freshness and notification checks\"><figcaption>Collection, scraping, display and notification are separate steps. Old or missing measurements need their own alert rules.<\/figcaption><\/figure>\n<h2>1. Firmware collection with error handling<\/h2>\n<p>The following file, <code>rpi-hardware-metrics.py<\/code>, reads only temperature and throttling status. Each command has a timeout, and unexpected output aborts the run. A failed run leaves the previous file unchanged. The last-success metric distinguishes old measurements from new ones; a successful HTTP scrape alone would not reveal a stalled collector.<\/p>\n<figure style=\"--cbb-digits:2\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"python\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">Python<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: Python\"><code class=\"cbb-code language-python\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\"><span class=\"cbb-comment\">#!\/usr\/bin\/env python3<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">import<\/span> os\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">import<\/span> re\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">import<\/span> subprocess\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">import<\/span> sys\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">import<\/span> tempfile\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">import<\/span> time\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">from<\/span> pathlib <span class=\"cbb-keyword\">import<\/span> Path\n<\/span><span class=\"cbb-line\">\n<\/span><span class=\"cbb-line\">FLAGS = (<span class=\"cbb-string\">\"undervoltage\"<\/span>, <span class=\"cbb-string\">\"frequency_capped\"<\/span>, <span class=\"cbb-string\">\"throttled\"<\/span>, <span class=\"cbb-string\">\"soft_temperature_limit\"<\/span>)\n<\/span><span class=\"cbb-line\">\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">def<\/span> <span class=\"cbb-function\">read_value<\/span>(argument):\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-keyword\">return<\/span> subprocess.<span class=\"cbb-function\">run<\/span>(\n<\/span><span class=\"cbb-line\">        &#91;<span class=\"cbb-string\">\"\/usr\/bin\/vcgencmd\"<\/span>, argument&#93;, check=<span class=\"cbb-constant\">True<\/span>,\n<\/span><span class=\"cbb-line\">        capture_output=<span class=\"cbb-constant\">True<\/span>, text=<span class=\"cbb-constant\">True<\/span>, timeout=<span class=\"cbb-number\">5<\/span>\n<\/span><span class=\"cbb-line\">    ).stdout.<span class=\"cbb-function\">strip<\/span>()\n<\/span><span class=\"cbb-line\">\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">def<\/span> <span class=\"cbb-function\">collect<\/span>(reader=read_value):\n<\/span><span class=\"cbb-line\">    temperature = re.<span class=\"cbb-function\">fullmatch<\/span>(<span class=\"cbb-string\">r\"temp=(-?&#91;0-9&#93;+(?:&#91;.&#93;&#91;0-9&#93;+)?)'C\"<\/span>, <span class=\"cbb-function\">reader<\/span>(<span class=\"cbb-string\">\"measure_temp\"<\/span>))\n<\/span><span class=\"cbb-line\">    throttle = re.<span class=\"cbb-function\">fullmatch<\/span>(<span class=\"cbb-string\">r\"throttled=0x(&#91;0-9a-fA-F&#93;{1,8})\"<\/span>, <span class=\"cbb-function\">reader<\/span>(<span class=\"cbb-string\">\"get_throttled\"<\/span>))\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-keyword\">if<\/span> temperature <span class=\"cbb-keyword\">is<\/span> <span class=\"cbb-constant\">None<\/span> <span class=\"cbb-keyword\">or<\/span> throttle <span class=\"cbb-keyword\">is<\/span> <span class=\"cbb-constant\">None<\/span>:\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-keyword\">raise<\/span> <span class=\"cbb-function\">ValueError<\/span>(<span class=\"cbb-string\">\"Unexpected vcgencmd output\"<\/span>)\n<\/span><span class=\"cbb-line\">    mask = <span class=\"cbb-function\">int<\/span>(throttle.<span class=\"cbb-function\">group<\/span>(<span class=\"cbb-number\">1<\/span>), <span class=\"cbb-number\">16<\/span>)\n<\/span><span class=\"cbb-line\">    lines = &#91;\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">\"# HELP rpi_soc_temperature_celsius SoC temperature\"<\/span>,\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">\"# TYPE rpi_soc_temperature_celsius gauge\"<\/span>,\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">\"rpi_soc_temperature_celsius \"<\/span> + temperature.<span class=\"cbb-function\">group<\/span>(<span class=\"cbb-number\">1<\/span>),\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">\"# HELP rpi_soc_throttled_bitmask Complete firmware bitmask\"<\/span>,\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">\"# TYPE rpi_soc_throttled_bitmask gauge\"<\/span>,\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">f\"rpi_soc_throttled_bitmask {mask}\"<\/span>,\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">\"# HELP rpi_hardware_flag Firmware flag; current or since boot\"<\/span>,\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">\"# TYPE rpi_hardware_flag gauge\"<\/span>,\n<\/span><span class=\"cbb-line\">    &#93;\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-keyword\">for<\/span> state, offset <span class=\"cbb-keyword\">in<\/span> ((<span class=\"cbb-string\">\"current\"<\/span>, <span class=\"cbb-number\">0<\/span>), (<span class=\"cbb-string\">\"since_boot\"<\/span>, <span class=\"cbb-number\">16<\/span>)):\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-keyword\">for<\/span> bit, name <span class=\"cbb-keyword\">in<\/span> <span class=\"cbb-function\">enumerate<\/span>(FLAGS):\n<\/span><span class=\"cbb-line\">            value = (mask &gt;&gt; (offset + bit)) &amp; <span class=\"cbb-number\">1<\/span>\n<\/span><span class=\"cbb-line\">            lines.<span class=\"cbb-function\">append<\/span>(<span class=\"cbb-string\">f'rpi_hardware_flag{{state=\"{state}\",flag=\"{name}\"}} {value}'<\/span>)\n<\/span><span class=\"cbb-line\">    lines += &#91;\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">\"# HELP rpi_collector_last_success_timestamp_seconds Last successful collection\"<\/span>,\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">\"# TYPE rpi_collector_last_success_timestamp_seconds gauge\"<\/span>,\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-string\">f\"rpi_collector_last_success_timestamp_seconds {time.time():.3f}\"<\/span>,\n<\/span><span class=\"cbb-line\">    &#93;\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-keyword\">return<\/span> <span class=\"cbb-string\">\"\\n\"<\/span>.<span class=\"cbb-function\">join<\/span>(lines) + <span class=\"cbb-string\">\"\\n\"<\/span>\n<\/span><span class=\"cbb-line\">\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">def<\/span> <span class=\"cbb-function\">publish<\/span>(directory, content):\n<\/span><span class=\"cbb-line\">    directory = <span class=\"cbb-function\">Path<\/span>(directory)\n<\/span><span class=\"cbb-line\">    fd, temporary = tempfile.<span class=\"cbb-function\">mkstemp<\/span>(prefix=<span class=\"cbb-string\">\".rpi-\"<\/span>, suffix=<span class=\"cbb-string\">\".tmp\"<\/span>, dir=directory)\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-keyword\">try<\/span>:\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-keyword\">with<\/span> os.<span class=\"cbb-function\">fdopen<\/span>(fd, <span class=\"cbb-string\">\"w\"<\/span>, encoding=<span class=\"cbb-string\">\"utf-8\"<\/span>) <span class=\"cbb-keyword\">as<\/span> output:\n<\/span><span class=\"cbb-line\">            output.<span class=\"cbb-function\">write<\/span>(content)\n<\/span><span class=\"cbb-line\">            os.<span class=\"cbb-function\">fchmod<\/span>(output.<span class=\"cbb-function\">fileno<\/span>(), 0o644)\n<\/span><span class=\"cbb-line\">        os.<span class=\"cbb-function\">replace<\/span>(temporary, directory \/ <span class=\"cbb-string\">\"rpi_metrics.prom\"<\/span>)\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-keyword\">finally<\/span>:\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-keyword\">if<\/span> os.path.<span class=\"cbb-function\">exists<\/span>(temporary):\n<\/span><span class=\"cbb-line\">            os.<span class=\"cbb-function\">unlink<\/span>(temporary)\n<\/span><span class=\"cbb-line\">\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">if<\/span> __name__ == <span class=\"cbb-string\">\"__main__\"<\/span>:\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-keyword\">if<\/span> <span class=\"cbb-function\">len<\/span>(sys.argv) != <span class=\"cbb-number\">2<\/span>:\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-keyword\">raise<\/span> <span class=\"cbb-function\">SystemExit<\/span>(<span class=\"cbb-string\">\"Usage: rpi-hardware-metrics.py TEXTFILE_DIRECTORY\"<\/span>)\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-function\">publish<\/span>(sys.argv&#91;<span class=\"cbb-number\">1<\/span>&#93;, <span class=\"cbb-function\">collect<\/span>())<\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n<p>Current flags and flags recorded since boot have separate labels. For example, <code>0x50000<\/code> records earlier undervoltage and throttling, without asserting that either condition is active now. Sampling once a minute can miss brief current states; historical flags preserve some of that evidence but do not provide an incident timestamp. Unknown future bits remain visible in the complete bitmask.<\/p>\n<p>Core voltage is deliberately absent. A core rail is not the USB input voltage or a diagnosis of a defective adapter. Pi 5 provides separate readings from its power-management chip (PMIC), such as <code>vcgencmd pmic_read_adc EXT5V_V<\/code>; adding those values requires model-specific parsing and permission tests.<\/p>\n<h2>2. A host collector and timer<\/h2>\n<p>The setup commands assume the three supplied files are in the working directory and the <code>video<\/code> group exists. The <code>rpi-metrics<\/code> account is a new, non-login service account; an existing account must be checked rather than recreated. Raspberry Pi OS must provide <code>\/usr\/bin\/vcgencmd<\/code>. Access to the hardware device depends on the installed OS and must be tested under the service account.<\/p>\n<figure style=\"--cbb-digits:1\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"bash\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">Shell<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: Shell\"><code class=\"cbb-code language-bash\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\"><span class=\"cbb-function\">sudo<\/span> <span class=\"cbb-function\">apt<\/span> update\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">sudo<\/span> <span class=\"cbb-function\">apt<\/span> install prometheus-node-exporter <span class=\"cbb-function\">python3<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">sudo<\/span> <span class=\"cbb-function\">useradd<\/span> <span class=\"cbb-attr\">--system<\/span> <span class=\"cbb-attr\">--user-group<\/span> <span class=\"cbb-attr\">--groups<\/span> video <span class=\"cbb-attr\">--no-create-home<\/span> <span class=\"cbb-attr\">--shell<\/span> \/usr\/sbin\/nologin rpi-metrics\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">sudo<\/span> install <span class=\"cbb-attr\">-d<\/span> <span class=\"cbb-attr\">-o<\/span> rpi-metrics <span class=\"cbb-attr\">-g<\/span> rpi-metrics <span class=\"cbb-attr\">-m<\/span> <span class=\"cbb-number\">755<\/span> \/var\/lib\/node_exporter\/textfile_collector\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">sudo<\/span> install <span class=\"cbb-attr\">-d<\/span> <span class=\"cbb-attr\">-m<\/span> <span class=\"cbb-number\">755<\/span> \/usr\/<span class=\"cbb-keyword\">local<\/span>\/libexec\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">sudo<\/span> install <span class=\"cbb-attr\">-m<\/span> <span class=\"cbb-number\">755<\/span> rpi-hardware-metrics.py \/usr\/<span class=\"cbb-keyword\">local<\/span>\/libexec\/rpi-hardware-metrics.py\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">sudo<\/span> install <span class=\"cbb-attr\">-m<\/span> <span class=\"cbb-number\">644<\/span> rpi-collector.<span class=\"cbb-function\">service<\/span> rpi-collector.timer \/etc\/systemd\/system\/<\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n<p>The file <code>rpi-collector.service<\/code> contains:<\/p>\n<figure style=\"--cbb-digits:2\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"ini\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">Config<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: Config\"><code class=\"cbb-code language-ini\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\"><span class=\"cbb-type\">&#91;Unit&#93;<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">Description<\/span>=Collect Raspberry Pi firmware metrics\n<\/span><span class=\"cbb-line\">\n<\/span><span class=\"cbb-line\"><span class=\"cbb-type\">&#91;Service&#93;<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">Type<\/span>=oneshot\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">User<\/span>=rpi-metrics\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">SupplementaryGroups<\/span>=video\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">ExecStart<\/span>=\/usr\/bin\/python3 \/usr\/local\/libexec\/rpi-hardware-metrics.py \/var\/lib\/node_exporter\/textfile_collector\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">NoNewPrivileges<\/span>=<span class=\"cbb-constant\">true<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">ProtectSystem<\/span>=strict\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">ProtectHome<\/span>=<span class=\"cbb-constant\">true<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">ReadWritePaths<\/span>=\/var\/lib\/node_exporter\/textfile_collector<\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n<p>The file <code>rpi-collector.timer<\/code> contains:<\/p>\n<figure style=\"--cbb-digits:2\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"ini\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">Config<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: Config\"><code class=\"cbb-code language-ini\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\"><span class=\"cbb-type\">&#91;Unit&#93;<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">Description<\/span>=Collect Raspberry Pi firmware metrics periodically\n<\/span><span class=\"cbb-line\">\n<\/span><span class=\"cbb-line\"><span class=\"cbb-type\">&#91;Timer&#93;<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">OnBootSec<\/span>=<span class=\"cbb-number\">30s<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">OnUnitActiveSec<\/span>=<span class=\"cbb-number\">60s<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">AccuracySec<\/span>=<span class=\"cbb-number\">1s<\/span>\n<\/span><span class=\"cbb-line\">\n<\/span><span class=\"cbb-line\"><span class=\"cbb-type\">&#91;Install&#93;<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">WantedBy<\/span>=timers.target<\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n<p><code>sudo -u rpi-metrics \/usr\/bin\/vcgencmd measure_temp<\/code> and the corresponding <code>get_throttled<\/code> call check actual access. The exporter must be able to read the directory and generated file. The script is root-owned after installation; the service account writes only the collector output directory.<\/p>\n<p>For the Debian-packaged exporter, <code>systemctl cat prometheus-node-exporter<\/code> shows how startup arguments are loaded. In installations using <code>\/etc\/default\/prometheus-node-exporter<\/code>, the existing <code>ARGS<\/code> needs <code>--collector.textfile.directory=\/var\/lib\/node_exporter\/textfile_collector<\/code> and <code>--web.listen-address=127.0.0.1:9100<\/code>. Existing unrelated options remain necessary; duplicate directory or listen flags must be resolved. The installed package&#8217;s configuration takes precedence over an assumed file layout.<\/p>\n<p>After configuration, <code>sudo systemctl restart prometheus-node-exporter<\/code>, <code>sudo systemctl daemon-reload<\/code> and <code>sudo systemctl enable --now rpi-collector.timer<\/code> activate the services. <code>sudo systemctl start rpi-collector.service<\/code> performs an initial run. Failures remain visible through <code>journalctl -u rpi-collector.service<\/code>; repeated installation does not append duplicate cron entries.<\/p>\n<h2>3. Measurement storage with Prometheus<\/h2>\n<p>The following <code>compose.yaml<\/code> uses host networking on Linux so container loopback reaches the host exporter. Explicit listen addresses keep Prometheus and Grafana local. A protected <code>.env<\/code> defines tested ARM-compatible image references for <code>PROMETHEUS_IMAGE<\/code> and <code>GRAFANA_IMAGE<\/code>, plus a unique <code>GRAFANA_ADMIN_PASSWORD<\/code> for first initialization. An existing Grafana database retains its existing administrator password.<\/p>\n<figure style=\"--cbb-digits:2\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"yaml\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">YAML<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: YAML\"><code class=\"cbb-code language-yaml\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\"><span class=\"cbb-attr\">services<\/span>:\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">prometheus<\/span>:\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">image<\/span>: ${PROMETHEUS_IMAGE:?set tested prom\/prometheus release}\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">network_mode<\/span>: host\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">restart<\/span>: unless-stopped\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">command<\/span>:\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> --config.file=\/etc\/prometheus\/prometheus.yml\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> --storage.tsdb.path=\/prometheus\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> --storage.tsdb.retention.time=7d\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> --web.listen-address=127.0.0.1:9090\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">volumes<\/span>:\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> .\/prometheus.yml:\/etc\/prometheus\/prometheus.yml:ro\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> .\/alerts.yml:\/etc\/prometheus\/alerts.yml:ro\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> prometheus-data:\/prometheus\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">grafana<\/span>:\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">image<\/span>: ${GRAFANA_IMAGE:?set tested grafana\/grafana release}\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">network_mode<\/span>: host\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">restart<\/span>: unless-stopped\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">environment<\/span>:\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-attr\">GF_SERVER_HTTP_ADDR<\/span>: 127.0.0.1\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-attr\">GF_SERVER_HTTP_PORT<\/span>: <span class=\"cbb-string\">\"3000\"<\/span>\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-attr\">GF_SECURITY_ADMIN_PASSWORD<\/span>: ${GRAFANA_ADMIN_PASSWORD:?set initial admin password}\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-attr\">GF_AUTH_ANONYMOUS_ENABLED<\/span>: <span class=\"cbb-string\">\"false\"<\/span>\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">volumes<\/span>:\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> grafana-data:\/var\/lib\/grafana\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">volumes<\/span>:\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">prometheus-data<\/span>:\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">grafana-data<\/span>:<\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n<p>The file <code>prometheus.yml<\/code> in the same directory contains:<\/p>\n<figure style=\"--cbb-digits:1\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"yaml\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">YAML<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: YAML\"><code class=\"cbb-code language-yaml\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\"><span class=\"cbb-attr\">global<\/span>:\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">scrape_interval<\/span>: 15s\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">evaluation_interval<\/span>: 15s\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">rule_files<\/span>:\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-operator\">-<\/span> \/etc\/prometheus\/alerts.yml\n<\/span><span class=\"cbb-line\"><span class=\"cbb-attr\">scrape_configs<\/span>:\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-operator\">-<\/span> <span class=\"cbb-attr\">job_name<\/span>: raspberry_pi\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">static_configs<\/span>:\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> <span class=\"cbb-attr\">targets<\/span>: &#91;<span class=\"cbb-string\">\"127.0.0.1:9100\"<\/span>&#93;<\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n<p>Seven-day retention is an example, not a disk-size limit. Named volumes retain data when containers are recreated. Free space, storage writes and backups need their own monitoring. The 15-second scrape does not make the collector&#8217;s approximately 60-second measurements more frequent.<\/p>\n<h2>4. Alert rules and notifications are separate<\/h2>\n<p>The following <code>alerts.yml<\/code> checks both measurements and collection health. The 75 \u00b0C threshold is an example operating threshold, not a universal hardware limit. The missing-series rule assumes this one-target job; multiple hosts need per-target absence handling.<\/p>\n<figure style=\"--cbb-digits:2\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"yaml\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">YAML<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: YAML\"><code class=\"cbb-code language-yaml\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\"><span class=\"cbb-attr\">groups<\/span>:\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-operator\">-<\/span> <span class=\"cbb-attr\">name<\/span>: raspberry_pi\n<\/span><span class=\"cbb-line\">    <span class=\"cbb-attr\">rules<\/span>:\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> <span class=\"cbb-attr\">alert<\/span>: PiExporterDown\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">expr<\/span>: up{job=<span class=\"cbb-string\">\"raspberry_pi\"<\/span>} == <span class=\"cbb-number\">0<\/span>\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">for<\/span>: 2m\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> <span class=\"cbb-attr\">alert<\/span>: PiCollectorStale\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">expr<\/span>: time() <span class=\"cbb-operator\">-<\/span> rpi_collector_last_success_timestamp_seconds{job=<span class=\"cbb-string\">\"raspberry_pi\"<\/span>} &gt; <span class=\"cbb-number\">180<\/span>\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">for<\/span>: 1m\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> <span class=\"cbb-attr\">alert<\/span>: PiCollectorMissing\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">expr<\/span>: absent(rpi_collector_last_success_timestamp_seconds{job=<span class=\"cbb-string\">\"raspberry_pi\"<\/span>})\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">for<\/span>: 2m\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> <span class=\"cbb-attr\">alert<\/span>: PiTextfileError\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">expr<\/span>: node_textfile_scrape_error{job=<span class=\"cbb-string\">\"raspberry_pi\"<\/span>} == <span class=\"cbb-number\">1<\/span>\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">for<\/span>: 1m\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> <span class=\"cbb-attr\">alert<\/span>: PiTemperatureHigh\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">expr<\/span>: rpi_soc_temperature_celsius{job=<span class=\"cbb-string\">\"raspberry_pi\"<\/span>} &gt; <span class=\"cbb-number\">75<\/span>\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">for<\/span>: 5m\n<\/span><span class=\"cbb-line\">      <span class=\"cbb-operator\">-<\/span> <span class=\"cbb-attr\">alert<\/span>: PiCurrentFirmwareWarning\n<\/span><span class=\"cbb-line\">        <span class=\"cbb-attr\">expr<\/span>: rpi_hardware_flag{job=<span class=\"cbb-string\">\"raspberry_pi\"<\/span>,state=<span class=\"cbb-string\">\"current\"<\/span>} == <span class=\"cbb-number\">1<\/span><\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n<p><code>docker compose config --quiet<\/code> checks the Compose configuration. The selected image&#8217;s <code>promtool check config<\/code> and <code>promtool check rules<\/code> validate Prometheus files before startup. <code>docker compose up -d<\/code> starts the stack. These rules expose pending\/firing states in Prometheus; no email or push message is sent until an Alertmanager integration is configured and tested. A Grafana panel threshold alone is also not a notification rule.<\/p>\n<p>On the workstation, <code>ssh -N -L 3000:127.0.0.1:3000 -L 9090:127.0.0.1:9090 ACCOUNT@PI_ADDRESS<\/code> forwards the local browser ports. The placeholders identify the actual SSH account and Pi address. Grafana then opens at <code>http:\/\/127.0.0.1:3000<\/code>; its Prometheus data source uses <code>http:\/\/127.0.0.1:9090<\/code> because both containers share the host network.<\/p>\n<h2>Useful panels and their limits<\/h2>\n<ul><li><code>rpi_soc_temperature_celsius<\/code>: sampled SoC temperature.<\/li><li><code>rpi_hardware_flag{state=\"current\"}<\/code>: current firmware flags; <code>state=\"since_boot\"<\/code> shows recorded incidents.<\/li><li><code>100 * rate(node_disk_io_time_seconds_total[5m])<\/code>: device busy-time percentage, subject to kernel accounting limits. This is neither flash wear nor request latency.<\/li><li><code>100 * node_memory_MemAvailable_bytes \/ node_memory_MemTotal_bytes<\/code>: available memory percentage, not a rate per second.<\/li><\/ul>\n<p>Device selection prevents misleading comparisons of physical disks and virtual devices. Storage wear requires supported SMART\/NVMe or manufacturer health data; many SD cards expose little usable wear information. High busy time alone does not identify a worn controller.<\/p>\n<div class=\"lw-faq\"><h2>Questions and answers<\/h2><h3>How is the pipeline verified without stressing storage?<\/h3><p>Exporter reachability, <code>up<\/code>, <code>node_textfile_scrape_error<\/code>, last-success age and timer logs provide the first checks. In a separate test environment, a paused timer should produce a stale-data alert; malformed synthetic command responses should leave the last good file intact. An intensive random-write benchmark is unnecessary for this verification.<\/p><h3>Does an undervoltage flag identify the cause?<\/h3><p>No. The flag reports a detected state. Power supply, cable, connectors and peripheral load require separate investigation. Temperature and throttling data describe symptoms; neither a graph nor a flag guarantees prevention of an outage.<\/p><h3>Does 127.0.0.1 always refer to the host?<\/h3><p>No. Ordinary bridge containers have separate loopback interfaces. This example explicitly uses host networking. A different network layout needs a reachable exporter address and a matching Grafana data-source URL.<\/p><\/div>\n\n<div class=\"lw-quellen\">\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/prometheus.io\/docs\/introduction\/overview\/\" target=\"_blank\" rel=\"noopener noreferrer\">Prometheus documentation<\/a><\/li>\n<li><a href=\"https:\/\/grafana.com\/docs\/grafana\/latest\/\" target=\"_blank\" rel=\"noopener noreferrer\">Grafana documentation<\/a><\/li>\n<li><a href=\"https:\/\/www.raspberrypi.com\/documentation\/computers\/os.html\" target=\"_blank\" rel=\"noopener noreferrer\">vcgencmd: temperature, bit definitions, core voltage versus Pi5 PMIC<\/a><\/li>\n<li><a href=\"https:\/\/raw.githubusercontent.com\/prometheus\/node_exporter\/master\/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">Node Exporter: host metrics and atomic textfile publishing<\/a><\/li>\n<li><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/configuration\/alerting_rules\/\" target=\"_blank\" rel=\"noopener noreferrer\">Prometheus: rule activation and for durations<\/a><\/li>\n<li><a href=\"https:\/\/www.kernel.org\/doc\/Documentation\/iostats.txt\" target=\"_blank\" rel=\"noopener noreferrer\">Linux: disk busy time versus other I\/O statistics<\/a><\/li>\n<li><a href=\"https:\/\/grafana.com\/docs\/grafana\/latest\/setup-grafana\/configure-grafana\/\" target=\"_blank\" rel=\"noopener noreferrer\">Grafana: loopback binding and environment settings<\/a><\/li>\n<li><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/querying\/functions\/\" target=\"_blank\" rel=\"noopener noreferrer\">PromQL: absent and time<\/a><\/li>\n<li><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/command-line\/prometheus\/\" target=\"_blank\" rel=\"noopener noreferrer\">Prometheus: web listener and retention flags<\/a><\/li>\n<\/ul>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Temperature, firmware warnings and Linux measurements on a Raspberry Pi, collected with error handling and displayed with Prometheus and Grafana. Separate alert rules detect missing or outdated measurements.<\/p>\n","protected":false},"author":1,"featured_media":32137,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92630],"tags":[91144,91113,91294,91181,91219],"class_list":["post-536","post","type-post","status-publish","format-standard","hentry","category-tutorials-en-raspberry-pi","tag-devops","tag-homelab","tag-monitoring","tag-raspberry-pi","tag-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Raspberry Pi Monitoring with Prometheus and Grafana | Lukas Wojcik<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Raspberry Pi Monitoring with Prometheus and Grafana | Lukas Wojcik\" \/>\n<meta property=\"og:description\" content=\"Temperature, firmware warnings and Linux measurements on a Raspberry Pi, collected with error handling and displayed with Prometheus and Grafana. Separate alert rules detect missing or outdated measurements.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-08T08:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-15T11:06:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-536-536.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lukas Wojcik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lukas Wojcik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/\"},\"author\":{\"name\":\"Lukas Wojcik\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"Raspberry Pi Monitoring with Prometheus and Grafana\",\"datePublished\":\"2026-10-08T08:30:00+00:00\",\"dateModified\":\"2026-11-15T11:06:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/\"},\"wordCount\":958,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll2-536-536.png\",\"keywords\":[\"DevOps\",\"Homelab\",\"Monitoring\",\"Raspberry Pi\",\"Tutorial\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/\",\"name\":\"Raspberry Pi Monitoring with Prometheus and Grafana | Lukas Wojcik\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll2-536-536.png\",\"datePublished\":\"2026-10-08T08:30:00+00:00\",\"dateModified\":\"2026-11-15T11:06:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll2-536-536.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll2-536-536.png\",\"width\":1200,\"height\":630,\"caption\":\"Raspberry Pi Monitoring with Prometheus and Grafana\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/raspberry-pi\\\/tutorials-en-raspberry-pi\\\/raspberry-pi-monitoring-with-prometheus-and-grafana\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Raspberry Pi Monitoring with Prometheus and Grafana\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"Lukas Wojcik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"Lukas Wojcik\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Raspberry Pi Monitoring with Prometheus and Grafana | Lukas Wojcik","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/","og_locale":"en_US","og_type":"article","og_title":"Raspberry Pi Monitoring with Prometheus and Grafana | Lukas Wojcik","og_description":"Temperature, firmware warnings and Linux measurements on a Raspberry Pi, collected with error handling and displayed with Prometheus and Grafana. Separate alert rules detect missing or outdated measurements.","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"2026-10-08T08:30:00+00:00","article_modified_time":"2026-11-15T11:06:19+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-536-536.png","type":"image\/png"}],"author":"Lukas Wojcik","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lukas Wojcik","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/"},"author":{"name":"Lukas Wojcik","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"Raspberry Pi Monitoring with Prometheus and Grafana","datePublished":"2026-10-08T08:30:00+00:00","dateModified":"2026-11-15T11:06:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/"},"wordCount":958,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-536-536.png","keywords":["DevOps","Homelab","Monitoring","Raspberry Pi","Tutorial"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/","name":"Raspberry Pi Monitoring with Prometheus and Grafana | Lukas Wojcik","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/#primaryimage"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-536-536.png","datePublished":"2026-10-08T08:30:00+00:00","dateModified":"2026-11-15T11:06:19+00:00","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/#primaryimage","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-536-536.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-536-536.png","width":1200,"height":630,"caption":"Raspberry Pi Monitoring with Prometheus and Grafana"},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/raspberry-pi\/tutorials-en-raspberry-pi\/raspberry-pi-monitoring-with-prometheus-and-grafana\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/de\/"},{"@type":"ListItem","position":2,"name":"Raspberry Pi Monitoring with Prometheus and Grafana"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"Lukas Wojcik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"Lukas Wojcik"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=536"}],"version-history":[{"count":11,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/536\/revisions"}],"predecessor-version":[{"id":26532,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/536\/revisions\/26532"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/32137"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}