Post

Meet The Dead Canary My Lan Watchdog In A Plastic Pot That Gracefully Kills My Nas When The Power Dies

Welcome to this comprehensive guide on setting up and configuring **DeadCanary**, a self-hosted, open-source network monitoring tool that alerts you when your NAS (Network Attached Storage) or other devices go.

# Meet The Dead Canary My Lan Watchdog In A Plastic Pot That Gracefully Kills My Nas When The Power Dies

Welcome to this comprehensive guide on setting up and configuring DeadCanary, a self-hosted, open-source network monitoring tool that alerts you when your NAS (Network Attached Storage) or other devices go offline. This tutorial assumes you are an experienced DevOps engineer or sysadmin with knowledge of Linux systems, Docker, and YAML configuration files.

Prerequisites

Before getting started, make sure you have the following prerequisites:

  1. A NAS device (or other networked devices) that you want to monitor
  2. A system running Ubuntu 20.04 LTS or later with Docker CE installed (version 5.0.8 or higher)
  3. Access to the internet for downloading Docker images and configuration files

Setup and Configuration

Follow these numbered steps to set up DeadCanary:

1. Pull DeadCanary Docker Image

1
docker pull deadcanary/deadcanary:latest

2. Create a deadcanary.yml Configuration File

Create a file named deadcanary.yml and add the following configuration:

1
2
3
4
5
6
7
8
9
monitoring:
  devices:
    - name: YourNASDeviceName
      ip: YourNASDeviceIP
      port: 22 (or other relevant port)
      user: YourUsername
      pass: YourPassword (optional, remove if using SSH keys)
      timeout_seconds: 30
      alert_on_offline: true

Replace YourNASDeviceName, YourNASDeviceIP, YourUsername, and YourPassword with appropriate values for your NAS device.

3. Create and Run a Docker Container

1
2
3
4
docker run -d --name deadcanary \
  -v $(PWD)/deadcanary.yml:/etc/deadcanary.yml \
  -v /var/run/docker.sock:/var/run/docker.sock \
  deadcanary/deadcanary

The above command mounts the deadcanary.yml configuration file and Docker socket for monitoring Docker containers to the DeadCanary container.

4. Verify Container Status

1
docker ps

You should see a container named deadcanary running.

Troubleshooting

  • Ensure your NAS device is reachable from the system running DeadCanary.
  • Check the logs within the DeadCanary container for any errors:

    1
    
    docker logs deadcanary
    

Conclusion

With this guide, you now have a self-hosted network monitoring solution that will keep an eye on your NAS device and alert you when it goes offline. This tool can be easily extended to monitor other devices in your homelab or infrastructure, providing valuable automation benefits for your DevOps workflows.

Potential Security Considerations

  • Use strong passwords and SSH keys for added security.
  • Ensure the system running DeadCanary is secured according to best practices (e.g., firewall rules, updated packages, etc.)

Performance Optimization Tips

  • Adjust the timeout_seconds value based on your network stability.
  • Monitor CPU and memory usage of the DeadCanary container to optimize resource allocation if needed.

Common Pitfalls and How to Avoid Them

  • Ensure correct IP addresses, usernames, and passwords are used in the configuration file.
  • Verify that Docker is correctly installed on your system before attempting to run the DeadCanary container.
This post is licensed under CC BY 4.0 by the author.