# Install and setup instructions for the RPI Unifi Monitor
## Introduction
A monitoring solution for the Unifi Controller with [Grafana](http://grafana.org/), [UnPoller](https://unpoller.com/).
## Screenshot


# Installation
## Pre-Installation Steps
First SSH into your Pi or use Shell in a Box to get to the command line. ensure you have pulled the latest from https://github.com/pi-hosted/pi-hosted/ and run unpoller.sh
## Folder Setup Script
First thing we need to do is setup the folder structure and install some files that need to be in place for everything to work correctly.
Run the following script
```
sudo sh ./tools/unpoller-install.sh
```
Your output should look something like this
```
# sudo ./tools/unpoller-install.sh
creating directories
downloading unpoller config files
--2021-10-17 00:56:28-- https://raw.githubusercontent.com/pi-hosted/pi-hosted/tree/master/pi-hosted_template/configs/unpoller-up.conf
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 163 [text/plain]
Saving to: ‘/portainer/Files/AppData/Config/unpoller/up.conf’
/portainer/Files/AppData/Config/unpoller/up.conf 100%[=======================================================================================================================================>] 163 --.-KB/s in 0s
2021-10-17 00:56:28 (971 KB/s) - ‘/portainer/Files/AppData/Config/unpoller/up.conf’ saved [163/163]
Done You are ready to goto next step in the install document
```
### This Step is now complete go to the next step.
## Install the App Template.
Goto App Templates and install "UnPoller Monitor"
The default settings should all be good so **Deploy the Stack**
## Setup Grafana
Assuming you have already installed the pi monitoring suite we will need to install 2 new plugins for grafana to display the new dashboards correctly. Navigate to your monitoring-grafana container and click >_Console.

Click connect on this next page

Then type in:
```
grafana-cli plugins install grafana-clock-panel
```
&
```
grafana-cli plugins install grafana-piechart-panel
```
After each line make sure to hit enter and your output should look something like the following:

Following this just restart the monitoring-grafana container and the plugins will be ready to use.
### Setup InfluxDB as a data source.
```
Grafana > Configuration > Data Sources > Add data source
```
**It is important that you set the URL to http://:8086/**

### Setup the Dashboard
Grafana is not preconfigured with dashboard, so you have to import it from the Grafana dashboard repo.
```
Grafana > + > Import
```
Use the table found at [UnPollers](https://unpoller.com/docs/install/grafana) website for the dashboard you need for your hardware.
Type in the number for the appropriate dashboard in the "Import via grafana.com" box and click load

Once loaded ensure you select the InfluxDB datasource at the bottom and click import

Now we can display the dashboard
```
Grafana > Dashboard > Manage
```
The dashboard should now be accessible from the dashboards menu where the Raspberry Pi monitoring dashboard is located.
## Acknowledgment
* based on [Docker-Raspberry-PI-Monitoring](https://github.com/oijkn/Docker-Raspberry-PI-Monitoring) by Oijkn