Documentation ¶
Overview ¶
Package promunifi provides the bridge between unifi metrics and prometheus.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewUnifiCollector ¶
func NewUnifiCollector(opts UnifiCollectorCnfg) prometheus.Collector
NewUnifiCollector returns a prometheus collector that will export any available UniFi metrics. You must provide a collection function in the opts.
Types ¶
type Report ¶
type Report struct { Total int // Total count of metrics recorded. Errors int // Total count of errors recording metrics. Zeros int // Total count of metrics equal to zero. Descs int // Total count of unique metrics descriptions. Metrics *metrics.Metrics // Metrics collected and recorded. Elapsed time.Duration // Duration elapsed collecting and exporting. Fetch time.Duration // Duration elapsed making controller requests. Start time.Time // Time collection began. // contains filtered or unexported fields }
Report is passed into LoggingFn to log the export metrics to stdout (outside this package).
type UnifiCollectorCnfg ¶
type UnifiCollectorCnfg struct { // If non-empty, each of the collected metrics is prefixed by the // provided string and an underscore ("_"). Namespace string // If true, any error encountered during collection is reported as an // invalid metric (see NewInvalidMetric). Otherwise, errors are ignored // and the collected metrics will be incomplete. Possibly, no metrics // will be collected at all. ReportErrors bool // This function is passed to the Collect() method. The Collect method runs // this function to retrieve the latest UniFi measurements and export them. CollectFn func() (*metrics.Metrics, error) // Provide a logger function if you want to run a routine *after* prometheus checks in. LoggingFn func(*Report) }
UnifiCollectorCnfg defines the data needed to collect and report UniFi Metrics.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.