Commit c94e68b3 authored by ale's avatar ale

Initial commit

parents
This diff is collapsed.
hsprober
===
Monitors availability of Tor Hidden Services using simple TCP probes,
and exports the results to Prometheus.
The tool periodically runs a set of probes towards one or more target
Hidden Services. It can start a new Tor circuit on every cycle if
desired (using the *--new-circuits* command-line option), in which
case it will warm-up the circuit with a test probe before starting
measurements for the target. A *probe* is simply a TCP connection
attempt: the prober won't exchange any data on the connection, a probe
is considered successful if the connection is established.
By default, it will run one probe per service every probing
interval. If you are interested in measuring connection latency, it
can be useful to increase this number with the *--probes* command-line
option, to run multiple connection probes for each target one after
another in sequence. This gives better statistical accuracy for
latency measurements at a specific point in time. Note that, if using
*--new-circuits*, the latency of the first connection is ignored (as
it presumably includes the time to fetch the HS descriptor).
## Installation
You will need a working [Go](https://golang.org/) environment. Then,
simply running:
$ go get git.autistici.org/ale/hsprober
should build and install the *hsprober* binary in `$GOPATH/bin`.
## Usage
The *hsprober* binary is a standalone daemon. Run it with *--help* to
get the full list of supported options. The most important one is
*--targets*, which should specify a list of *host:port* Hidden Service
targets to be probed, separated by commas, e.g.:
$ hsprober --targets=autinv5q6en4gpf4.onion:443
will monitor the *autinv5q6en4gpf4.onion* Hidden Service on port 443.
The tool needs access to the Tor control socket in order to set up
circuits (it will also use it to wait until Tor reports that it can
successfully access the network on startup). Consider using a
dedicated Tor instance for hsprober, so that its circuit switching
does not affect other traffic.
## Metrics
Metrics are collected and exported in Prometheus-compatible format
(under the default `/metrics` path) by a small embedded HTTP server.
The following metrics are collected, each with a *target* label:
* `tor_connection_latency` is a histogram (with *exp(sqrt(2))*
buckets) of connection latencies
* `tor_connections` is a counter of the total number of attempted
connections
* `tor_connection_errors` counts connection errors: it has an
additional label *error* which identifies the error type (either
TIMEOUT for timeouts, or ERROR for any other error).
This diff is collapsed.
Copyright (C) 2013 Blake Mizerany
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
5
26
12
5
235
13
6
28
30
3
3
3
3
5
2
33
7
2
4
7
12
14
5
8
3
10
4
5
3
6
6
209
20
3
10
14
3
4
6
8
5
11
7
3
2
3
3
212
5
222
4
10
10
5
6
3
8
3
10
254
220
2
3
5
24
5
4
222
7
3
3
223
8
15
12
14
14
3
2
2
3
13
3
11
4
4
6
5
7
13
5
3
5
2
5
3
5
2
7
15
17
14
3
6
6
3
17
5
4
7
6
4
4
8
6
8
3
9
3
6
3
4
5
3
3
660
4
6
10
3
6
3
2
5
13
2
4
4
10
4
8
4
3
7
9
9
3
10
37
3
13
4
12
3
6
10
8
5
21
2
3
8
3
2
3
3
4
12
2
4
8
8
4
3
2
20
1
6
32
2
11
6
18
3
8
11
3
212
3
4
2
6
7
12
11
3
2
16
10
6
4
6
3
2
7
3
2
2
2
2
5
6
4
3
10
3
4
6
5
3
4
4
5
6
4
3
4
4
5
7
5
5
3
2
7
2
4
12
4
5
6
2
4
4
8
4
15
13
7
16
5
3
23
5
5
7
3
2
9
8
7
5
8
11
4
10
76
4
47
4
3
2
7
4
2
3
37
10
4
2
20
5
4
4
10
10
4
3
7
23
240
7
13
5
5
3
3
2
5
4
2
8
7
19
2
23
8
7
2
5
3
8
3
8
13
5
5
5
2
3
23
4
9
8
4
3
3
5
220
2
3
4
6
14
3
53
6
2
5
18
6
3
219
6
5
2
5
3
6
5
15
4
3
17
3
2
4
7
2
3
3
4
4
3
2
664
6
3
23
5
5
16
5
8
2
4
2
24
12
3
2
3
5
8
3
5
4
3
14
3
5
8
2
3
7
9
4
2
3
6
8
4
3
4
6
5
3
3
6
3
19
4
4
6
3
6
3
5
22
5
4
4
3
8
11
4
9
7
6
13
4
4
4
6
17
9
3
3
3
4
3
221
5
11
3
4
2
12
6
3
5
7
5
7
4
9
7
14
37
19
217
16
3
5
2
2
7
19
7
6
7
4
24
5
11
4
7
7
9
13
3
4
3
6
28
4
4
5
5
2
5
6
4
4
6
10
5
4
3
2
3
3
6
5
5
4
3
2
3
7
4
6
18
16
8
16
4
5
8
6
9
13
1545
6
215
6
5
6
3
45
31
5
2
2
4
3
3
2
5
4
3
5
7
7
4
5
8
5
4
749
2
31
9
11
2
11
5
4
4
7
9
11
4
5
4
7
3
4
6
2
15
3
4
3
4
3
5
2
13
5
5
3
3
23
4
4
5
7
4
13
2
4
3
4
2
6
2
7
3
5
5
3
29
5
4
4
3
10
2
3
79
16
6
6
7
7
3
5
5
7