mirror of
https://github.com/ebrianne/adguard-exporter.git
synced 2024-12-22 07:47:35 +01:00
Added comments and LICENSE
This commit is contained in:
parent
36002afe3a
commit
12dd014d97
19
LICENSE
Normal file
19
LICENSE
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2020 Eldwan Brianne <12190353+ebrianne@users.noreply.github.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -89,7 +89,7 @@ func (c *Client) getStatistics() *Stats {
|
||||
|
||||
req, err := http.NewRequest("GET", statsURL, nil)
|
||||
if err != nil {
|
||||
log.Fatal("An error has occured when creating HTTP statistics request ", err)
|
||||
log.Fatal("An error has occurred when creating HTTP statistics request ", err)
|
||||
}
|
||||
|
||||
if c.isUsingPassword() {
|
||||
@ -98,7 +98,7 @@ func (c *Client) getStatistics() *Stats {
|
||||
|
||||
resp, err := c.httpClient.Do(req)
|
||||
if err != nil {
|
||||
log.Printf("An error has occured during login to Adguard: %v", err)
|
||||
log.Printf("An error has occurred during login to Adguard: %v", err)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
|
@ -2,10 +2,7 @@ package adguard
|
||||
|
||||
import "fmt"
|
||||
|
||||
const (
|
||||
enabledStatus = "enabled"
|
||||
)
|
||||
|
||||
// Stats struct is the Adguard statistics JSON API corresponding model.
|
||||
type Stats struct {
|
||||
AvgProcessingTime float64 `json:"avg_processing_time"`
|
||||
DnsQueries int `json:"num_dns_queries"`
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// AvgProcessingTime - Average processing time for a DNS query
|
||||
AvgProcessingTime = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "avg_processing_time",
|
||||
@ -16,6 +17,7 @@ var (
|
||||
[]string{"hostname"},
|
||||
)
|
||||
|
||||
// DnsQueries - Number of DNS queries
|
||||
DnsQueries = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "num_dns_queries",
|
||||
@ -25,6 +27,7 @@ var (
|
||||
[]string{"hostname"},
|
||||
)
|
||||
|
||||
// BlockedFiltering - Number of DNS queries blocked
|
||||
BlockedFiltering = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "num_blocked_filtering",
|
||||
@ -34,6 +37,7 @@ var (
|
||||
[]string{"hostname"},
|
||||
)
|
||||
|
||||
// ParentalFiltering - Number of DNS queries replaced by parental control
|
||||
ParentalFiltering = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "num_replaced_parental",
|
||||
@ -43,6 +47,7 @@ var (
|
||||
[]string{"hostname"},
|
||||
)
|
||||
|
||||
// SafeBrowsingFiltering - Number of DNS queries replaced by safe browsing
|
||||
SafeBrowsingFiltering = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "num_replaced_safebrowsing",
|
||||
@ -52,6 +57,7 @@ var (
|
||||
[]string{"hostname"},
|
||||
)
|
||||
|
||||
// SafeSearchFiltering - Number of DNS queries replaced by safe search
|
||||
SafeSearchFiltering = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "num_replaced_safesearch",
|
||||
@ -61,6 +67,7 @@ var (
|
||||
[]string{"hostname"},
|
||||
)
|
||||
|
||||
// TopQueries - The number of top queries
|
||||
TopQueries = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "top_queried_domains",
|
||||
@ -70,6 +77,7 @@ var (
|
||||
[]string{"hostname", "domain"},
|
||||
)
|
||||
|
||||
// TopBlocked - The number of top domains blocked
|
||||
TopBlocked = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "top_blocked_domains",
|
||||
@ -79,6 +87,7 @@ var (
|
||||
[]string{"hostname", "domain"},
|
||||
)
|
||||
|
||||
// TopClients - The number of top clients
|
||||
TopClients = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "top_clients",
|
||||
|
Loading…
Reference in New Issue
Block a user