Skip to content
Back to skills

Monitor Ollama

ASecurity

Continuous Ollama health monitor with auto-restart. Detects hung runner processes (1000%+ CPU spin where /api/tags responds but /api/chat hangs). Runs the watchdog check and restarts Ollama if needed. Designed to run on a scheduler every 2 minutes.

  • 6 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 11, 2026
businessbashapi

Works with

  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add grahama1970/agent-skills --skill monitor-ollama --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Monitor Ollama?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Monitor Ollama
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/grahama1970-monitor-ollama/badge)](https://www.skillsdirectory.com/skills/grahama1970-monitor-ollama)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: monitor-ollama
description: >
  Continuous Ollama health monitor with auto-restart. Detects hung runner
  processes (1000%+ CPU spin where /api/tags responds but /api/chat hangs).
  Runs the watchdog check and restarts Ollama if needed. Designed to run
  on a scheduler every 2 minutes.
triggers:
  - monitor ollama
  - is ollama hung
  - ollama watchdog
  - check ollama health
  - ollama runner stuck
allowed-tools:
  - Bash
  - Read
metadata:
  short-description: Continuous Ollama watchdog with auto-restart on hung runner
provides:
  - ollama-monitoring
composes:
  - ops-llm
  - task-monitor
  - agentic-evals
taxonomy:
  - monitoring
  - operations
  - llm
disciplines:
  - observability-operations
  - model-ops
---

# monitor-ollama

Continuous health monitor for Ollama. Catches the specific failure mode where
the Ollama runner process hangs at 1000%+ CPU, causing all chat requests to
timeout while the API tags endpoint still responds.

## Quick Start

```bash
# One-shot health check
./scripts/check.sh

# Install cron watchdog (every 2 minutes)
./scripts/install-cron.sh

# Remove cron watchdog
./scripts/uninstall-cron.sh
```

## What It Checks

1. **Process alive**: Is the `ollama` process running?
2. **API reachable**: Does `/api/tags` respond within 5s?
3. **Model responsive**: Does `/api/chat` complete within 8s? (catches hung runner)

## Auto-Restart Behavior

When the chat probe times out:
1. Tries `systemctl restart ollama`
2. Falls back to `pkill -9 ollama` + start
3. Verifies recovery
4. Logs to `/tmp/ollama_watchdog.log`

## Environment Variables

| Variable                 | Default                    | Description               |
| ------------------------ | -------------------------- | ------------------------- |
| `OLLAMA_API_BASE`        | `http://127.0.0.1:11434`  | Ollama HTTP endpoint      |
| `OLLAMA_MODEL`           | `qwen2.5:0.5b`            | Model to probe            |
| `OLLAMA_WATCHDOG_TIMEOUT`| `8`                        | Chat probe timeout (sec)  |
| `WATCHDOG_DRY_RUN`       | `0`                        | Set to 1 for check-only   |

Files in this skill

  • SKILL.md2.1 KB
  • fixtures/agentic_eval.json622 B
  • scripts/check.sh2.6 KB
  • scripts/install-cron.sh793 B
  • scripts/uninstall-cron.sh406 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.