Most monitoring tools tell you something broke. SentinelSH-AI tells you why it broke, fixes it automatically when it's safe to do so, and writes you a postmortem about it β all in pure Bash, with an AI co-pilot, running for free on AWS or your own laptop.
- Why This Project Exists
- What Makes It Different
- Architecture
- Project Structure
- Screenshots & Proof of Work
- Quick Start
- Configuration
- How the AI Safety Guardrail Works
- Extending SentinelSH-AI (Plugin System)
- Tech Stack
- Roadmap
- Contributing
- License
Every bash scripting tutorial ends the same way: a todo app, a backup script, a log parser. This project asks a different question β
What if a bash script could think like a junior SRE: notice something's wrong, reason about why, decide whether it's safe to fix, fix it, and then write up what happened?
SentinelSH-AI is that answer. It's a lightweight, dependency-free, fully autonomous monitoring daemon that combines classic shell scripting fundamentals with a real LLM (via the free Groq API) to bring genuine reasoning into the ops loop β not just if cpu > 80 then alert.
| Feature | Typical Monitoring Script | SentinelSH-AI |
|---|---|---|
| Detects issues | β | β |
| Auto-remediates | β With AI safety review first | |
| Explains why it happened | β | β AI root-cause diagnosis |
| Generates incident postmortems | β | β Auto-written Markdown reports |
| Learns "normal" for your server | β | β Baseline learning + anomaly detection |
| Natural language log queries | β | β
ask.sh "why was the server slow yesterday?" |
| Weekly AI-written health summary | β | β |
| Extensible without touching core code | β | β Drop-in plugin architecture |
| Real-time alerts | Maybe | β Discord webhook |
| Live dashboard | β | β Auto-refreshing HTML dashboard |
Before executing any destructive remediation (clearing logs, restarting services), SentinelSH-AI asks the AI: "is this actually safe given the current context?" If the AI has concerns, it halts and flags for manual review instead of charging ahead. This mirrors how a cautious human engineer would actually operate β automation with judgment, not automation with a hair-trigger.
βββββββββββββββββββββββ
β systemd.timer β (runs every 2 min)
ββββββββββββ¬ββββββββββββ
β
ββββββββββββΌββββββββββββ
β sentinel.sh β (main orchestrator)
ββββββββββββ¬ββββββββββββ
βββββββββββββββββββββΌββββββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
β checks/*.sh β β lib/baseline.sh β β lib/dashboard.sh β
β (plugin system) β β (anomaly detect) β β (status.html) β
ββββββββββ¬βββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
β on FAILURE
βΌ
ββββββββββββββββββββββ βββββββββββββββββββββββ
β ai/diagnose.sh ββββββββΆβ Groq API (LLaMA 3.3) β
β (root cause analysis) β βββββββββββββββββββββββ
ββββββββββ¬βββββββββββββ
βΌ
ββββββββββββββββββββββ βββββββββββββββββββββββ
β ai/safety_check.sh ββββββββΆβ Groq API (verdict) β
β (SAFE / UNSAFE gate) β βββββββββββββββββββββββ
ββββββββββ¬βββββββββββββ
β if SAFE
βΌ
ββββββββββββββββββββββ ββββββββββββββββββββββ ββββββββββββββββββββββ
β remediate/*.sh β β lib/report.sh β β lib/notify.sh β
β (auto-fix plugin) β β (Markdown postmortem) β β (Discord webhook) β
ββββββββββββββββββββββ ββββββββββββββββββββββ ββββββββββββββββββββββ
sentinelsh-ai/
βββ sentinel.sh # Main orchestrator β auto-discovers and runs everything
βββ install.sh # One-command installer for fresh machines
βββ config.conf.example # Copy to config.conf and fill in your keys
βββ Dockerfile # Run the whole thing in a container
βββ docker-compose.yml # One-command Docker deployment
β
βββ checks/ # π Plugin system β drop a new .sh here, it's auto-discovered
β βββ cpu_check.sh
β βββ disk_check.sh
β βββ memory_check.sh
β βββ load_avg_check.sh
β βββ service_check.sh
β
βββ remediate/ # π§ Auto-fix scripts, matched to checks by resource name
β βββ clear_logs.sh
β βββ restart_service.sh
β
βββ ai/ # π§ Groq-powered intelligence layer
β βββ ai_client.sh # Core Groq API wrapper
β βββ diagnose.sh # Root cause analysis on incidents
β βββ safety_check.sh # SAFE/UNSAFE guardrail before remediation
β βββ ask.sh # Natural language log queries
β βββ weekly_report.sh # AI-written weekly health summary
β
βββ lib/ # Shared utilities
β βββ logger.sh
β βββ report.sh # Markdown incident report generator
β βββ baseline.sh # Metric history + anomaly detection
β βββ notify.sh # Discord webhook integration
β βββ dashboard.sh # Live HTML dashboard generator
β
βββ deploy/ # systemd + logrotate configs for production
β βββ sentinelsh.service
β βββ sentinelsh.timer
β βββ sentinelsh.logrotate
β
βββ reports/ # Auto-generated incident & weekly reports (gitignored)
βββ logs/ # Runtime logs (gitignored)
All features below were tested end-to-end on a live AWS EC2 instance. See Quick Start to reproduce these yourself.
π‘ Note for repo setup: create a
/screenshotsfolder in your repo root and drop your PNG files there using the filenames referenced above, or update the paths to match your own filenames.
You have three ways to run SentinelSH-AI. Pick whichever fits you.
The fastest way to see it working, no AWS account or systemd needed. Works on Windows/Mac/Linux as long as Docker is installed.
# 1. Clone the repo
git clone https://github.com/Adarsh73111/sentinelsh-ai.git
cd sentinelsh-ai
# 2. Set your environment variables
export GROQ_API_KEY="your_groq_api_key_here"
export WEBHOOK_URL="your_discord_webhook_url_here" # optional
# 3. Build and run
docker compose up --buildThen open your browser to:
http://localhost:8080/status.html
To stop:
docker compose downGet a free Groq API key at console.groq.com/keys β no credit card required.
Run it directly on any Linux machine (or WSL on Windows) without Docker.
# 1. Clone the repo
git clone https://github.com/Adarsh73111/sentinelsh-ai.git
cd sentinelsh-ai
# 2. Run the installer (installs jq, curl, sets up folders & permissions)
chmod +x install.sh
./install.sh
# 3. Configure your keys
cp config.conf.example config.conf
nano config.conf # add your GROQ_API_KEY and WEBHOOK_URL
# 4. Run it manually
bash sentinel.sh
# 5. (Optional) View the dashboard
python3 -m http.server 8080
# visit http://localhost:8080/status.html
install.shwill also offer to set up asystemdtimer for automatic recurring runs β skip this step if you're just testing on a personal laptop.
For the complete experience with autonomous systemd scheduling, a public dashboard URL, and Discord alerting from a real server.
Click to expand full AWS setup guide
-
AMI: Ubuntu Server 24.04 LTS, Free Tier eligible
-
Instance type: t2.micro
-
Storage: 30 GB gp2
-
Security Group inbound rules:
Type Port Source SSH 22 My IP Custom TCP 8080 Anywhere
So your dashboard URL never changes after stop/start: EC2 β Elastic IPs β Allocate β Associate with your instance.
ssh -i "your-key.pem" ubuntu@<your-ec2-ip>
git clone https://github.com/Adarsh73111/sentinelsh-ai.git ~/sentinelsh
cd ~/sentinelsh
chmod +x install.sh
./install.shcp config.conf.example config.conf
nano config.confAdd your GROQ_API_KEY and WEBHOOK_URL.
sudo systemctl status sentinelsh.timercd ~/sentinelsh
nohup python3 -m http.server 8080 > /dev/null 2>&1 &Visit http://<your-ec2-ip>:8080/status.html
All settings live in config.conf (copy from config.conf.example):
| Variable | Description | Default |
|---|---|---|
GROQ_API_KEY |
Your free Groq API key | (required) |
AI_MODEL |
Groq model to use | llama-3.3-70b-versatile |
DISK_THRESHOLD |
Disk usage % that triggers an alert | 80 |
CPU_THRESHOLD |
CPU usage % that triggers an alert | 75 |
MEMORY_THRESHOLD |
Memory usage % that triggers an alert | 80 |
MONITORED_SERVICES |
Space-separated systemd service names to watch | ssh cron |
WEBHOOK_URL |
Discord (or Slack-compatible) webhook for alerts | (optional) |
AI_SAFETY_CHECK |
Require AI approval before destructive remediation | yes |
Before any destructive remediation action executes (e.g. clearing logs, deleting temp files), SentinelSH-AI sends the proposed action and its context to the AI and requires an explicit verdict:
Proposed action: Clear compressed logs, journal logs older than 2 days, apt cache, and /tmp
Context: Disk usage exceeded threshold
β AI Verdict: SAFE
"These are routine, reversible cleanup actions unlikely to cause disruption."
If the AI responds UNSAFE β for example, flagging that a file might be in active use β the remediation halts and the incident is logged for manual review instead of executing blindly. This is the difference between automation and automation with judgment.
Adding a new health check requires zero changes to sentinel.sh. Drop a script into checks/ that follows this contract:
#!/bin/bash
source ~/sentinelsh/config.conf
source ~/sentinelsh/lib/logger.sh
check_something() {
# your check logic here
if [ "$condition_failed" ]; then
echo "FAIL:resource_name:value"
return 1
else
echo "OK"
return 0
fi
}
check_somethingTo add an auto-fix for it, create remediate/<resource_name>_fix.sh (or a service-style fix that accepts the resource as $1) β sentinel.sh will auto-discover and wire it in.
- Bash β 100% of the orchestration logic, no Python/Node dependency for core functionality
- Groq API (LLaMA 3.3 70B) β free-tier LLM inference for diagnosis, safety checks, and reports
- AWS EC2 β Free Tier deployment target
- systemd β timers and services for autonomous scheduling
- Discord Webhooks β real-time alerting
- Docker β portable, zero-dependency deployment option
- jq β JSON parsing for API responses
- HTML/CSS β self-contained live dashboard, no frontend framework
- AWS CLI integration β auto-snapshot EBS volume on critical disk alerts
- Multi-server support with aggregated dashboard
- Slack slash-command interface for
ask.sh - Historical trend analysis with monthly AI reports
- Configurable severity thresholds via a
whiptail/dialogTUI menu
This started as a personal learning project to push bash scripting beyond tutorial-level exercises. Issues, forks, and pull requests are welcome β especially new checks/ or remediate/ plugins.
This project is licensed under the MIT License.
Built with π Bash, π§ Groq AI, and βοΈ AWS Free Tier β proof that infrastructure automation doesn't need a heavyweight framework to be genuinely intelligent.









