# FreedomBox for Communities/Monitoring Client

The team consisting of technical volunteers managing FreedomBox community network needs to monitor it for maintenance issues. If a component of the network such as Wi-Fi access point goes offline, the team needs to be notified automatically for immediate rectification. Further, if the network is reaching bottlenecks due to increase in number of members or insufficient Internet bandwidth, they need to address those by adding bandwidth or more hardware. Overall understanding of how many users are using the network can also help in improving the network and planning for other networks.
This section describes the setup of a monitoring client on the FreedomBox server that is responsible for collecting various parameters such as CPU usage, memory usage, number of access points currently operational in the network, etc. It then sends this information on a continuous basis to a server outside the network as configured by the administrators of the network. This information can then be used to construct a dashboard that issues alerts to administrators when they need to fix a problem with the network.

## Setup on FreedomBox

FreedomBox server is act as a central point to monitor all the equipment in the network and its performance. This is done by installing a monitoring agent on the FreedomBox server.
* Install collectd and its dependencies. apt install collectd-core liboping0
* Copy the collectd configuration file from its examples directory cp /usr/share/doc/collectd-core/examples/collectd.conf /etc/collectd/
* Edit /etc/collectd/collectd.conf and change the following lines:
** Set the hostname to the full domain name of the community's FreedomBox as reachable from outside. This is necessary because there may be multiple community networks that may be sending monitoring data to a single monitoring server setup by the administrator. Hostname decides how data is stored for each of these networks without clashing with each other. Hostname "[mycommunity.domain]"
** The configuration copied from examples to should have enabled the following plug-ins by default. Verify. LoadPlugin conntrack LoadPlugin cpu LoadPlugin df LoadPlugin disk LoadPlugin interface LoadPlugin load LoadPlugin memory LoadPlugin processes LoadPlugin swap LoadPlugin uptime LoadPlugin users
** Enable the ping plugin and set its configuration to monitor all the hosts in the network. For each host in the network (such as a Wi-Fi access point) add one entry in the ping plug-in's configuration. Include an Internet host such as "1.1.1.1" to monitor Internet connectivity. Each of these configured hosts will be pinged each second to ascertain whether they are up and running in the network. LoadPlugin ping <Plugin ping> Host "1.1.1.1" Host "10.42.0.4" Host "10.42.0.5" Interval 10 </Plugin>
** Make collectd connect to a external monitoring server and deliver the results of the continuous monitoring it performs. Enable a plug-in for writing to Graphite. Graphite is the server side software (along with Grafana and Carbon) used for the monitoring setup that the administrator will install on the central monitoring server. LoadPlugin write_graphite <Plugin write_graphite> <Node "[remoteservername]"> Host "[myremoteserver.domain]" </Node> </Plugin>
* Restart collectd service to apply the configuration set. systemctl restart collectd

## Setup on Monitoring Server

After monitoring setup has been completed on the FreedomBox server for a community network, it will start sending data to the monitoring server. The data is not immediately available unless the data is used for aggregation. The administrator of the monitoring server should then setup a separate dashboard for all the parameters that this community network is sending. Further, alerts should be setup to notify administrators when unexpected results are observed in the data being sent. See section on setting up monitoring server for details on how to accomplish this.