exporter

package
v0.0.0-...-e1c9284 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFunc

type ClientFunc func() (*api.Client, error)

A ClientFunc is a function which can return an authenticated UniFi client. A ClientFunc is invoked by an Exporter whenever authentication against a UniFi controller fails, such as when a user's privileges are revoked or the authenticated session times out.

type DeviceCollector

type DeviceCollector struct {
	Devices          *prometheus.Desc
	AdoptedDevices   *prometheus.Desc
	UnadoptedDevices *prometheus.Desc

	UptimeSecondsTotal *prometheus.Desc

	ReceivedBytesTotal      *prometheus.Desc
	TransmittedBytesTotal   *prometheus.Desc
	ReceivedPacketsTotal    *prometheus.Desc
	TransmittedPacketsTotal *prometheus.Desc
	TransmittedDroppedTotal *prometheus.Desc

	Stations *prometheus.Desc
	// contains filtered or unexported fields
}

A DeviceCollector is a Prometheus collector for metrics regarding Ubiquiti UniFi devices.

func NewDeviceCollector

func NewDeviceCollector(c *api.Client, sites []*api.Site) *DeviceCollector

NewDeviceCollector creates a new DeviceCollector which collects metrics for a specified site.

func (*DeviceCollector) Collect

func (c *DeviceCollector) Collect(ch chan<- prometheus.Metric)

Collect is the same as CollectError, but ignores any errors which occur. Collect exists to satisfy the prometheus.Collector interface.

func (*DeviceCollector) CollectError

func (c *DeviceCollector) CollectError(ch chan<- prometheus.Metric) error

CollectError sends the metric values for each metric pertaining to the global cluster usage over to the provided prometheus Metric channel, returning any errors which occur.

func (*DeviceCollector) Describe

func (c *DeviceCollector) Describe(ch chan<- *prometheus.Desc)

Describe sends the descriptors of each metric over to the provided channel. The corresponding metric values are sent separately.

type Exporter

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

An Exporter is a Prometheus exporter for Ubiquiti UniFi Controller API metrics. It wraps all UniFi metrics collectors and provides a single global exporter which can serve metrics. It also ensures that the collection is done in a thread-safe manner, the necessary requirement stated by Prometheus. It implements the prometheus.Collector interface in order to register with Prometheus.

func New

func New(sites []*api.Site, fn ClientFunc) (*Exporter, error)

New creates a new Exporter which collects metrics from one or mote sites.

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

Collect sends the collected metrics from each of the collectors to prometheus. Collect could be called several times concurrently and thus its run is protected by a single mutex.

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

Describe sends all the descriptors of the collectors included to the provided channel.

type StationCollector

type StationCollector struct {
	Stations *prometheus.Desc

	ReceivedBytesTotal    *prometheus.Desc
	TransmittedBytesTotal *prometheus.Desc

	ReceivedPacketsTotal    *prometheus.Desc
	TransmittedPacketsTotal *prometheus.Desc

	RSSIDBM  *prometheus.Desc
	NoiseDBM *prometheus.Desc
	// contains filtered or unexported fields
}

A StationCollector is a Prometheus collector for metrics regarding Ubiquiti UniFi stations (clients).

func NewStationCollector

func NewStationCollector(c *api.Client, sites []*api.Site) *StationCollector

NewStationCollector creates a new StationCollector which collects metrics for a specified site.

func (*StationCollector) Collect

func (c *StationCollector) Collect(ch chan<- prometheus.Metric)

Collect is the same as Collect, but ignores any errors which occur. Collect exists to satisfy the prometheus.Collector interface.

func (*StationCollector) CollectError

func (c *StationCollector) CollectError(ch chan<- prometheus.Metric) error

CollectError sends the metric values for each metric pertaining to the global cluster usage over to the provided prometheus Metric channel, returning any errors which occur.

func (*StationCollector) Describe

func (c *StationCollector) Describe(ch chan<- *prometheus.Desc)

Describe sends the descriptors of each metric over to the provided channel. The corresponding metric values are sent separately.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL