├── .gitignore ├── .golangci.yml ├── .github ├── dependabot.yml └── workflows │ ├── release.yml │ └── test.yml ├── docker-compose.yml ├── Dockerfile ├── .goreleaser.yaml ├── go.mod ├── README.md ├── main.go ├── exporter └── exporter.go ├── go.sum └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | dist/ 3 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | linters: 2 | disable: 3 | - errcheck 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gomod" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | - package-ecosystem: "docker" 8 | directory: "/" 9 | schedule: 10 | interval: "weekly" 11 | - package-ecosystem: "github-actions" 12 | directory: "/" 13 | schedule: 14 | interval: "weekly" 15 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | exporter: 3 | build: . 4 | command: ['--rtorrent.scrape-uri=http://rtorrent:8000/RPC2'] 5 | exporter-scraper: 6 | image: cgr.dev/chainguard/busybox:latest 7 | command: sh -c 'watch -n 5 wget -qO- exporter:9135/metrics | grep rtorrent_' 8 | rtorrent: 9 | image: crazymax/rtorrent-rutorrent:latest 10 | ports: 11 | - 8080 12 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM cgr.dev/chainguard/go:latest AS builder 2 | WORKDIR /usr/local/src/rtorrent_exporter 3 | COPY go.mod go.sum ./ 4 | RUN go mod download -x 5 | COPY . . 6 | RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o /usr/local/bin/rtorrent_exporter 7 | 8 | FROM cgr.dev/chainguard/static:latest 9 | COPY --from=builder /usr/local/bin/rtorrent_exporter /usr/local/bin/rtorrent_exporter 10 | EXPOSE 9135 11 | ENTRYPOINT [ "/usr/local/bin/rtorrent_exporter" ] 12 | CMD [ "" ] 13 | -------------------------------------------------------------------------------- /.goreleaser.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | env: 3 | - KO_DOCKER_REPO=ghcr.io/{{ .Env.GITHUB_REPOSITORY }} 4 | before: 5 | hooks: 6 | - go mod tidy 7 | builds: 8 | - env: 9 | - CGO_ENABLED=0 10 | goos: 11 | - linux 12 | - windows 13 | - darwin 14 | mod_timestamp: "{{ .CommitTimestamp }}" 15 | ldflags: 16 | - -s -w 17 | - -X github.com/prometheus/common/version.Version={{.Version}} 18 | - -X github.com/prometheus/common/version.Revision={{.Commit}} 19 | - -X github.com/prometheus/common/version.Branch={{.Branch}} 20 | - -X github.com/prometheus/common/version.BuildDate={{.Date}} 21 | archives: 22 | - format_overrides: 23 | - goos: windows 24 | format: zip 25 | kos: 26 | - base_image: cgr.dev/chainguard/static 27 | bare: true 28 | platforms: 29 | - linux/amd64 30 | - linux/arm64 31 | tags: 32 | - latest 33 | - "{{.Tag}}" 34 | creation_time: "{{.CommitTimestamp}}" 35 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | permissions: 10 | contents: write # create releases 11 | packages: write # push to ghcr 12 | 13 | jobs: 14 | release: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: WillAbides/setup-go-faster@v1.14.0 18 | with: 19 | go-version: stable 20 | - uses: actions/checkout@v6 21 | with: 22 | fetch-depth: 0 23 | - uses: go-semantic-release/action@v1 24 | with: 25 | allow-initial-development-versions: true 26 | github-token: ${{ secrets.GITHUB_TOKEN }} 27 | - uses: actions/checkout@v6 28 | with: 29 | fetch-depth: 0 30 | - uses: actions/cache@v5 31 | with: 32 | path: ~/go/pkg/mod 33 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 34 | restore-keys: | 35 | ${{ runner.os }}-go- 36 | - run: go mod download -x 37 | - name: Define goreleaser flags 38 | run: test -n "$(git tag --points-at HEAD)" || echo "GORELEASER_FLAGS=--snapshot" >> $GITHUB_ENV 39 | - uses: goreleaser/goreleaser-action@v6 40 | with: 41 | version: latest 42 | args: release --clean ${{ env.GORELEASER_FLAGS }} 43 | env: 44 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 45 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/thde/rtorrent_exporter 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/alecthomas/kingpin/v2 v2.4.0 7 | github.com/go-kit/log v0.2.1 8 | github.com/mrobinsn/go-rtorrent v1.8.0 9 | github.com/prometheus/client_golang v1.20.5 10 | github.com/prometheus/common v0.59.1 11 | github.com/prometheus/exporter-toolkit v0.11.0 12 | ) 13 | 14 | require ( 15 | github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect 16 | github.com/beorn7/perks v1.0.1 // indirect 17 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 18 | github.com/coreos/go-systemd/v22 v22.5.0 // indirect 19 | github.com/go-logfmt/logfmt v0.6.0 // indirect 20 | github.com/jpillora/backoff v1.0.0 // indirect 21 | github.com/klauspost/compress v1.17.9 // indirect 22 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect 23 | github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect 24 | github.com/pkg/errors v0.9.1 // indirect 25 | github.com/prometheus/client_model v0.6.1 // indirect 26 | github.com/prometheus/procfs v0.15.1 // indirect 27 | github.com/xhit/go-str2duration/v2 v2.1.0 // indirect 28 | golang.org/x/crypto v0.45.0 // indirect 29 | golang.org/x/net v0.47.0 // indirect 30 | golang.org/x/oauth2 v0.27.0 // indirect 31 | golang.org/x/sync v0.18.0 // indirect 32 | golang.org/x/sys v0.38.0 // indirect 33 | golang.org/x/text v0.31.0 // indirect 34 | google.golang.org/protobuf v1.34.2 // indirect 35 | gopkg.in/yaml.v2 v2.4.0 // indirect 36 | ) 37 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | push: 5 | tags: 6 | - v* 7 | branches: 8 | - main 9 | pull_request: 10 | 11 | permissions: 12 | contents: read 13 | pull-requests: read 14 | 15 | jobs: 16 | test: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: WillAbides/setup-go-faster@v1.14.0 20 | with: 21 | go-version: stable 22 | - uses: actions/checkout@v6 23 | with: 24 | fetch-depth: 1 25 | - uses: actions/cache@v5 26 | with: 27 | path: ~/go/pkg/mod 28 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 29 | restore-keys: | 30 | ${{ runner.os }}-go- 31 | - run: go mod download -x 32 | - run: go test -v ./... -race -bench=. -benchmem -cover -coverprofile cover.out 2>&1 | tee test.out 33 | - run: go tool cover -func cover.out 34 | lint: 35 | runs-on: ubuntu-latest 36 | steps: 37 | - uses: WillAbides/setup-go-faster@v1.14.0 38 | with: 39 | go-version: stable 40 | - uses: actions/checkout@v6 41 | with: 42 | fetch-depth: 1 43 | - uses: actions/cache@v5 44 | with: 45 | path: ~/go/pkg/mod 46 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 47 | restore-keys: | 48 | ${{ runner.os }}-go- 49 | - run: go mod download -x 50 | - run: go mod tidy && git diff --exit-code go.mod go.sum 51 | - run: go vet ./... 52 | - uses: dominikh/staticcheck-action@v1.4.0 53 | with: 54 | install-go: false 55 | - uses: golangci/golangci-lint-action@v6 56 | with: 57 | version: latest 58 | args: > 59 | --enable 60 | asasalint,bidichk,dupword,errchkjson,godot,gofumpt,gosec,gosimple,ineffassign,misspell,loggercheck,revive,unused 61 | --disable 62 | errcheck 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Prometheus rTorrent Exporter 2 | 3 | `rtorrent_exporter` exposes metrics from a rtorrent instance. 4 | 5 | ## Installation 6 | 7 | Binaries can be downloaded from the [Github releases](https://github.com/thde/rtorrent_exporter/releases) page and need no 8 | special installation. 9 | 10 | A Docker container (`ghcr.io/thde/rtorrent_exporter:latest`) is also available through [Github's registry](https://github.com/thde/rtorrent_exporter/pkgs/container/rtorrent_exporter). 11 | 12 | ## Usage 13 | 14 | ``` 15 | usage: rtorrent_exporter [] 16 | 17 | Prometheus exporter for rTorrent. 18 | 19 | Flags: 20 | -h, --[no-]help Show context-sensitive help (also try --help-long and --help-man). ($RTORRENT_EXPORTER_HELP) 21 | --web.listen-address=:9135 ... 22 | Addresses on which to expose metrics and web interface. Repeatable for multiple addresses. 23 | ($RTORRENT_EXPORTER_WEB_LISTEN_ADDRESS) 24 | --web.config.file="" Path to configuration file that can enable TLS or authentication. See: 25 | https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md 26 | ($RTORRENT_EXPORTER_WEB_CONFIG_FILE) 27 | --web.telemetry-path="/metrics" 28 | Path under which to expose metrics. ($RTORRENT_EXPORTER_WEB_TELEMETRY_PATH) 29 | --rtorrent.scrape-uri="http://localhost/RPC2" 30 | URI on which to scrape rTorrent. Use http://user:pass@host.com to supply basic auth 31 | credentials. ($RTORRENT_EXPORTER_RTORRENT_SCRAPE_URI) 32 | --[no-]rtorrent.ssl-verify 33 | Flag that enables SSL certificate verification for the scrape URI. 34 | ($RTORRENT_EXPORTER_RTORRENT_SSL_VERIFY) 35 | --rtorrent.timeout=5s Timeout for trying to get stats from rtorrent. ($RTORRENT_EXPORTER_RTORRENT_TIMEOUT) 36 | --log.level=info Only log messages with the given severity or above. One of: [debug, info, warn, error] 37 | ($RTORRENT_EXPORTER_LOG_LEVEL) 38 | --log.format=logfmt Output format of log messages. One of: [logfmt, json] ($RTORRENT_EXPORTER_LOG_FORMAT) 39 | --[no-]version Show application version. ($RTORRENT_EXPORTER_VERSION) 40 | ``` 41 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "net/http" 5 | "os" 6 | 7 | "github.com/alecthomas/kingpin/v2" 8 | "github.com/go-kit/log" 9 | "github.com/go-kit/log/level" 10 | "github.com/mrobinsn/go-rtorrent/rtorrent" 11 | "github.com/prometheus/client_golang/prometheus" 12 | collectorsversion "github.com/prometheus/client_golang/prometheus/collectors/version" 13 | "github.com/prometheus/client_golang/prometheus/promhttp" 14 | "github.com/prometheus/common/promlog" 15 | logflag "github.com/prometheus/common/promlog/flag" 16 | "github.com/prometheus/common/version" 17 | "github.com/prometheus/exporter-toolkit/web" 18 | webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag" 19 | 20 | "github.com/thde/rtorrent_exporter/exporter" 21 | ) 22 | 23 | const ( 24 | namespace = "rtorrent" 25 | name = namespace + "_exporter" 26 | ) 27 | 28 | var ( 29 | cli = kingpin.New(name, "Prometheus exporter for rTorrent.").DefaultEnvars() 30 | webConfig = webflag.AddFlags(cli, ":9135") 31 | metricsPath = cli.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String() 32 | rtorrentScrapeURI = cli.Flag("rtorrent.scrape-uri", "URI on which to scrape rTorrent. Use http://user:pass@host.com to supply basic auth credentials.").Default("http://localhost/RPC2").String() 33 | rtorrentSSLVerify = cli.Flag("rtorrent.ssl-verify", "Flag that enables SSL certificate verification for the scrape URI.").Default("true").Bool() 34 | rtorrentTimeout = cli.Flag("rtorrent.timeout", "Timeout for trying to get stats from rtorrent.").Default("5s").Duration() 35 | ) 36 | 37 | func run(logger log.Logger) error { 38 | level.Info(logger).Log("msg", "Starting rtorrent_exporter", "version", version.Info()) 39 | level.Info(logger).Log("build_context", version.BuildContext()) 40 | 41 | prometheus.MustRegister(collectorsversion.NewCollector(name)) 42 | 43 | http.Handle(*metricsPath, promhttp.Handler()) 44 | http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { 45 | _, _ = w.Write([]byte(` 46 | 47 | 48 | 49 | rtorrent exporter 50 | 51 | 52 |
rtorrent exporter
`)) 53 | }) 54 | 55 | counter := prometheus.NewCounterVec( 56 | prometheus.CounterOpts{ 57 | Name: prometheus.BuildFQName(namespace, "client", "requests_total"), 58 | Help: "A counter for requests from the rtorrent client.", 59 | }, 60 | []string{"code", "method"}, 61 | ) 62 | prometheus.MustRegister(counter) 63 | 64 | conn := rtorrent.New(*rtorrentScrapeURI, *rtorrentSSLVerify).WithHTTPClient(&http.Client{ 65 | Timeout: *rtorrentTimeout, 66 | Transport: promhttp.InstrumentRoundTripperCounter(counter, http.DefaultTransport), 67 | }) 68 | e := exporter.Exporter{ 69 | Namespace: namespace, 70 | Client: *conn, 71 | Logger: logger, 72 | } 73 | prometheus.MustRegister(&e) 74 | 75 | srv := &http.Server{ 76 | ReadTimeout: *rtorrentTimeout, 77 | WriteTimeout: *rtorrentTimeout, 78 | } 79 | return web.ListenAndServe(srv, webConfig, logger) 80 | } 81 | 82 | func main() { 83 | promlogConfig := &promlog.Config{} 84 | logger := promlog.New(promlogConfig) 85 | 86 | logflag.AddFlags(cli, promlogConfig) 87 | cli.Version(version.Print(name)) 88 | cli.HelpFlag.Short('h') 89 | if _, err := cli.Parse(os.Args[1:]); err != nil { 90 | level.Error(logger).Log("msg", "Error parsing CLI flags", "err", err) 91 | os.Exit(1) 92 | } 93 | 94 | if err := run(logger); err != nil { 95 | level.Error(logger).Log("msg", "Error starting exporter", "err", err) 96 | os.Exit(1) 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /exporter/exporter.go: -------------------------------------------------------------------------------- 1 | package exporter 2 | 3 | import ( 4 | "github.com/go-kit/log" 5 | "github.com/go-kit/log/level" 6 | "github.com/mrobinsn/go-rtorrent/rtorrent" 7 | "github.com/prometheus/client_golang/prometheus" 8 | ) 9 | 10 | const namespace = "rtorrent" 11 | 12 | var ( 13 | rtorrentInfo = prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "info"), "rtorrent info.", []string{"name", "ip"}, nil) 14 | rtorrentUp = prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "up"), "Was the last scrape of rTorrent successful.", nil, nil) 15 | rtorrentDownloadedTotal = prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "downloaded_bytes_total"), "Total downloaded bytes", nil, nil) 16 | rtorrentUploadedTotal = prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "uploaded_bytes_total"), "Total uploaded bytes", nil, nil) 17 | rtorrentTorrents = prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "torrents_total"), "Torrent count by view.", []string{"view", "label"}, nil) 18 | 19 | rtorrentDownloadedDeprecated = prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "downloaded_bytes"), "DEPRECATED: use downloaded_bytes_total", nil, nil) 20 | rtorrentUploadedDeprecated = prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "uploaded_bytes"), "DEPRECATED: use uploaded_bytes_total", nil, nil) 21 | ) 22 | 23 | // Exporter returns a prometheus.Collector that gathers rTorrent metrics. 24 | type Exporter struct { 25 | Namespace string 26 | Client rtorrent.RTorrent 27 | Logger log.Logger 28 | } 29 | 30 | // Describe sends the super-set of all possible descriptors of metrics 31 | // collected by this Collector to the provided channel and returns once 32 | // the last descriptor has been sent. 33 | func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { 34 | ch <- rtorrentInfo 35 | ch <- rtorrentUp 36 | } 37 | 38 | // Collect is called by the Prometheus registry when collecting 39 | // metrics. The implementation sends each collected metric via the 40 | // provided channel and returns once the last metric has been sent. 41 | func (e *Exporter) Collect(ch chan<- prometheus.Metric) { 42 | up := e.scrape(ch) 43 | 44 | ch <- prometheus.MustNewConstMetric(rtorrentUp, prometheus.GaugeValue, up) 45 | } 46 | 47 | func (e *Exporter) scrape(ch chan<- prometheus.Metric) (up float64) { 48 | name, err := e.Client.Name() 49 | if err != nil { 50 | level.Error(e.Logger).Log("msg", "Can't scrape rTorrent", "err", err) 51 | return 1 52 | } 53 | 54 | ip, err := e.Client.IP() 55 | if err != nil { 56 | level.Error(e.Logger).Log("msg", "Can't scrape rTorrent", "err", err) 57 | return 1 58 | } 59 | 60 | ch <- prometheus.MustNewConstMetric(rtorrentInfo, prometheus.GaugeValue, 1, name, ip) 61 | 62 | downloaded, err := e.Client.DownTotal() 63 | if err != nil { 64 | level.Error(e.Logger).Log("msg", "Can't scrape rTorrent", "err", err) 65 | return 1 66 | 67 | } 68 | ch <- prometheus.MustNewConstMetric(rtorrentDownloadedDeprecated, prometheus.CounterValue, float64(downloaded)) 69 | ch <- prometheus.MustNewConstMetric(rtorrentDownloadedTotal, prometheus.CounterValue, float64(downloaded)) 70 | 71 | uploaded, err := e.Client.UpTotal() 72 | if err != nil { 73 | level.Error(e.Logger).Log("msg", "Can't scrape rTorrent", "err", err) 74 | return 1 75 | } 76 | ch <- prometheus.MustNewConstMetric(rtorrentUploadedDeprecated, prometheus.CounterValue, float64(uploaded)) 77 | ch <- prometheus.MustNewConstMetric(rtorrentUploadedTotal, prometheus.CounterValue, float64(uploaded)) 78 | 79 | for name, view := range map[string]rtorrent.View{ 80 | "main": rtorrent.ViewMain, 81 | "seeding": rtorrent.ViewSeeding, 82 | "hashing": rtorrent.ViewHashing, 83 | "started": rtorrent.ViewStarted, 84 | "stopped": rtorrent.ViewStopped, 85 | } { 86 | torrents, err := e.Client.GetTorrents(view) 87 | if err != nil { 88 | level.Error(e.Logger).Log("msg", "Can't scrape rTorrent", "err", err) 89 | return 1 90 | } 91 | if len(torrents) == 0 { // report zero value 92 | ch <- prometheus.MustNewConstMetric(rtorrentTorrents, prometheus.CounterValue, 0, name, "") 93 | continue 94 | } 95 | 96 | grouped := map[string][]rtorrent.Torrent{} 97 | for _, torrent := range torrents { 98 | grouped[torrent.Label] = append(grouped[torrent.Label], torrent) 99 | } 100 | 101 | for label, torrents := range grouped { 102 | ch <- prometheus.MustNewConstMetric(rtorrentTorrents, prometheus.CounterValue, float64(len(torrents)), name, label) 103 | } 104 | } 105 | 106 | return 0 107 | } 108 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 2 | github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY= 3 | github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= 4 | github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 h1:ez/4by2iGztzR4L0zgAOR8lTQK9VlyBVVd7G4omaOQs= 5 | github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= 6 | github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 7 | github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 8 | github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= 9 | github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 10 | github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= 11 | github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= 12 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 13 | github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 14 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 15 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 16 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 17 | github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= 18 | github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= 19 | github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= 20 | github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= 21 | github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 22 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 23 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 24 | github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= 25 | github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= 26 | github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= 27 | github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 28 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 29 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 30 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 31 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 32 | github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= 33 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 34 | github.com/mrobinsn/go-rtorrent v1.8.0 h1:+61aDIP0asy57lRD/uZtmxfE0/gjkHnt3uddOhMKUJ8= 35 | github.com/mrobinsn/go-rtorrent v1.8.0/go.mod h1:CdVq2IwM+JU9D6TnWiQSg9lqZWu6zUfK67YXET2LqIM= 36 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= 37 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= 38 | github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= 39 | github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= 40 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 41 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 42 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 43 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 44 | github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= 45 | github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 46 | github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= 47 | github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= 48 | github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= 49 | github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= 50 | github.com/prometheus/exporter-toolkit v0.11.0 h1:yNTsuZ0aNCNFQ3aFTD2uhPOvr4iD7fdBvKPAEGkNf+g= 51 | github.com/prometheus/exporter-toolkit v0.11.0/go.mod h1:BVnENhnNecpwoTLiABx7mrPB/OLRIgN74qlQbV+FK1Q= 52 | github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= 53 | github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= 54 | github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= 55 | github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= 56 | github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 57 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 58 | github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 59 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 60 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 61 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 62 | github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= 63 | github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 64 | github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= 65 | github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= 66 | github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= 67 | golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= 68 | golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= 69 | golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= 70 | golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= 71 | golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M= 72 | golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= 73 | golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= 74 | golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= 75 | golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= 76 | golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= 77 | golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= 78 | golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= 79 | google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= 80 | google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 81 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 82 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 83 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 84 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 85 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 86 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 87 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 88 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 89 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------