@cryptotaxi247 / netdata-1 / commits / 1372f692b

Add guide for monitoring Pi-hole and Raspberry Pi (#9770)

* Starting draft of guide * Finish initial draft for review * Add new content and tweak * Fix performance link * Be clearer about metrics values * Rewrite section on metrics * Fixes for Jen * Last bit of cleanup * Fixes for Amy * Fixes for Odysseas

Joel Hans committed Sep 15, 2020 at 14:05 UTC 1372f692b33058c27058d4a4a49a5d09b494a692
1 file changed +162
docs/guides/monitor/pi-hole-raspberry-pi.md new
+162
@@ -0,0 +1,162 @@
1 +<!--
2 +title: "Monitor Pi-hole (and a Raspberry Pi) with Netdata"
3 +description: "Monitor Pi-hole metrics, plus Raspberry Pi system metrics, in minutes and completely for free with Netdata's open-source monitoring agent."
4 +image: /img/seo/guides/monitor/netdata-pi-hole-raspberry-pi.png
5 +custom_edit_url: https://github.com/netdata/netdata/edit/master/docs/guides/monitor/raspberry-pi-hole.md
6 +-->
7 +
8 +# Monitor Pi-hole (and a Raspberry Pi) with Netdata
9 +
10 +Between intrusive ads, invasive trackers, and vicious malware, many techies and homelab enthusiasts are advancing their
11 +networks' security and speed with a tiny computer and a powerful piece of software: [Pi-hole](https://pi-hole.net/).
12 +
13 +Pi-hole is a DNS sinkhole that prevents unwanted content from even reaching devices on your home network. It blocks ads
14 +and malware at the network, instead of using extensions/add-ons for individual browsers, so you'll stop seeing ads in
15 +some of the most intrusive places, like your smart TV. Pi-hole can even [improve your network's speed and reduce
16 +bandwidth](https://discourse.pi-hole.net/t/will-pi-hole-slow-down-my-network/2048).
17 +
18 +Most Pi-hole users run it on a [Raspberry Pi](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) (hence the
19 +name), a credit card-sized, super-capable computer that costs about $35.
20 +
21 +And to keep tabs on how both Pi-hole and the Raspberry Pi are working to protect your network, you can use the
22 +open-source [Netdata monitoring agent](https://github.com/netdata/netdata).
23 +
24 +To get started, all you need is a [Raspberry Pi](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) with
25 +Raspbian installed. This guide uses a Raspberry Pi 4 Model B and Raspbian GNU/Linux 10 (buster). This guide assumes
26 +you're connecting to a Raspberry Pi remotely over SSH, but you could also complete all these steps on the system
27 +directly using a keyboard, mouse, and monitor.
28 +
29 +## Why monitor Pi-hole and a Raspberry Pi with Netdata?
30 +
31 +Netdata helps you monitor and troubleshoot all kinds of devices and the applications they run, including IoT devices
32 +like the Raspberry Pi and applications like Pi-hole.
33 +
34 +After a two-minute installation and with zero configuration, you'll be able all of Pi-hole's metrics, including the
35 +volume of queries, connected clients, DNS queries per type, top clients, top blocked domains, and more.
36 +
37 +With Netdata installed, you can also monitor system metrics and any other applications you might be running. By default,
38 +Netdata collects metrics on CPU usage, disk IO, bandwidth, per-application resource usage, and a ton more. With the
39 +Raspberry Pi used for this guide, Netdata automatically collects about 1,500 metrics every second!
40 +
41 +![Real-time Pi-hole monitoring with
42 +Netdata](https://user-images.githubusercontent.com/1153921/90447745-c8fe9600-e098-11ea-8a57-4f07339f002b.png)
43 +
44 +## Install Netdata
45 +
46 +Let's start by installing Netdata first so that it can start collecting system metrics as soon as possible for the most
47 +possible historic data.
48 +
49 +> ⚠️ Don't install Netdata using `apt` and the default package available in Raspbian. The Netdata team does not maintain
50 +> this package, and can't guarantee it works properly.
51 +
52 +On Raspberry Pis running Raspbian, the best way to install Netdata is our one-line kickstart script. This script asks
53 +you to install dependencies, then compiles Netdata from source via [GitHub](https://github.com/netdata/netdata).
54 +
55 +```bash
56 +bash <(curl -Ss https://my-netdata.io/kickstart.sh)
57 +```
58 +
59 +Once installed on a Raspberry Pi 4 with no accessories, Netdata starts collecting roughly 1,500 metrics every second and
60 +populates its dashboard with more than 250 charts.
61 +
62 +Open your browser of choice and navigate to `http://NODE:19999/`, replacing `NODE` with the IP address of your Raspberry
63 +Pi. Not sure what that IP is? Try running `hostname -I | awk '{print $1}'` from the Pi itself.
64 +
65 +You'll see Netdata's dashboard and a few hundred real-time,
66 +[interactive](https://learn.netdata.cloud/guides/step-by-step/step-02#interact-with-charts) charts. Feel free to
67 +explore, but let's turn our attention to installing Pi-hole.
68 +
69 +## Install Pi-Hole
70 +
71 +Like Netdata, Pi-hole has a one-line script for simple installation. From your Raspberry Pi, run the following:
72 +
73 +```bash
74 +curl -sSL https://install.pi-hole.net | bash
75 +```
76 +
77 +The installer will help you set up Pi-hole based on the topology of your network. Once finished, you should set up your
78 +devices—or your router for system-wide sinkhole protection—to [use Pi-hole as their DNS
79 +service](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245). You've
80 +finished setting up Pi-hole at this point.
81 +
82 +As far as configuring Netdata to monitor Pi-hole metrics, there's nothing you actually need to do. Netdata's [Pi-hole
83 +collector](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/pihole) will autodetect the new service
84 +running on your Raspberry Pi and immediately start collecting metrics every second.
85 +
86 +Restart Netdata with `sudo service netdata restart` to start Netdata, which will then recognize that Pi-hole is running
87 +and start a per-second collection job. When you refresh your Netdata dashboard or load it up again in a new tab, you'll
88 +see a new entry in the menu for **Pi-hole** metrics.
89 +
90 +## Use Netdata to explore and monitor your Raspberry Pi and Pi-hole
91 +
92 +By the time you've reached this point in the guide, Netdata has already collected a ton of valuable data about your
93 +Raspberry Pi, Pi-hole, and any other apps/services you might be running. Even a few minutes of collecting 1,500 metrics
94 +per second adds up quickly.
95 +
96 +You can now use Netdata's synchronized charts to zoom, highlight, scrub through time, and discern how an anomaly in one
97 +part of your system might affect another.
98 +
99 +![The Netdata dashboard in
100 +action](https://user-images.githubusercontent.com/1153921/80827388-b9fee100-8b98-11ea-8f60-0d7824667cd3.gif)
101 +
102 +If you're completely new to Netdata, look at our [step-by-step guide](/docs/guides/step-by-step/step-00.md) for a
103 +walkthrough of all its features. For a more expedited tour, see the [get started guide](/docs/getting-started.md).
104 +
105 +### Enable temperature sensor monitoring
106 +
107 +You need to manually enable Netdata's built-in [temperature sensor
108 +collector](https://learn.netdata.cloud/docs/agent/collectors/charts.d.plugin/sensors) to start collecting metrics.
109 +
110 +> Netdata uses a few plugins to manage its [collectors](/collectors/REFERENCE.md), each using a different lanaguge: Go,
111 +> Python, Node.js, and Bash. While our Go collectors are undergoing the most active development, we still support the
112 +> other languages. In this case, you need to enable a temperature sensor collector that's written in Bash.
113 +
114 +First, open the `charts.d.conf` file for editing. You should always use the `edit-config` script to edit Netdata's
115 +configuration files, as it ensures your settings persist across updates to the Netdata Agent.
116 +
117 +```bash
118 +cd /etc/netdata
119 +sudo ./edit-config charts.d.conf
120 +```
121 +
122 +Uncomment the `sensors=force` line and save the file. Restart Netdata with `sudo service netdata restart` to enable
123 +Raspberry Pi temperature sensor monitoring.
124 +
125 +### Storing historical metrics on your Raspberry Pi
126 +
127 +By default, Netdata allocates 256 MiB in disk space to store historical metrics inside the [database
128 +engine](/database/engine/README.md). On the Raspberry Pi used for this guide, Netdata collects 1,500 metrics every
129 +second, which equates to storing 3.5 days worth of historical metrics.
130 +
131 +You can increase this allocation by editing `netdata.conf` and increasing the `dbengine multihost disk space` setting to
132 +more than 256.
133 +
134 +```yaml
135 +[global]
136 + dbengine multihost disk space = 512
137 +```
138 +
139 +Use our [database sizing calculator](https://learn.netdata.cloud/docs/agent/database/calculator) and [guide on storing
140 +historical metrics](/docs/guides/longer-metrics-storage.md) to help you determine the right setting for your Raspberry
141 +Pi.
142 +
143 +## What's next?
144 +
145 +Now that you're monitoring Pi-hole and your Raspberry Pi with Netdata, you can extend its capabilities even further, or
146 +configure Netdata to more specific goals.
147 +
148 +Most importantly, you can always install additional services and instantly collect metrics from many of them with our
149 +[300+ integrations](/collectors/COLLECTORS.md).
150 +
151 +- [Optimize performance](/docs/Performance.md) using tweaks developed for IoT devices.
152 +- [Stream Raspberry Pi metrics](/streaming/README.md) to a parent host for easy access or longer-term storage.
153 +- [Tweak alarms](/health/QUICKSTART.md) for either Pi-hole or the health of your Raspberry Pi.
154 +- [Export metrics to external databases](/exporting/README.md) with the exporting engine.
155 +
156 +Or, head over to [our guides](https://learn.netdata.cloud/guides/) for even more experiments and insights into
157 +troubleshooting the health of your systems and services.
158 +
159 +If you have any questions about using Netdata to monitor your Raspberry Pi, Pi-hole, or any other applications, head on
160 +over to our [community forum](https://community.netdata.cloud/).
161 +
162 +[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fdocs%2Fguides%2Fmonitor%2Fpi-hole-raspberry-pi.md&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>)