Building Your Morning Infrastructure Briefing
- Write a self-contained cron prompt that covers VMs, storage, and network checks with explicit commands and host IPs
- Add a scheduled cron job with a standard cron expression and verify it with hermes cron list
- Configure Telegram delivery and test the briefing with hermes cron run before waiting for the schedule
- Choose between SSH hop and API-based approaches for accessing multiple hosts from a single cron job
The Goal
By the end of this lesson, your Hermes agent will wake up at 7 AM every day, run a series of infrastructure checks, synthesize the results into a plain-English briefing, and send it to you on Telegram -- without you doing anything.
This is the payoff of the previous four lessons. The SSH backend (Lesson 3), Proxmox queries (Lesson 4), storage checks (Lesson 5), and network checks (Lesson 6) all become ingredients in a single automated workflow.
How Hermes Cron Works
Hermes has a built-in cron scheduler that accepts standard cron expressions and a natural-language prompt. The critical thing to understand before writing your briefing prompt is:
Cron jobs run in a completely fresh session with no memory of previous conversations.
This means your cron prompt must be entirely self-contained. It cannot refer to "what we discussed earlier" or assume the agent knows your infrastructure topology. Everything the agent needs to do its job must be in the prompt itself: which hosts to check, which commands to run, which format to deliver in. Delivery target is specified separately via the --deliver flag when creating the job.
Enabling the Messaging Gateway
To deliver via Telegram, you need the Hermes messaging gateway running and a Telegram bot configured. If you have not done this yet, see Track 19 Lesson 5 (The Messaging Gateway). The short version:
- Create a Telegram bot via BotFather and get the token
- Add your token and allowed users to
~/.hermes/.env:
TheTELEGRAM_BOT_TOKEN=your-bot-token TELEGRAM_ALLOWED_USERS=your-numeric-telegram-idTELEGRAM_ALLOWED_USERSsetting is required -- without it the gateway denies all incoming messages. Get your numeric Telegram user ID from @userinfobot on Telegram. - Start the gateway:
hermes gateway start - Message your bot to register your chat ID (the bot will reply with a confirmation)
- Verify with:
hermes gateway status
You can also deliver to Discord (--deliver discord) or to a local file for testing (--deliver local, writes to ~/.hermes/cron/output/).
Writing the Briefing Prompt
The prompt below is a starting template. Customize the IP addresses, pool names, and host list for your actual lab. Every detail the agent needs is spelled out explicitly -- it has no prior context.
You are an infrastructure monitoring agent for a homelab.
Run the following checks and produce a morning briefing.
Be concise: one section per area, bullet points, plain English.
Flag anything that needs attention with [ACTION NEEDED].
## 1. Proxmox Cluster
Run: pvesh get /cluster/resources --output-format json
Report: node count and status, total running VMs vs stopped, any DEGRADED storage.
## 2. ZFS Storage
Run: zpool list -o name,health,capacity,free
Run: zfs list -o name,used,avail -s used | head -10
Report: pool health for each pool, flag any pool over 80% full,
top 3 datasets by space used.
## 3. Network
Run: for host in 192.168.1.1 192.168.1.10 192.168.1.20; do ping -c 1 -W 2 $host &>/dev/null && echo "$host UP" || echo "$host DOWN"; done
Run: dig @192.168.1.1 google.com +short
Report: which hosts are up/down, whether DNS resolves.
## 4. SMART Health (weekly -- only run on Sundays)
Run: date +%A to check the day, then if Sunday:
for disk in sda sdb sdc; do echo -n "$disk: "; smartctl -H /dev/$disk | grep "test result"; done
Report: pass/fail for each disk.
End with a one-line overall status:
"All clear" if nothing needs attention, or a summary of issues if there are any.
Adding the Cron Job
Save the prompt to a file so you can edit it later without retyping:
mkdir -p ~/.hermes/prompts
nano ~/.hermes/prompts/morning-briefing.txt
# paste the prompt and save
Then register it as a daily 7 AM cron job with Telegram delivery:
hermes cron create "0 7 * * *"
"$(cat ~/.hermes/prompts/morning-briefing.txt)"
--deliver telegram
The --deliver telegram flag is what actually sends the output to your Telegram bot. Without it, the job runs but the output has nowhere to go. You can also specify --deliver local while testing so output is written to ~/.hermes/cron/output/ instead.
To verify the job was registered:
hermes cron list
To test it immediately without waiting for 7 AM (note the job ID from cron list):
hermes cron run <job-id>
Editing the Cron Job
When you want to update the prompt after tuning it, use hermes cron edit:
# Update just the prompt on an existing job
hermes cron edit <job-id> --prompt "$(cat ~/.hermes/prompts/morning-briefing.txt)"
# Or update the schedule
hermes cron edit <job-id> --schedule "0 6 * * *"
# To remove and recreate from scratch
hermes cron remove <job-id>
hermes cron create "0 7 * * *" "$(cat ~/.hermes/prompts/morning-briefing.txt)" --deliver telegram
Use hermes cron remove (not delete) to remove a job, and hermes cron pause/hermes cron resume if you want to temporarily disable it without losing the configuration.
Handling Multi-Host Access in Cron
Cron jobs run under the default profile unless you specify otherwise. If your Proxmox node and NAS require different SSH credentials, the cleanest approach for scheduled jobs is to use API tokens rather than SSH hopping:
- Proxmox REST API:
curl -k -H "Authorization: PVEAPIToken=USER@REALM!ID=SECRET" https://proxmox:8006/api2/json/cluster/resources - TrueNAS REST API:
curl -H "Authorization: Bearer $TRUENAS_API_KEY" http://truenas/api/v2.0/pool
Store tokens in ~/.hermes/.env and add them to terminal.env_passthrough in config.yaml so the agent can use them as environment variables without the secrets being in the prompt text.
With this approach, the cron job runs with the local backend and hits all your machines through their APIs -- no SSH hopping or key forwarding needed.
Tuning the Briefing Over Time
After the first week, you will know what you actually care about. Edit ~/.hermes/prompts/morning-briefing.txt and use hermes cron edit to update the job. The Sunday SMART check in the template shows how to make sections conditional on the day of the week -- the agent can run date +%A and skip sections that are not relevant today.
- Cron jobs have no memory of previous sessions -- the prompt must be entirely self-contained with all host IPs, commands, and format requirements spelled out explicitly
- Save the prompt to ~/.hermes/prompts/ as a text file so you can edit and re-register it without retyping -- use hermes cron delete + hermes cron add to update
- Testing with hermes cron run <id> before waiting for the schedule saves you from discovering broken prompts the next morning
- For multi-host access in cron jobs, the cleanest approach is API tokens (Proxmox PVEAPIToken, TrueNAS API key) stored in .env -- eliminates SSH hop complexity and key forwarding dependencies
- The briefing improves over the first two weeks as you tune what to include: start broad, remove what you ignore, add what you find yourself checking manually