Added Travis-CI
This commit is contained in:
parent
7457599d3e
commit
021de28520
3 changed files with 89 additions and 4 deletions
42
.travis.yml
Normal file
42
.travis.yml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
language: go
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- go: 1.x
|
||||||
|
env: LATEST=true
|
||||||
|
- go: 1.8.x
|
||||||
|
- go: 1.9.x
|
||||||
|
- go: 1.10.x
|
||||||
|
- go: 1.11.x
|
||||||
|
- go: 1.12.x
|
||||||
|
- go: tip
|
||||||
|
allow_failures:
|
||||||
|
- go: tip
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- go get github.com/mitchellh/gox
|
||||||
|
|
||||||
|
install:
|
||||||
|
- export GO111MODULE=on
|
||||||
|
- go get -t -v ./...
|
||||||
|
|
||||||
|
script:
|
||||||
|
- go test -v -race ./...
|
||||||
|
- if [ "${LATEST}" = "true" ]; then gox -os="linux darwin windows" -arch="386 amd64" -osarch="linux/arm" -output="pihole_exporter-{{.OS}}-{{.Arch}}" -verbose ./...; fi
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
provider: releases
|
||||||
|
skip_cleanup: true
|
||||||
|
api_key:
|
||||||
|
secure: $GITHUB_TOKEN
|
||||||
|
file:
|
||||||
|
- pihole_exporter-windows-386.exe
|
||||||
|
- pihole_exporter-windows-amd64.exe
|
||||||
|
- pihole_exporter-darwin-386
|
||||||
|
- pihole_exporter-darwin-amd64
|
||||||
|
- pihole_exporter-linux-386
|
||||||
|
- pihole_exporter-linux-amd64
|
||||||
|
- pihole_exporter-linux-arm
|
||||||
|
on:
|
||||||
|
repo: eko/pihole-exporter
|
||||||
|
tags: true
|
||||||
|
condition: $LATEST = true
|
49
README.md
49
README.md
|
@ -1,5 +1,9 @@
|
||||||
# PI-Hole Prometheus Exporter
|
# PI-Hole Prometheus Exporter
|
||||||
|
|
||||||
|
[![TravisBuildStatus](https://api.travis-ci.org/eko/pihole-exporter.svg?branch=master)](https://travis-ci.org/eko/pihole-exporte)
|
||||||
|
[![GoDoc](https://godoc.org/github.com/eko/pihole-exporter?status.png)](https://godoc.org/github.com/eko/pihole-exporter)
|
||||||
|
[![GoReportCard](https://goreportcard.com/badge/github.com/eko/pihole-exporter)](https://goreportcard.com/report/github.com/eko/pihole-exporter)
|
||||||
|
|
||||||
This is a Prometheus exporter for [PI-Hole](https://pi-hole.net/)'s Raspberry PI ad blocker.
|
This is a Prometheus exporter for [PI-Hole](https://pi-hole.net/)'s Raspberry PI ad blocker.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
@ -8,7 +12,7 @@ This is a Prometheus exporter for [PI-Hole](https://pi-hole.net/)'s Raspberry PI
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Manually
|
### From sources
|
||||||
|
|
||||||
First, retrieve the project:
|
First, retrieve the project:
|
||||||
```bash
|
```bash
|
||||||
|
@ -17,23 +21,62 @@ $ go get -u github.com/eko/pihole-exporter
|
||||||
$ git clone https://github.com/eko/pihole-exporter.git
|
$ git clone https://github.com/eko/pihole-exporter.git
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, build the binary:
|
Then, build the binary (here, an example to run on Raspberry PI ARM architecture):
|
||||||
```bash
|
```bash
|
||||||
$ GOOS=linux GOARCH=arm GOARM=7 go build -o pihole_exporter .
|
$ GOOS=linux GOARCH=arm GOARM=7 go build -o pihole_exporter .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Download binary
|
||||||
|
|
||||||
|
You can also download the latest version of the binary built for your architecture here:
|
||||||
|
|
||||||
|
* Architecture **i386** [
|
||||||
|
[Darwin](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-darwin-386) /
|
||||||
|
[Linux](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-386) /
|
||||||
|
[Windows](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-windows-386.exe)
|
||||||
|
]
|
||||||
|
* Architecture **amd64** [
|
||||||
|
[Darwin](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-darwin-amd64) /
|
||||||
|
[Linux](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-amd64) /
|
||||||
|
[Windows](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-windows-amd64.exe)
|
||||||
|
]
|
||||||
|
* Architecture **arm** [
|
||||||
|
[Linux](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-arm)
|
||||||
|
]
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
In order to run the exporter, type the following command (arguments are optional):
|
In order to run the exporter, type the following command (arguments are optional):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./pihole_exporter -pihole_hostname 192.168.1.10 -pihole_password azerty
|
$ ./pihole_exporter -pihole_hostname 192.168.1.10 -pihole_password azerty
|
||||||
|
|
||||||
|
2019/05/09 09:32:19 ------------------------------------
|
||||||
|
2019/05/09 09:32:19 - PI-Hole exporter configuration -
|
||||||
|
2019/05/09 09:32:19 ------------------------------------
|
||||||
|
2019/05/09 09:32:19 PIHoleHostname : 192.168.1.10
|
||||||
|
2019/05/09 09:32:19 PIHolePassword : azerty
|
||||||
|
2019/05/09 09:32:19 Port : 9311
|
||||||
|
2019/05/09 09:32:19 Interval : 10s
|
||||||
|
2019/05/09 09:32:19 ------------------------------------
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_domains_being_blocked", help: "This represent the number of domains being blocked", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_dns_queries_today", help: "This represent the number of DNS queries made over the current day", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_ads_blocked_today", help: "This represent the number of ads blocked over the current day", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_ads_percentage_today", help: "This represent the percentage of ads blocked over the current day", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_unique_domains", help: "This represent the number of unique domains seen", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_queries_forwarded", help: "This represent the number of queries forwarded", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_queries_cached", help: "This represent the number of queries cached", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_clients_ever_seen", help: "This represent the number of clients ever seen", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_unique_clients", help: "This represent the number of unique clients seen", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 New prometheus metric registered: Desc{fqName: "pihole_dns_queries_all_types", help: "This represent the number of DNS queries made for all types", constLabels: {}, variableLabels: []}
|
||||||
|
2019/05/09 09:32:19 Starting HTTP server
|
||||||
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
## Available options
|
## Available options
|
||||||
```bash
|
```bash
|
||||||
# Interval of time the exporter will fetch data from PI-Hole
|
# Interval of time the exporter will fetch data from PI-Hole
|
||||||
-interval duration (optional) (default 5s)
|
-interval duration (optional) (default 10s)
|
||||||
|
|
||||||
# Hostname of the Raspberry PI where PI-Hole is installed
|
# Hostname of the Raspberry PI where PI-Hole is installed
|
||||||
-pihole_hostname string (optional) (default "127.0.0.1")
|
-pihole_hostname string (optional) (default "127.0.0.1")
|
||||||
|
|
|
@ -27,7 +27,7 @@ func getDefaultConfig() *Config {
|
||||||
PIHolePassword: "",
|
PIHolePassword: "",
|
||||||
|
|
||||||
Port: "9311",
|
Port: "9311",
|
||||||
Interval: 5 * time.Second,
|
Interval: 10 * time.Second,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue