From 3d3f91160bbf4f6ad01cde38436b00cc9d932f3e Mon Sep 17 00:00:00 2001 From: Andrew Stoltz Date: Wed, 22 Apr 2026 22:07:40 -0500 Subject: [PATCH] monitoring: add Print.Web Ollama Zabbix template --- .../templates/flowercore-print-ollama.yaml | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 apps/zabbix/templates/flowercore-print-ollama.yaml diff --git a/apps/zabbix/templates/flowercore-print-ollama.yaml b/apps/zabbix/templates/flowercore-print-ollama.yaml new file mode 100644 index 0000000..143f83d --- /dev/null +++ b/apps/zabbix/templates/flowercore-print-ollama.yaml @@ -0,0 +1,96 @@ +zabbix_export: + version: '7.2' + template_groups: + - uuid: 30a90fb5fb3e4a7f9bb4517022c7726a + name: Templates/FlowerCore + templates: + - uuid: 89cecb27144c4b539bd8972d4d949063 + template: FlowerCore Print Ollama + name: FlowerCore Print Ollama + description: FlowerCore Print.Web Ollama health probe checks. Import this template into Zabbix and link it to the Print.Web host. + groups: + - name: Templates/FlowerCore + items: + - uuid: 8fd2720255d54bc8bda0fe3ab4677c6c + name: Print.Web metrics snapshot + type: HTTP_AGENT + key: flowercore.print.ollama.snapshot + delay: 30s + history: 7d + trends: '0' + value_type: TEXT + url: http://10.0.57.16:5200/api/metrics + timeout: 5s + description: Raw JSON from Print.Web GET /api/metrics. The Ollama summary is public monitoring data; /api/ai/ollama-snapshot remains API-key protected. + - uuid: 5cb902556e9f45c2b4c29c5c4a32fd73 + name: Print.Web Ollama long keep-alive runner count + type: DEPENDENT + key: flowercore.print.ollama.long_keepalive.count + delay: '0' + history: 7d + trends: 30d + value_type: UNSIGNED + description: Number of active Ollama runners whose keep-alive window remains above 10 minutes. + preprocessing: + - type: JAVASCRIPT + parameters: + - | + var payload = JSON.parse(value); + var ollama = payload.ollama || payload.Ollama || {}; + var runners = ollama.runners || ollama.Runners || []; + if (!Array.isArray(runners)) { + return 0; + } + + var count = 0; + for (var i = 0; i < runners.length; i += 1) { + var runner = runners[i] || {}; + var markedLong = runner.longKeepAlive || runner.LongKeepAlive; + var remainingRaw = runner.keepAliveRemainingSeconds; + if (remainingRaw === undefined || remainingRaw === null) { + remainingRaw = runner.KeepAliveRemainingSeconds; + } + var remaining = Number(remainingRaw || 0); + if (markedLong === true || remaining > 600) { + count += 1; + } + } + + return count; + master_item: + key: flowercore.print.ollama.snapshot + - uuid: 73680dcbbe4844f48378c9f3042641f1 + name: Print.Web Ollama active runner count + type: DEPENDENT + key: flowercore.print.ollama.active_runner.count + delay: '0' + history: 7d + trends: 30d + value_type: UNSIGNED + description: Active runner count from the Print.Web Ollama snapshot. + preprocessing: + - type: JAVASCRIPT + parameters: + - | + var payload = JSON.parse(value); + var ollama = payload.ollama || payload.Ollama || {}; + var activeRunnerRaw = ollama.activeRunnerCount; + if (activeRunnerRaw === undefined || activeRunnerRaw === null) { + activeRunnerRaw = ollama.ActiveRunnerCount; + } + var activeRunnerCount = Number(activeRunnerRaw); + if (!isNaN(activeRunnerCount)) { + return activeRunnerCount; + } + + var runners = ollama.runners || ollama.Runners || []; + return Array.isArray(runners) ? runners.length : 0; + master_item: + key: flowercore.print.ollama.snapshot + triggers: + - uuid: 8fcd85b7e6e9423099b5e2bcbba3537e + expression: last(/FlowerCore Print Ollama/flowercore.print.ollama.long_keepalive.count)>0 + name: Print.Web Ollama runner keep-alive exceeds 10 minutes + priority: WARNING + description: Print.Web reports at least one active Ollama runner with more than 10 minutes of keep-alive remaining. Check the Admin Ollama Fleet panel and stop duplicate model callers before the Pi 5 Ollama lane thrashes. + manual_close: 'YES'