The smallest watchdog on earth. Tiny, monitoring-plugins compatible monitoring with a status page. https://cloud.docker.com/repository/docker/momar/chihuahua/general
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Moritz Marquardt e98b6ac4d9 Use Gin instead of Air, fixes #50 5 months ago
cmd Make Docker build correctly, fix #5 (ssh key & default config) & also make checks unknown on startup 6 months ago
config Replace "break" with "return" to fix #49 6 months ago
docs Make Docker build correctly, fix #5 (ssh key & default config) & also make checks unknown on startup 6 months ago
notifiers Use UTF8 encoding for the subject 6 months ago
resources Use name for notifications instead of ID (fix #45) 6 months ago
web Fix API URL in frontend (fixes #39) 6 months ago
.dockerignore Make Docker build correctly, fix #5 (ssh key & default config) & also make checks unknown on startup 6 months ago
.gitignore Fix .gitignore, docs for delay, email sender address & SSH key generation 6 months ago
Dockerfile Make Docker build correctly, fix #5 (ssh key & default config) & also make checks unknown on startup 6 months ago
LICENSE Publish first working public version (1.0) 1 year ago
README.md Fix setup.sh command in README.md & missing SSH keys 6 months ago
api.go Use Gin instead of Air, fixes #50 5 months ago
check.go Use name for notifications instead of ID (fix #45) 6 months ago
chihuahua.service Clean up go.mod, fix chihuahua.service for user services, add support for /etc/chihuahua.rc (#38), fix check_sudo in setup.sh 6 months ago
go.mod Use Gin instead of Air, fixes #50 5 months ago
notify.go Use name for notifications instead of ID (fix #45) 6 months ago
types.go Add HTML-formatted emails, fix the API & add a Mutex for the scheduler 6 months ago

README.md

chihuahua

The smallest watchdog on earth. Tiny, monitoring-plugins compatible monitoring with a status page, built with Go.

  • Run nagios/monitoring-plugins checks on a remote server
  • Alert on state change via Gotify or email
  • Show a nice little status page

Screenshot

Getting Started

docker run -d -p 8080:80 -v "$PWD/data:/data" momar/chihuahua
nano data/chihuahua.hcl

Chihuahua now runs at http://localhost:8080.

You can find a full example configuration file at chihuahua.hcl, and should also read the full configuration manual, but to get started, you can use a simple configuration like this:

check "cpu" {
  # This check will be run on every server, unless the 
  # server specifies an overriding check called "cpu".
  name = "CPU Load"
  command = "check_load -r -w 3,2,1.25 -c 4,3,2"
}

server "server-local" {
  connection = "local"
}

server "server-01" {
  connection = "ssh chihuahua@example.org"
  check "ram" {
    command = "check_memory -w 8 -c 3" # parameters in percent
  }
}

notifier "email-myself" {
  # emails are delayed by 5 minutes by default to accumulate
  # multiple notifications into a single notification email.
  type = "smtp"
  server = "user:password@smtp.example.org"
  from = "Chihuahua <chihuahua@example.org>"
  to = ["myself@example.org"]
}
Use a systemd service to install the server without Docker (unsupported)
wget https://codeberg.org/momar/chihuahua/releases/download/v1.4/chihuahua-x64.gz -O- | gunzip > /tmp/chihuahua
sudo install -m755 /tmp/chihuahua /usr/local/bin/chihuahua

mkdir -p /usr/local/lib/chihuahua/.ssh
useradd -d /usr/local/lib/chihuahua -M -r -s /usr/sbin/nologin chihuahua
ssh-keygen -b 2048 -f /usr/local/lib/chihuahua/.ssh/id_rsa -P "" -C "Chihuahua Monitoring"
nano /etc/chihuahua.yml

sudo wget https://codeberg.org/momar/chihuahua/raw/branch/master/chihuahua.service -O /etc/systemd/system/chihuahua.service
sudo systemctl enable chihuahua.service
sudo systemctl start chihuahua.service

Set up a server for connections (Debian/Ubuntu/Alpine/...)

curl -Ls http://status.example.org:8080/setup.sh | sudo sh

You can now use connection = "ssh chihuahua@example.org" to connect to your server with a limited user.

To completely remove the Chihuahua setup from your server, use the following commands:

sudo userdel -r chihuahua
sudo apt-get remove --auto-remove monitoring-plugins # or "apk del monitoring-plugins" on Alpine
sudo rm /usr/local/bin/check_sudo
sudo sed -i '/^chihuahua /d' /etc/sudoers

API

TODO: this should be documented more thoroughly - maybe provide an API Blueprint?

GET /setup.sh
GET /checks
GET /checks/:server
GET /checks/:server/:check

Development

Requires Go

git clone https://codeberg.org/momar/chihuahua.git && cd chihuahua
cp resources/chihuahua.hcl .
go run ./cmd --debug

Roadmap

  • Add custom messages to checks
  • Add private/hidden checks
  • More notification providers (mainly Clockwork SMS)
  • Gitea integration
  • Provide a Prometheus exporter