rtorrent_exporter: github.com/mdlayher/rtorrent_exporter Index | Files

package rtorrentexporter

import "github.com/mdlayher/rtorrent_exporter"

Package rtorrentexporter provides the Exporter type used in the rtorrent_exporter Prometheus exporter.

Index

Package Files

downloadscollector.go rtorrentexporter.go

type DownloadsCollector Uses

type DownloadsCollector struct {
    Downloads           *prometheus.Desc
    DownloadsStarted    *prometheus.Desc
    DownloadsStopped    *prometheus.Desc
    DownloadsComplete   *prometheus.Desc
    DownloadsIncomplete *prometheus.Desc
    DownloadsHashing    *prometheus.Desc
    DownloadsSeeding    *prometheus.Desc
    DownloadsLeeching   *prometheus.Desc
    DownloadsActive     *prometheus.Desc

    DownloadRateBytes  *prometheus.Desc
    DownloadTotalBytes *prometheus.Desc
    UploadRateBytes    *prometheus.Desc
    UploadTotalBytes   *prometheus.Desc
    // contains filtered or unexported fields
}

A DownloadsCollector is a Prometheus collector for metrics regarding rTorrent downloads.

func NewDownloadsCollector Uses

func NewDownloadsCollector(ds DownloadsSource) *DownloadsCollector

NewDownloadsCollector creates a new DownloadsCollector which collects metrics regarding rTorrent downloads.

func (*DownloadsCollector) Collect Uses

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

Collect sends the metric values for each metric pertaining to the rTorrent downloads to the provided prometheus Metric channel.

func (*DownloadsCollector) Describe Uses

func (c *DownloadsCollector) 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 DownloadsSource Uses

type DownloadsSource interface {
    All() ([]string, error)
    Started() ([]string, error)
    Stopped() ([]string, error)
    Complete() ([]string, error)
    Incomplete() ([]string, error)
    Hashing() ([]string, error)
    Seeding() ([]string, error)
    Leeching() ([]string, error)
    Active() ([]string, error)

    BaseFilename(infoHash string) (string, error)
    DownloadRate(infoHash string) (int, error)
    DownloadTotal(infoHash string) (int, error)
    UploadRate(infoHash string) (int, error)
    UploadTotal(infoHash string) (int, error)
}

A DownloadsSource is a type which can retrieve downloads information from rTorrent. It is implemented by *rtorrent.DownloadService.

type Exporter Uses

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

An Exporter is a Prometheus exporter for rTorrent metrics. It wraps all rTorrent 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 Uses

func New(c *rtorrent.Client) *Exporter

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

func (*Exporter) Collect Uses

func (c *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 Uses

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

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

Package rtorrentexporter imports 4 packages (graph). Updated 2019-11-21. Refresh now. Tools for package owners.