{"id":13582374,"url":"https://github.com/syepes/network_exporter","last_synced_at":"2025-04-06T14:30:52.468Z","repository":{"id":40461011,"uuid":"258339162","full_name":"syepes/network_exporter","owner":"syepes","description":"ICMP / Ping \u0026 MTR \u0026 TCP Port \u0026 HTTP Get - Network Prometheus exporter","archived":false,"fork":false,"pushed_at":"2025-03-15T21:03:27.000Z","size":32626,"stargazers_count":384,"open_issues_count":15,"forks_count":65,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-15T22:18:46.730Z","etag":null,"topics":["dns","exporter","http","https","icmp","metrics","monitoring","mtr","networking","observability","ping","prometheus","prometheus-exporter","tcp","traceroute","victoriametrics"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syepes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-23T21:50:46.000Z","updated_at":"2025-03-15T21:03:24.000Z","dependencies_parsed_at":"2024-01-13T16:23:06.978Z","dependency_job_id":"fbc78ebd-5c15-4974-9590-d444d7af9a5e","html_url":"https://github.com/syepes/network_exporter","commit_stats":null,"previous_names":["syepes/ping_exporter"],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syepes%2Fnetwork_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syepes%2Fnetwork_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syepes%2Fnetwork_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syepes%2Fnetwork_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syepes","download_url":"https://codeload.github.com/syepes/network_exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247495709,"owners_count":20948100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dns","exporter","http","https","icmp","metrics","monitoring","mtr","networking","observability","ping","prometheus","prometheus-exporter","tcp","traceroute","victoriametrics"],"created_at":"2024-08-01T15:02:39.369Z","updated_at":"2025-04-06T14:30:52.462Z","avatar_url":"https://github.com/syepes.png","language":"Go","readme":"# network_exporter\n\n[![Github Action](https://github.com/syepes/network_exporter/workflows/build/badge.svg)](https://github.com/syepes/network_exporter/actions)\n[![Docker Pulls](https://img.shields.io/docker/pulls/syepes/network_exporter.svg?maxAge=604800)](https://hub.docker.com/r/syepes/network_exporter)\n\nICMP \u0026 MTR \u0026 TCP Port \u0026 HTTP Get Prometheus exporter\n\nThis exporter gathers either ICMP, MTR, TCP Port or HTTP Get stats and exports them via HTTP for Prometheus consumption.\n\n![grafana](https://raw.githubusercontent.com/syepes/network_exporter/master/dist/network_exporter.gif)\n\n## Features\n\n- IPv4 \u0026 IPv6 support\n- Configuration reloading (By interval or OS signal)\n- Dynamically Add or Remove targets without affecting the currently running tests\n- Automatic update of the target IP when the DNS resolution changes\n- Targets can be executed on all hosts or a list of specified ones `probe`\n- Extra labels when defining targets\n- Configurable logging levels and format (text or json)\n- Configurable DNS Server\n- Configurable Source IP per target `source_ip` (optional), The IP has to be configured on one of the instance's interfaces\n\n### Exported metrics\n\n- `ping_up`                                        Exporter state\n- `ping_targets`                                   Number of active targets\n- `ping_status`:                                   Ping Status\n- `ping_rtt_seconds{type=best}`:                   Best round trip time in seconds\n- `ping_rtt_seconds{type=worst}`:                  Worst round trip time in seconds\n- `ping_rtt_seconds{type=mean}`:                   Mean round trip time in seconds\n- `ping_rtt_seconds{type=sum}`:                    Sum round trip time in seconds\n- `ping_rtt_seconds{type=sd}`:                     Squared deviation in seconds\n- `ping_rtt_seconds{type=usd}`:                    Standard deviation without correction in seconds\n- `ping_rtt_seconds{type=csd}`:                    Standard deviation with correction (Bessel's) in seconds\n- `ping_rtt_seconds{type=range}`:                  Range in seconds\n- `ping_rtt_snt_count`:                            Packet sent count total\n- `ping_rtt_snt_fail_count`:                       Packet sent fail count total\n- `ping_rtt_snt_seconds`:                          Packet sent time total in seconds\n- `ping_loss_percent`:                             Packet loss in percent\n\n---\n\n- `mtr_up`                                         Exporter state\n- `mtr_targets`                                    Number of active targets\n- `mtr_hops`                                       Number of route hops\n- `mtr_rtt_seconds{type=last}`:                    Last round trip time in seconds\n- `mtr_rtt_seconds{type=best}`:                    Best round trip time in seconds\n- `mtr_rtt_seconds{type=worst}`:                   Worst round trip time in seconds\n- `mtr_rtt_seconds{type=mean}`:                    Mean round trip time in seconds\n- `mtr_rtt_seconds{type=sum}`:                     Sum round trip time in seconds\n- `mtr_rtt_seconds{type=sd}`:                      Squared deviation in seconds\n- `mtr_rtt_seconds{type=usd}`:                     Standard deviation without correction in seconds\n- `mtr_rtt_seconds{type=csd}`:                     Standard deviation with correction (Bessel's) in seconds\n- `mtr_rtt_seconds{type=range}`:                   Range in seconds\n- `mtr_rtt_seconds{type=loss}`:                    Packet loss in percent\n- `mtr_rtt_snt_count`:                             Packet sent count total\n- `mtr_rtt_snt_fail_count`:                        Packet sent fail count total\n- `mtr_rtt_snt_seconds`:                           Packet sent time total in seconds\n\n---\n\n- `tcp_up`                                         Exporter state\n- `tcp_targets`                                    Number of active targets\n- `tcp_connection_status`                          Connection Status\n- `tcp_connection_seconds`                         Connection time in seconds\n\n---\n\n- `http_get_up`                                    Exporter state\n- `http_get_targets`                               Number of active targets\n- `http_get_status`                                HTTP Status Code and Connection Status\n- `http_get_content_bytes`                         HTTP Get Content Size in bytes\n- `http_get_seconds{type=DNSLookup}`:              DNSLookup connection drill down time in seconds\n- `http_get_seconds{type=TCPConnection}`:          TCPConnection connection drill down time in seconds\n- `http_get_seconds{type=TLSHandshake}`:           TLSHandshake connection drill down time in seconds\n- `http_get_seconds{type=TLSEarliestCertExpiry}`:  TLSEarliestCertExpiry cert expiration time in epoch\n- `http_get_seconds{type=TLSLastChainExpiry}`:     TLSLastChainExpiry cert expiration time in epoch\n- `http_get_seconds{type=ServerProcessing}`:       ServerProcessing connection drill down time in seconds\n- `http_get_seconds{type=ContentTransfer}`:        ContentTransfer connection drill down time in seconds\n- `http_get_seconds{type=Total}`:                  Total connection time in seconds\n\nEach metric contains the below labels and additionally the ones added in the configuration file.\n\n- `name` (ALL: The target name)\n- `target` (ALL: The target defined Hostname or IP)\n- `target_ip` (ALL: The target resolved IP Address)\n- `source_ip` (ALL: The source IP Address)\n- `port` (TCP: The target TCP Port)\n- `ttl` (MTR: Time to live)\n- `path` (MTR: Traceroute IP)\n\n## Building and running the software\n\n### Prerequisites for Linux\n\nThe process must run with the necesary linux or docker previlages to be able to perform the necesary tests\n\n```bash\napt update\napt install docker\napt install docker.io\ntouch network_exporter.yml\n```\n\n### Local Build\n\n```bash\n$ goreleaser release --skip=publish --snapshot --clean\n$ ls -l artifacts/network_exporter_*6?\n# If you want to run it with a non root user\n$ sudo setcap 'cap_net_raw,cap_net_admin+eip' artifacts/network_exporter_linux_amd64/network_exporter\n```\n\n### Building with Docker\n\nTo run the network_exporter as a Docker container by builing your own image or using \u003chttps://hub.docker.com/r/syepes/network_exporter\u003e\n\n```bash\ndocker build -t syepes/network_exporter .\n# Default mode\ndocker run --privileged --cap-add NET_ADMIN --cap-add NET_RAW -p 9427:9427 -v $PWD/network_exporter.yml:/app/cfg/network_exporter.yml:ro --name network_exporter syepes/network_exporter\n# Debug level\ndocker run --privileged --cap-add NET_ADMIN --cap-add NET_RAW -p 9427:9427 -v $PWD/network_exporter.yml:/app/cfg/network_exporter.yml:ro --name network_exporter syepes/network_exporter /app/network_exporter --log.level=debug\n```\n\n## Configuration\n\nTo see all available configuration flags:\n\n```bash\n./network_exporter -h\n```\n\nThe configuration (YAML) is mainly separated into three sections Main, Protocols and Targets.\nThe file `network_exporter.yml` can be either edited before building the docker container or changed it runtime.\n\n```yaml\n# Main Config\nconf:\n  refresh: 15m\n  nameserver: 192.168.0.1:53 # Optional\n  nameserver_timeout: 250ms # Optional\n\n# Specific Protocol settings\nicmp:\n  interval: 3s\n  timeout: 1s\n  count: 6\n\nmtr:\n  interval: 3s\n  timeout: 500ms\n  max-hops: 30\n  count: 6\n\ntcp:\n  interval: 3s\n  timeout: 1s\n\nhttp_get:\n  interval: 15m\n  timeout: 5s\n\n# Target list and settings\ntargets:\n  - name: internal\n    host: 192.168.0.1\n    type: ICMP\n    probe:\n      - hostname1\n      - hostname2\n    labels:\n      dc: home\n      rack: a1\n  - name: google-dns1\n    host: 8.8.8.8\n    type: ICMP\n  - name: google-dns2\n    host: 8.8.4.4\n    type: MTR\n  - name: cloudflare-dns\n    host: 1.1.1.1\n    type: ICMP+MTR\n  - name: cloudflare-dns-https\n    host: 1.1.1.1:443\n    source_ip: 192.168.1.1\n    type: TCP\n  - name: download-file-64M\n    host: http://test-debit.free.fr/65536.rnd\n    type: HTTPGet\n  - name: download-file-64M-proxy\n    host: http://test-debit.free.fr/65536.rnd\n    type: HTTPGet\n    proxy: http://localhost:3128\n```\n\nSource IP\n\n`source_ip` parameter will try to assign IP for request sent to specific target. This IP has to be configure on one of the interfaces of the OS.\nSupported for all types of the checks\n\n```yaml\n  - name: server3.example.com:9427\n    host: server3.example.com:9427\n    type: TCP\n    source_ip: 192.168.1.1\n```\n\n**Note:** Domain names are resolved (regularly) to their corresponding A and AAAA records (IPv4 and IPv6).\nBy default if not configured, `network_exporter` uses the system resolver to translate domain names to IP addresses.\nYou can also override the DNS resolver address by specifying the `conf.nameserver` configuration setting.\n\n**[SRV records](https://en.wikipedia.org/wiki/SRV_record):**\nIf the host field of a target contains a SRV record with the format `_\u003cservice\u003e._\u003cprotocol\u003e.\u003cdomain\u003e` it will be resolved, all it's A records will be added (dynamically) as separate targets with name and host of the this A record.\nEvery field of the parent target with a SRV record will be inherited by sub targets except `name` and `host`\n\nSRV record supported for ICMP/MTR/TCP target types.\nTCP SRV record specifcs:\n\n- Target type should be `TCP` and `_protocol` part in the SRV record should be `_tcp` as well\n- Port will be taken from the 3rd number, just before the hostname\n\nTCP SRV example\n\n```console\n_connectivity-check._tcp.example.com. 86400 IN SRV 10 5 80 server.example.com.\n_connectivity-check._tcp.example.com. 86400 IN SRV 10 5 443 server2.example.com.\n_connectivity-check._tcp.example.com. 86400 IN SRV 10 5 9247 server3.example.com.\n```\n\nICMP SRV example\n\n```console\n_connectivity-check._icmp.example.com. 86400 IN SRV 10 5 8 server.example.com.\n_connectivity-check._icmp.example.com. 86400 IN SRV 10 5 8 server2.example.com.\n_connectivity-check._icmp.example.com. 86400 IN SRV 10 5 8 server3.example.com.\n```\n\nConfiguration reference\n\n```yaml\n  - name: test-srv-record\n    host: _connectivity-check._icmp.example.com\n    type: ICMP\n  - name: test-srv-record\n    host: _connectivity-check._tcp_.example.com\n    type: TCP\n```\n\nWill be resolved to 3 separate targets:\n\n```yaml\n  - name: server.example.com\n    host: server.example.com\n    type: ICMP\n  - name: server2.example.com\n    host: server2.example.com\n    type: ICMP\n  - name: server3.example.com\n    host: server3.example.com\n    type: ICMP\n  - name: server.example.com:80\n    host: server.example.com:80\n    type: TCP\n  - name: server2.example.com:443\n    host: server2.example.com:443\n    type: TCP\n  - name: server3.example.com:9427\n    host: server3.example.com:9427\n    type: TCP\n```\n\n## Deployment\n\nThis deployment example will permit you to have as many Ping Stations as you need (LAN or WIFI) devices but at the same time decoupling the data collection from the storage and visualization.\nThis [docker compose](https://github.com/syepes/network_exporter/blob/master/dist/deploy/docker-compose.yml) will deploy and configure all the components plus setup Grafana with the Datasource and [Dashboard](https://github.com/syepes/network_exporter/blob/master/dist/deploy/cfg/provisioning/dashboards/network_exporter.json)\n\n[Deployment example](https://github.com/syepes/network_exporter/blob/master/dist/deploy/)\n\n![Deployment architecture](https://raw.githubusercontent.com/syepes/network_exporter/master/dist/deployment.jpg)\n\n## Contribute\n\nIf you have any idea for an improvement or find a bug do not hesitate in opening an issue, just simply fork and create a pull-request to help improve the exporter.\n\n## License\n\nAll content is distributed under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0)\nCopyright \u0026copy; 2020-2024, [Sebastian YEPES](mailto:syepes@gmail.com)\n","funding_links":[],"categories":["Go","monitoring"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyepes%2Fnetwork_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyepes%2Fnetwork_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyepes%2Fnetwork_exporter/lists"}