Script to monitor the gateway servers of a Freifunk mesh network for outages
  • Shell 53.5%
  • C 38.5%
  • Makefile 8%
Find a file
2026-02-23 10:24:08 +01:00
checks Expanded command parameters 2023-05-17 07:19:28 +02:00
.gitignore Use libpacketmark instead of iptables stuff 2019-03-02 09:16:59 +01:00
.SRCINFO Replaced Github with Codeberg 2026-02-23 10:24:08 +01:00
check_dhcp.c Use BSD version of udphdr 2018-11-19 17:50:14 +01:00
gatemon-setup.nonroot.service Make names of scripts and units clearer 2019-03-16 13:10:32 +01:00
gatemon-setup.nonroot.sh shellcheck: Add location hints for config file 2024-07-13 21:03:16 +02:00
gatemon.cfg monitor new ("Batman v15") network, with servers vpn07/08/09/10 2022-07-05 21:57:37 +02:00
gatemon.cron Renamed scripts and configs to match project name 2019-03-04 21:46:36 +01:00
gatemon.nonroot.service Make names of scripts and units clearer 2019-03-16 13:10:32 +01:00
gatemon.root.service Make names of scripts and units clearer 2019-03-16 13:10:32 +01:00
gatemon.sh show details for run file if it already exists 2024-07-13 21:54:12 +02:00
gatemon.timer Renamed scripts and configs to match project name 2019-03-04 21:46:36 +01:00
LICENSE Updated LICENCE file 2023-05-16 11:19:18 +02:00
Makefile Fixed adding VERSION to Makefile 2019-04-29 10:18:12 +02:00
PKGBUILD Replaced Github with Codeberg 2026-02-23 10:24:08 +01:00
README.md Replaced Github with Codeberg 2026-02-23 10:24:08 +01:00
VERSION Add node information 2019-07-26 22:39:45 +02:00

Gatemon

Project to monitor the gateway servers of a freifunk mesh network for outages.

The program runs regularly and checks whether the Internet connection is possible and DNS, DHCP and NTP are working. Each over IPv4 and IPv6.

The results will be sent to a web server running gatemon-html which then displays them.

Dependencies

The program must run on a computer, which is a normal participant in the in the freifunk network.

This computer must not use DHCP, because the DHCP port is used by the DHCP check. Therefore it must have a static IPv4 address configured.

It should be NTP synchronized to have an accurate time, because otherwise the gatemon-html server will reject the results.

After that you need a secret key to allow your gatemon to send data to the central server.

You can get it from genofire, jplitza, mortzu or ollibaba - just ask in the chat.

Installation (as root)

A tutorial on how to install a gatemon on a Raspberry Pi, in particular the network configuration, can be found in the Wiki.

apt-get install curl dnsutils gcc git jq libc6-dev make monitoring-plugins-basic monitoring-plugins-standard mtr-tiny
git clone https://codeberg.org/FreifunkBremen/gatemon /opt/gatemon
cd /opt/gatemon
make check_dhcp
make -C libpacketmark
cp gatemon.cfg /etc/

After that you have to edit /etc/gatemon.cfg:

  • set API_TOKEN to the secret key you got
  • use GATEMON_NAME to name your gatemon (stay under 20 characters)
  • set GATEMON_PROVIDER to the name or short description of your Internet provider
  • set NETWORK_DEVICE to your freifunk interface (i.e. eth0)
  • leave the other entries unchanged, or ask the admin of your gatemon-html server for correct settings

There are several ways to run gatemon regularly:

Running periodic with cron

The classic way is to run gatemon via cron:

cp gatemon.cron /etc/cron.d/gatemon

Running periodic with systemd timers

The modern way is to run gatemon via systemd-timer:

cp gatemon.root.service /etc/systemd/system/gatemon.service
cp gatemon.timer /etc/systemd/system/gatemon.timer
systemctl --now enable gatemon.timer

Running peridic with systemd timers (as non-root)

If you want to run the actual gatemon script as non-root, the setup script (which sets routes and rules) must be run as root first.

cp gatemon-setup.nonroot.service /etc/systemd/system/gatemon-setup.nonroot.service
cp gatemon.nonroot.service /etc/systemd/system/gatemon.service
cp gatemon.timer /etc/systemd/system/gatemon.timer
systemctl --now enable gatemon-setup.nonroot.service gatemon.timer

Update (as root)

cd /opt/gatemon
git pull --rebase
make check_dhcp
make -C libpacketmark