Skip to content

Commit 8456f50

Browse files
author
bhemar
committed
Initial
0 parents  commit 8456f50

File tree

20 files changed

+1654
-0
lines changed

20 files changed

+1654
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.retry
2+
3+
.idea/

README.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Raspberry metrics
2+
=================
3+
4+
Expose raspberry PI metrics using [Grafana](https://grafana.com/) and [Prometheus](https://prometheus.io/):
5+
6+
![Example](./preview/Screen_Shot.jpg)
7+
8+
## About ##
9+
10+
This project contains [Ansible](https://www.ansible.com/) playbook which installs three services on Raspberry:
11+
12+
* [Node exporter](https://github.com/prometheus/node_exporter) - expose Raspberry metrics (v0.14.0)
13+
* [Prometheus](https://prometheus.io/) - collect and store metrics (v1.7.1)
14+
* [Grafana](https://grafana.com/) - metrics visualization (v4.3.2)
15+
16+
![Scheme](./preview/scheme.jpg)
17+
18+
### Prerequisites ###
19+
20+
* Raspberry PI with ARMv7 processor (Tested on [Raspberry PI 2 Model B](https://www.raspberrypi.org/products/raspberry-pi-2-model-b/))
21+
* Debian installed on Raspberry (like [Raspbian Jessie](https://www.raspberrypi.org/downloads/raspbian/))
22+
* open port 22 on raspberry (SSH)
23+
* open port 3000 on raspberry (Grafana)
24+
25+
## How to install ##
26+
27+
[Ansible](https://www.ansible.com/) is required for installation.
28+
29+
If you don't have Ansible installed, see [Ansible installation](http://docs.ansible.com/ansible/intro_installation.html).
30+
31+
### 1. Configure Raspberry IP address ###
32+
33+
Checkout project.
34+
35+
Edit file **ansible/hosts** and set Raspberry IP address.
36+
37+
### 2. Run ansible playbook ###
38+
39+
Run Ansible playbook with password authentication:
40+
```
41+
cd ansible/
42+
ansible-playbook raspberry.yml -i hosts -u pi -k -K
43+
```
44+
45+
Run Ansible playbook with SSH keys authentication:
46+
47+
```
48+
cd ansible/
49+
ansible-playbook raspberry.yml -i hosts -u pi
50+
```
51+
52+
### 3. Configure Grafana datasource ###
53+
54+
* Go to Grafana URL http://raspberry:3000/
55+
* login with admin/admin
56+
* add new Data Source:
57+
58+
![DataSource](./preview/dataSource.jpg)
59+
60+
* Click on "Raspberry metrics" dashboard:
61+
62+
![Dashboard](./preview/dashboard.png)
63+
64+
That's it.

ansible/group_vars/all/default

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Node_exporter variables
2+
node_exporter_install_path: '/opt/node-exporter'
3+
node_exporter_service_name: 'node-exporter'
4+
5+
# Prometheus variables
6+
prometheus_install_path: '/opt/prometheus'
7+
prometheus_service_name: 'prometheus'
8+
9+
# Grafana variables
10+
grafana_install_path: '/opt/grafana'

ansible/hosts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[hosts]
2+
192.168.0.20

ansible/raspberry.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
- name: Install Node exporter service
2+
hosts: hosts
3+
roles:
4+
- { role: 'node-exporter' }
5+
6+
- name: Install Prometheus service
7+
hosts: hosts
8+
roles:
9+
- { role: 'prometheus' }
10+
11+
- name: Install Grafana service
12+
hosts: hosts
13+
roles:
14+
- { role: 'grafana' }
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
grafana_download_url: https://bintray.com/fg2it/deb-rpi-1b/download_file?file_path=main%2Fg%2Fgrafana_4.3.2_armhf.deb
2+
grafana_filename: grafana_4.3.2_armhf.deb

0 commit comments

Comments
 (0)