rtorrentexporter

package module
v0.0.0-...-6da5c49 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

rtorrent_exporter GoDoc Build Status Coverage Status

Command rtorrent_exporter provides a Prometheus exporter for rTorrent.

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

MIT Licensed.

Usage

Available flags for rtorrent_exporter include:

$ ./rtorrent_exporter -h
Usage of ./rtorrent_exporter:
  -rtorrent.addr string
        address of rTorrent XML-RPC server
  -telemetry.addr string
        host:port for rTorrent exporter (default ":9135")
  -telemetry.path string
        URL path for surfacing collected metrics (default "/metrics")

An example of using rtorrent_exporter:

$ ./rtorrent_exporter -rtorrent.addr http://127.0.0.1/RPC2
2016/03/09 17:39:40 starting rTorrent exporter on ":9135" for server "http://127.0.0.1/RPC2"

Docker

docker build -t rtorrent_exporter .
docker run --rm -d -p 9135:9135 rtorrent_exporter -rtorrent.addr "http://127.0.0.1/RPC2"

Sample

Here is a screenshot of a sample dashboard created using grafana with metrics from exported from rtorrent_exporter.

sample

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadsCollector

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

func NewDownloadsCollector(ds DownloadsSource) *DownloadsCollector

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

func (*DownloadsCollector) Collect

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

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

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

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

func New(c *rtorrent.Client) *Exporter

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

func (*Exporter) Collect

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

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

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

Directories

Path Synopsis
cmd
rtorrent_exporter command
Command rtorrent_exporter provides a Prometheus exporter for rTorrent.
Command rtorrent_exporter provides a Prometheus exporter for rTorrent.

Jump to

Keyboard shortcuts

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