Local FastAPI + FastMCP tooling for storage-node monitoring and Ollama-assisted answers.
It can inspect:
- Sia and Storj Docker/systemd nodes
- disk space through
df,findmnt, andlsblk - ZFS pools/datasets when ZFS is installed
- ext4, btrfs, xfs and other mounted filesystems through generic mount usage
- SMART identity and selected health attributes when
smartctlis available
Real secrets and runtime files are ignored by .gitignore:
.envtelegram-bot/.env.state.jsonlogs/run/.venv/searxng/searxng/settings.yml
Use .env.example and telegram-bot/.env.example as templates.
If a Telegram bot token was ever committed, pasted into logs, or shared, revoke it in BotFather and create a new one.
Recommended OS: Linux with Python 3.12+.
Install system packages:
sudo apt update
sudo apt install -y python3 python3-venv python3-pip curl util-linux smartmontoolsOptional packages:
sudo apt install -y docker.io
sudo apt install -y zfsutils-linuxNotes:
docker.iois only needed for Docker container discovery.zfsutils-linuxis only needed on ZFS hosts.- Non-ZFS hosts still work through
df,findmnt, andlsblk. - SMART details may require root or passwordless sudo for
smartctl.
Clone the repository:
git clone https://github.com/jh0per/Ai-Stack.git
cd Ai-StackCreate the main virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .envEdit .env:
nano .envImportant options:
LANGUAGE=ukorLANGUAGE=enOLLAMA_URL=http://127.0.0.1:11434/api/chatOLLAMA_MODEL=ua-techSMARTCTL_USE_SUDO=0by default; set to1only if passwordless sudo is configured forsmartctlFS_ALLOWED_ROOTS=/mntor another safe comma-separated path listWEB_SEARCH_ENABLED=0unless you run local SearXNG
Start the MCP storage server and gateway:
./run.shCheck status:
curl http://127.0.0.1:3700/health
curl http://127.0.0.1:3700/storage/statusStop services:
./stop.shIf you want SMART health without running the whole app as root, allow only smartctl:
sudo visudo -f /etc/sudoers.d/storage-ai-smartctlAdd this line, replacing your_user:
your_user ALL=(root) NOPASSWD: /usr/sbin/smartctl
Then set:
SMARTCTL_USE_SUDO=1in .env, and restart:
./stop.sh
./run.shcd telegram-bot
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .envEdit telegram-bot/.env and set BOT_TOKEN and ALLOWED_CHAT_ID.
Set STORAGE_STATUS_URL if the gateway is not on http://127.0.0.1:3700/storage/status.
Run manually:
python bot.pyInstall as a systemd service:
sudo cp ../systemd/zfs-ai-telegram.service.example /etc/systemd/system/zfs-ai-telegram.service
sudo nano /etc/systemd/system/zfs-ai-telegram.serviceAdjust:
User=...WorkingDirectory=.../Ai-Stack/telegram-botEnvironmentFile=.../Ai-Stack/telegram-bot/.envExecStart=.../Ai-Stack/telegram-bot/.venv/bin/python .../Ai-Stack/telegram-bot/bot.py
Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable --now zfs-ai-telegram.service
systemctl status zfs-ai-telegram.service --no-pagerThe current Telegram bot commands are still ZFS-oriented. The HTTP gateway status endpoint is filesystem-generic and supports non-ZFS mounts.
Useful Telegram commands:
/status- main generic storage/Sia/Storj/filesystem status from the gateway/problems- only storage problems from the gateway/smart- SMART and disk health summary from the gateway/storage- alias-style explicit storage status command/health- alias for/status/disks- alias for/smart/zfs- legacy ZFS-focused status/pools,/datasets,/raw,/intro,/askzfs- ZFS-only commands
Local web search is optional.
cd searxng
cp settings.yml.example searxng/settings.yml
docker compose up -dThen set in .env:
WEB_SEARCH_ENABLED=1
SEARXNG_URL=http://127.0.0.1:8888/search
SMART_WEB_DEFAULT=1Before pushing your own fork, check what would be committed:
git add -n .These must not appear:
.envtelegram-bot/.env.state.json.venv/logs/run/searxng/searxng/settings.yml
Run a quick secret scan:
rg -n "BOT_TOKEN=|ALLOWED_CHAT_ID=[0-9]+|secret_key:|PASSWORD|TOKEN|SECRET|API_KEY" --hidden --glob '!.git/**' --glob '!*.env' .Check gateway logs:
tail -n 100 logs/ollama-agent-gateway.log
tail -n 100 logs/mcp-storage-server.logCheck Telegram service logs:
journalctl -u zfs-ai-telegram.service -n 100 --no-pagerIf /storage/status reports unknown SMART drives, verify:
smartctl --scan-open
sudo -n smartctl --scan-open