pihole-exporter: github.com/eko/pihole-exporter/internal/pihole Index | Files

package pihole

import "github.com/eko/pihole-exporter/internal/pihole"

Index

Package Files

client.go model.go

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

Client struct is a PI-Hole client to request an instance of a PI-Hole ad blocker.

func NewClient Uses

func NewClient(hostname, password string, interval time.Duration) *Client

NewClient method initializes a new PI-Hole client.

func (*Client) Scrape Uses

func (c *Client) Scrape()

Scrape method logins and retrieves statistics from PI-Hole JSON API and then pass them as Prometheus metrics.

type Stats Uses

type Stats struct {
    DomainsBeingBlocked int                `json:"domains_being_blocked"`
    DNSQueriesToday     int                `json:"dns_queries_today"`
    AdsBlockedToday     int                `json:"ads_blocked_today"`
    AdsPercentageToday  float64            `json:"ads_percentage_today"`
    UniqueDomains       int                `json:"unique_domains"`
    QueriesForwarded    int                `json:"queries_forwarded"`
    QueriesCached       int                `json:"queries_cached"`
    ClientsEverSeen     int                `json:"clients_ever_seen"`
    UniqueClients       int                `json:"unique_clients"`
    DNSQueriesAllTypes  int                `json:"dns_queries_all_types"`
    ReplyNoData         int                `json:"reply_NODATA"`
    ReplyNxDomain       int                `json:"reply_NXDOMAIN"`
    ReplyCname          int                `json:"reply_CNAME"`
    ReplyIP             int                `json:"reply_IP"`
    TopQueries          map[string]int     `json:"top_queries"`
    TopAds              map[string]int     `json:"top_ads"`
    TopSources          map[string]int     `json:"top_sources"`
    ForwardDestinations map[string]float64 `json:"forward_destinations"`
    QueryTypes          map[string]float64 `json:"querytypes"`
    Status              string             `json:"status"`
}

Stats struct is the PI-Hole statistics JSON API corresponding model.

func (*Stats) ToString Uses

func (s *Stats) ToString() string

ToString method returns a string of the current statistics struct.

Package pihole imports 10 packages (graph) and is imported by 1 packages. Updated 2019-10-26. Refresh now. Tools for package owners.