Coder Social home page Coder Social logo

prometheus-tor_exporter's Introduction

prometheus-tor_exporter

Prometheus exporter for the TOR daemon.

prometheus-tor-exporter

(the JSON descriptor file for this dashboard can be found here)

Installation

Get the latest release and install using dpkg.

wget 'https://github.com/atx/prometheus-tor_exporter/releases/download/v0.3/prometheus-tor-exporter_0.3_all.deb'
dpkg -i prometheus-tor-exporter_0.3_all.deb
apt install -f

You can also build from source.

apt install git debhelper devscripts
git clone https://github.com/atx/prometheus-tor_exporter
cd prometheus-tor_exporter
debuild --no-tgz-check -uc -us
dpkg -i ../prometheus-tor-exporter_0.3_all.deb

Afterwards, you need to enable the installed systemd service.

systemctl enable --now prometheus-tor-exporter

Configuration

prometheus-tor_exporter is configured using the /etc/default/prometheus-tor-exporter

# Additional parameters for prometheus-tor-exporter
ARGS="-p 8800"

The parameters can be listed py running prometheus-tor-exporter.py -h

usage: prometheus-tor-exporter.py [-h] [-a ADDRESS] [-c CONTROL_PORT]
                                  [-p LISTEN_PORT] [-b BIND_ADDR]

optional arguments:
  -h, --help            show this help message and exit
  -a ADDRESS, --address ADDRESS
                        Tor control IP address
  -c CONTROL_PORT, --control-port CONTROL_PORT
                        Tor control port
  -p LISTEN_PORT, --listen-port LISTEN_PORT
                        Listen on this port
  -b BIND_ADDR, --bind-addr BIND_ADDR
                        Bind this address

Exported metrics

Name Description
tor_written_bytes Running total of written bytes.
tor_read_bytes Running total of read bytes.
tor_version{version="..."} Tor daemon version as a tag
tor_version_status={version_status="..."} Tor daemon version status as a tag
tor_network_liveness Network liveness (1.0 or 0.0)
tor_reachable{port="OR|DIR"} Reachability of the OR/DIR ports (1.0 or 0.0)
tor_circuit_established Indicates whether the daemon is capable of establishing circuits (1.0 or 0.0)
tor_dormant Indicates whether tor is currently active (1.0 or 0.0) (note that 1.0 means "dormant", see the specs for details)
tor_effective_rate Shows the effective rate of the relay
tor_effective_burst_rate Shows the effective burst rate of the relay
tor_fingerprint{fingerprint="..."} Node fingerprint as a tag
tor_nickname{nickname="..."} Node nickname as a tag
tor_flags{flag="Authority|BadExit|Exit|Fast|
Guard|HSDir|NoEdConsensus|Stable|
Running|Valid|V2Dir"}
Indicates whether the node has a certain flag (1.0 or 0.0)
tor_accounting_read_bytes Amount of bytes read in the current accounting period
tor_accounting_left_read_bytes Amount of read bytes left in the current accounting period
tor_accounting_read_limit_bytes Read byte limit in the current accounting period
tor_accounting_write_bytes Amount of bytes written in the current accounting period
tor_accounting_left_write_bytes Amount of write bytes left in the current accounting period
tor_accounting_write_limit_bytes Write byte limit in the current accounting period
tor_uptime Uptime of the tor process (in seconds)

A more in-depth explanation of the various variables can be found in the control port manual

prometheus-tor_exporter's People

Contributors

atx avatar delroth avatar jangrewe avatar lastpixl avatar schoentoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

prometheus-tor_exporter's Issues

Feature request: Expose per-country bridge stats

It would be helpful for bridge operators to see longer-term trends in the per-country usage patterns to assess the likelihood of having been blocked. This data is available using GETINFO status/clients-seen, but that doesn't appear to be supported in stem at present (although I have submitted an enhancement request). The CLIENTS_SEEN event is supported, but it isn't particularly scrape-time friendly.

Sadly, my Python skills are insufficient to even consider taking this on, so I won't be able to provide a PR.

cannot listen on ipv6 address

Hi,

not really expecting much, but since there were no other issues about it I'll open one for others looking at the error.

Trying to listen to an ipv6 address fails with Address family not supported, because down the stack python's wsgi/http.server defaults to AF_INET.
This isn't configurable at tor eporter's level if you with to use prometheus' web server though, but they've had multiple issues for a while ( prometheus/client_python#69 from 2015! closed without fixes, and more recently prometheus/client_python#567 with more details but not much progress, prometheus/client_python#132 with a workaround in the prometheus client code...) - they seem to advise not using their web server for real applications? :|

Their wsgi actually does quite some work so I wouldn't necessarily recommend moving away from it at this point, just raising awareness...

Wrong /etc/default settings path

I have noticed a minor error in the README, but i didn't want to fork this repo for such a minor error.

The readme says that the configuration is in /etc/default/prometheus-tor_exporter. This isn't the case, this file is ignored. One must rather edit /etc/default/prometheus-tor-exporter (notice the dash instead the underscore).

Grafana dashboard

Hi, would you mind sharing your Grafana dashboard? Maybe put it on grafana.net?
Thanks! :-)

ModuleNotFoundError: No module named 'distutils.spawn'

Just after install:

root@scw:~# systemctl start prometheus-tor-exporter
root@scw:~# systemctl status prometheus-tor-exporter
โ— prometheus-tor-exporter.service - Prometheus exporter for Tor
   Loaded: loaded (/lib/systemd/system/prometheus-tor-exporter.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-09-07 02:16:13 MSK; 4s ago
  Process: 6715 ExecStart=/usr/bin/prometheus-tor-exporter.py $ARGS (code=exited, status=1/FAILURE)
 Main PID: 6715 (code=exited, status=1/FAILURE)

Sep 07 02:16:13 scw systemd[1]: prometheus-tor-exporter.service: Failed with result 'exit-code'.
Sep 07 02:16:13 scw systemd[1]: prometheus-tor-exporter.service: Service hold-off time over, scheduling restart.
Sep 07 02:16:13 scw systemd[1]: prometheus-tor-exporter.service: Scheduled restart job, restart counter is at 5.
Sep 07 02:16:13 scw systemd[1]: Stopped Prometheus exporter for Tor.
Sep 07 02:16:13 scw systemd[1]: prometheus-tor-exporter.service: Start request repeated too quickly.
Sep 07 02:16:13 scw systemd[1]: prometheus-tor-exporter.service: Failed with result 'exit-code'.
Sep 07 02:16:13 scw systemd[1]: Failed to start Prometheus exporter for Tor.
root@scw:~# prometheus-tor-exporter.py -h
Traceback (most recent call last):
  File "/usr/bin/prometheus-tor-exporter.py", line 6, in <module>
    import stem.control
  File "/usr/lib/python3/dist-packages/stem/control.py", line 265, in <module>
    import stem.descriptor.microdescriptor
  File "/usr/lib/python3/dist-packages/stem/descriptor/__init__.py", line 55, in <module>
    import stem.util.system
  File "/usr/lib/python3/dist-packages/stem/util/system.py", line 70, in <module>
    import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'

Fixed by apt-get install python3-distutils. Add it to package dependencies?

root@scw:~# uname -a
Linux scw 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
root@scw:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

Release a new version

The exporter is currently unusable for me without the stem 1.7+ compatibility fixes in commit 2b88df4. I'm using NixOS and have a private overlay which updates the package to the current master (which works for me).

Could you release a new version with those fixes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.