Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elonzh/clash_exporter
Clash Exporter for Prometheus
https://github.com/elonzh/clash_exporter
clash prometheus prometheus-exporter
Last synced: 2 months ago
JSON representation
Clash Exporter for Prometheus
- Host: GitHub
- URL: https://github.com/elonzh/clash_exporter
- Owner: elonzh
- License: gpl-3.0
- Created: 2021-05-06T14:32:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-17T12:04:52.000Z (11 months ago)
- Last Synced: 2024-09-27T09:01:31.013Z (3 months ago)
- Topics: clash, prometheus, prometheus-exporter
- Language: Go
- Homepage:
- Size: 1.87 MB
- Stars: 8
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Clash Exporter for Prometheus
[![Docker Pulls](https://img.shields.io/docker/pulls/elonzh/clash_exporter?style=flat-square)](https://hub.docker.com/r/elonzh/clash_exporter)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/elonzh/clash_exporter?style=flat-square)](https://github.com/elonzh/clash_exporter/releases)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/elonzh/clash_exporter/ci?style=flat-square)](https://github.com/elonzh/clash_exporter/actions)
[![codecov](https://img.shields.io/codecov/c/github/elonzh/clash_exporter?style=flat-square&token=w1ngj45JWz)](https://codecov.io/gh/elonzh/clash_exporter)
[![GitHub license](https://img.shields.io/github/license/elonzh/clash_exporter?style=flat-square)](https://github.com/elonzh/clash_exporter/blob/main/LICENSE)This is a simple server that scrapes [Clash](https://github.com/Dreamacro/clash) stats and exports them via HTTP for
Prometheus consumption.There is a [`dashboard.json`](dashboard.json) file that can be imported into Grafana to provide a sample dashboard.
### Sample dashboard
![Sample dashboard](dashboard.png)
### Sample Metrics
```
# HELP clash_connection_download_total Number of bytes that downloaded by clash.
# TYPE clash_connection_download_total counter
clash_connection_download_total 111
# HELP clash_connection_upload_total Number of bytes that uploaded by clash.
# TYPE clash_connection_upload_total counter
clash_connection_upload_total 222
# HELP clash_exporter_scrapes_total Current total Clash scrapes.
# TYPE clash_exporter_scrapes_total counter
clash_exporter_scrapes_total 1
# HELP clash_proxy_delay Proxy delay.
# TYPE clash_proxy_delay gauge
clash_proxy_delay{name="provider_1_proxy_Http",provider="provider_1",type="Http"} 4
clash_proxy_delay{name="provider_1_proxy_Shadowsocks",provider="provider_1",type="Shadowsocks"} 65535
clash_proxy_delay{name="provider_1_proxy_ShadowsocksR",provider="provider_1",type="ShadowsocksR"} 1
clash_proxy_delay{name="provider_1_proxy_Snell",provider="provider_1",type="Snell"} 2
clash_proxy_delay{name="provider_1_proxy_Socks5",provider="provider_1",type="Socks5"} 3
clash_proxy_delay{name="provider_1_proxy_Trojan",provider="provider_1",type="Trojan"} 6
clash_proxy_delay{name="provider_1_proxy_Vmess",provider="provider_1",type="Vmess"} 5
# HELP clash_up Was the last scrape of Clash successful.
# TYPE clash_up gauge
clash_up 1
# HELP clash_version_info Clash version info.
# TYPE clash_version_info gauge
clash_version_info{premium="true",version="2021.04.08"} 1
```## Getting Started
To run it:
```bash
./clash_exporter [flags]
```Help on flags:
```bash
./clash_exporter --help
```For more information check the [source code documentation][gdocs].
[gdocs]: https://pkg.go.dev/github.com/elonzh/clash_exporter
### TLS and basic authentication
The Clash Exporter supports TLS and basic authentication.
To use TLS and/or basic authentication, you need to pass a configuration file
using the `--web.config.file` parameter. The format of the file is described
[in the exporter-toolkit repository](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md).## Development
### Building
```bash
make build
```### Testing
```bash
make test
```