docs: sync KB — apcupsd-ups-monitoring.md,llama-cpp-setup.md

This commit is contained in:
Cal Corum 2026-04-06 18:00:47 -05:00
parent ffb036042c
commit 92c5ce0ebb
2 changed files with 195 additions and 0 deletions

View File

@ -0,0 +1,128 @@
---
title: "APC UPS Monitoring with apcupsd and Discord Alerts"
description: "Setup guide for apcupsd on nobara-pc workstation with Discord webhook alerts for power events (on battery, off battery, battery replace, comm failure/restore)."
type: guide
domain: monitoring
tags: [apcupsd, ups, discord, webhook, power, alerts, usb]
---
# APC UPS Monitoring with apcupsd
## Overview
apcupsd monitors the APC Back-UPS RS 1500MS2 connected via USB to the workstation (nobara-pc). Discord alerts fire automatically on power events via webhook scripts in `/etc/apcupsd/`.
## Hardware
- **UPS Model**: Back-UPS RS 1500MS2
- **Connection**: USB (vendor ID `051d:0002`)
- **Nominal Power**: 900W
- **Nominal Battery Voltage**: 24V
- **Serial**: 0B2544L30372
## Configuration
**Config file**: `/etc/apcupsd/apcupsd.conf`
Key settings:
```
UPSNAME WS-UPS
UPSCABLE usb
UPSTYPE usb
DEVICE # blank = USB autodetect
POLLTIME 15 # poll every 15 seconds
SENSE Medium # UPS-side sensitivity (set in EEPROM)
LOTRANS 88.0 Volts # switch to battery below this
HITRANS 144.0 Volts # switch to battery above this
BATTERYLEVEL 5 # shutdown at 5% charge
MINUTES 3 # shutdown at 3 min remaining
```
## Service
```bash
sudo systemctl enable --now apcupsd
systemctl status apcupsd
```
## Useful Commands
```bash
# Full status dump
apcaccess status
# Single field (no parsing needed)
apcaccess -p LINEV
apcaccess -p LASTXFER
apcaccess -p BCHARGE
# View event log
cat /var/log/apcupsd.events
# Watch events in real-time
tail -f /var/log/apcupsd.events
```
## Discord Alerts
Five event scripts in `/etc/apcupsd/` send Discord embeds to the `#homelab-alerts` webhook:
| Script | Trigger | Embed Color |
|--------|---------|-------------|
| `onbattery` | UPS switches to battery | Red (0xFF6B6B) |
| `offbattery` | Line power restored | Green (0x57F287) |
| `changeme` | Battery needs replacement | Yellow (0xFFFF00) |
| `commfailure` | USB communication lost | Red (0xFF6B6B) |
| `commok` | USB communication restored | Green (0x57F287) |
All scripts use the same webhook URL as other monitoring scripts (jellyfin_gpu_monitor, nvidia_update_checker).
The `onbattery` alert includes line voltage, load percentage, battery charge, and time remaining — useful for diagnosing whether transfers are caused by voltage sags vs other issues.
## Troubleshooting
### UPS not detected
```bash
# Check USB connection
lsusb | grep 051d
# If missing, try a different USB port or cable
# The UPS uses vendor ID 051d:0002
```
### No Discord alerts on power event
```bash
# Test the script manually
sudo /etc/apcupsd/onbattery WS-UPS
# Check that curl is available at /usr/bin/curl
which curl
# Verify webhook URL is still valid
curl -s -o /dev/null -w "%{http_code}" -H "Content-Type: application/json" \
-X POST "WEBHOOK_URL" -d '{"content":"test"}'
# Should return 204
```
### LASTXFER shows "Low line voltage"
This means input voltage is dropping below the LOTRANS threshold (88V). Common causes:
- Heavy appliance on the same circuit (HVAC, fridge compressor)
- Loose wiring/outlet connection
- Utility-side voltage sags
- Overloaded circuit
Correlate event timestamps from `/var/log/apcupsd.events` with appliance cycling to identify the source.
### Frequent unnecessary transfers
If sensitivity is too high, the UPS transfers on minor sags that don't affect equipment:
- Check current: `apcaccess -p SENSE`
- Lower via `apctest` EEPROM menu (requires stopping apcupsd first)
- Options: High → Medium → Low
## Initial Diagnostics (2026-04-06)
- Two different APC UPS units exhibited the same on_batt/on_line bouncing behavior
- `LASTXFER: Low line voltage` confirmed voltage sags as the cause
- Sensitivity already at Medium — transfers are from real sags below 88V
- Load at 49% (441W of 900W capacity) — not overloaded
- Next steps: correlate event timestamps with appliance activity, try different circuit, electrician inspection

View File

@ -0,0 +1,67 @@
---
title: "llama.cpp Installation and Setup"
description: "llama.cpp b8680 Vulkan build installation on workstation with RTX 4080 Super, including model download workflow."
type: reference
domain: workstation
tags: [llama-cpp, vulkan, nvidia, gguf, local-inference]
---
## Installation
Installed from pre-built release binary (no CUDA build available for Linux — Vulkan is the correct choice for NVIDIA GPUs):
```bash
# Extract to /opt
sudo mkdir -p /opt/llama.cpp
sudo tar -xzf llama-b8680-bin-ubuntu-vulkan-x64.tar.gz -C /opt/llama.cpp --strip-components=1
# Symlink all binaries to PATH
for bin in /opt/llama.cpp/llama-*; do
sudo ln -sf "$bin" /usr/local/bin/$(basename "$bin")
done
```
**Version**: b8680
**Backends loaded**: Vulkan (GPU), CPU (Zen4 for 7800X3D), RPC
**Source**: https://github.com/ggml-org/llama.cpp/releases
## Release Binary Options (Linux x64)
| Build | Use case |
|-------|----------|
| `ubuntu-x64` | CPU only |
| `ubuntu-vulkan-x64` | NVIDIA/AMD GPU via Vulkan |
| `ubuntu-rocm-x64` | AMD GPU via ROCm |
| `ubuntu-openvino-x64` | Intel CPU/GPU/NPU |
No pre-built CUDA binary exists — Vulkan is the NVIDIA option. For native CUDA, build from source with `-DGGML_CUDA=ON`.
## Models
Stored in `/home/cal/Models/`.
| Model | File | Size |
|-------|------|------|
| Qwen3.5-9B Q4_K_M | `Qwen3.5-9B-Q4_K_M.gguf` | 5.3 GB |
## Downloading Models
The built-in `-hf` downloader can stall. Use `curl` with resume support instead:
```bash
curl -L -C - --progress-bar \
-o /home/cal/Models/<model>.gguf \
"https://huggingface.co/<org>/<repo>/resolve/main/<model>.gguf"
```
`-C -` enables resume if the download is interrupted.
## Running
```bash
# Full GPU offload
llama-cli -m /home/cal/Models/Qwen3.5-9B-Q4_K_M.gguf -ngl 99
# Server mode
llama-server -m /home/cal/Models/Qwen3.5-9B-Q4_K_M.gguf -ngl 99 --port 8080
```