Skip to content
This repository has been archived by the owner. It is now read-only.
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Disclaimer: If you are new to Go this is not a good place to learn best practices, the code is not very idiomatic and there's probably a few bad ideas.

What's this?

pingd is the ping engine used by the monitoring service. It allows to simultaneously ping hundreds of IPs and can manage which hosts are being pinged during runtime.

The system is meant to be composed (or embedded) by you and requires up to 3 compatible functions to:

  1. load an initial set of hosts to monitor
  2. receive commands to start and stop monitoring a given host
  3. publish host UP or host DOWN events

These functions must be the following types respectively.

type Loader func(chan<- Host)
type Receiver func(chan<- Host, chan<- Host)
type Notifier func(<-chan Host)

There are some implementations of these functions available under pingd/io.

Usage example

NOTE: Before you run anything, remember that ICMP echo (ping) requires root privileges for raw socket access. If you don't want to sudo every time consider using setuid

To create your own private alternative:

 # get the example
export GOPATH=$PWD
go get

 # start pinging and and email you if they go down
sudo bin/httpmail

 # add a new host while running
curl localhost:7700/

 # stop pinging
curl -XDELETE localhost:7700/

Keep in mind that this is just an example which assumes that there is a local mail server running on port 25. Take a look at the sendMail function and adapt it to your needs. For example, to send the emails via Gmail. uses in production a configuration like the redis example allowing the website to interact with pingd via redis pub/sub.

You can add your own functions to have pingd interact with the world. For example, switching on some red light with the help of a Raspberry Pi.


Ping monitoring engine used in







No releases published


No packages published