All Projects → syepes → network_exporter

syepes / network_exporter

Licence: Apache-2.0 license
ICMP & MTR & TCP Port & HTTP Get - Network Prometheus exporter

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to network exporter

Pytcp
PyTCP is an attempt to create fully functional TCP/IP stack in Python. It supports TCP stream based transport with reliable packet delivery based on sliding window mechanism and basic congestion control. It also supports IPv6/ICMPv6 protocols with SLAAC address configuration. It operates as user space program attached to Linux TAP interface. As of today stack is able to send and receive traffic over Internet using IPv4 and IPv6 default gateways for routing. Since goal of this project is purely educational (at least at this point) the clarity of code is preferred over its efficiency. For the same reason security features are not being implemented just yet unless they are integral part of TCP/IP suite protocols specification.
Stars: ✭ 65 (-59.88%)
Mutual labels:  tcp, icmp
Sish
HTTP(S)/WS(S)/TCP Tunnels to localhost using only SSH.
Stars: ✭ 2,087 (+1188.27%)
Mutual labels:  tcp, https
Free Web Books
Learn books from TCP/IP | HTTP(s) | HTML、JS、JQuery | PHP | Web
Stars: ✭ 69 (-57.41%)
Mutual labels:  tcp, https
Udp2raw Tunnel
A Tunnel which Turns UDP Traffic into Encrypted UDP/FakeTCP/ICMP Traffic by using Raw Socket,helps you Bypass UDP FireWalls(or Unstable UDP Environment)
Stars: ✭ 4,839 (+2887.04%)
Mutual labels:  tcp, icmp
Httpcanary
A powerful capture and injection tool for the Android platform
Stars: ✭ 2,188 (+1250.62%)
Mutual labels:  tcp, https
Blinksocks
A framework for building composable proxy protocol stack.
Stars: ✭ 587 (+262.35%)
Mutual labels:  tcp, https
Pingtunnel
ping tunnel is a tool that advertises tcp/udp/socks5 traffic as icmp traffic for forwarding.
Stars: ✭ 1,904 (+1075.31%)
Mutual labels:  tcp, icmp
LightTunnel
LightTunnel-内网穿透映射工具,支持TCP、HTTP、HTTPS穿透映射,支持Windows、Linux、Mac、Android系统
Stars: ✭ 40 (-75.31%)
Mutual labels:  tcp, https
Actionhero
Actionhero is a realtime multi-transport nodejs API Server with integrated cluster capabilities and delayed tasks
Stars: ✭ 2,280 (+1307.41%)
Mutual labels:  tcp, https
Fq Book
📖《这本书能让你连接互联网》详细阐述代理、隧道、VPN运作过程,并对GFW策略如:地址端口封锁、服务器缓存投毒、数字验证攻击、SSL连接阻断做相关的原理说明
Stars: ✭ 2,393 (+1377.16%)
Mutual labels:  tcp, https
Hp Socket
High Performance TCP/UDP/HTTP Communication Component
Stars: ✭ 4,420 (+2628.4%)
Mutual labels:  tcp, https
Frpc Android
Android,安卓版frpc,一个快速反向代理,可帮助您将NAT或防火墙后面的本地服务器暴露给Internet。
Stars: ✭ 205 (+26.54%)
Mutual labels:  tcp, https
Nps
一款轻量级、高性能、功能强大的内网穿透代理服务器。支持tcp、udp、socks5、http等几乎所有流量转发,可用来访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析、内网socks5代理等等……,并带有功能强大的web管理端。a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal.
Stars: ✭ 19,537 (+11959.88%)
Mutual labels:  tcp, https
Beetlex
high performance dotnet core socket tcp communication components, support TLS, HTTP, HTTPS, WebSocket, RPC, Redis protocols, custom protocols and 1M connections problem solution
Stars: ✭ 802 (+395.06%)
Mutual labels:  tcp, https
Mirage Tcpip
TCP/IP networking stack in pure OCaml, using the Mirage platform libraries. Includes IPv4/6, ICMP, and UDP/TCP support.
Stars: ✭ 277 (+70.99%)
Mutual labels:  tcp, icmp
Tcpbin
Very crude and poorly written HTTP(s) and SMTP bin
Stars: ✭ 85 (-47.53%)
Mutual labels:  tcp, https
ddos
Simple dos attack utility
Stars: ✭ 36 (-77.78%)
Mutual labels:  tcp, icmp
node-jsonrpc2
JSON-RPC 2.0 server and client library, with HTTP (with Websocket support) and TCP endpoints
Stars: ✭ 103 (-36.42%)
Mutual labels:  tcp, https
Co
Art of C++. Flag, logging, unit-test, json, go-style coroutine and more.
Stars: ✭ 2,264 (+1297.53%)
Mutual labels:  tcp, https
Asio2
Header only c++ network library, based on asio,support tcp,udp,http,websocket,rpc,ssl,icmp,serial_port.
Stars: ✭ 202 (+24.69%)
Mutual labels:  tcp, icmp

network_exporter

Github Action Docker Pulls

ICMP & MTR & TCP Port & HTTP Get Prometheus exporter

This exporter gathers either ICMP, MTR, TCP Port or HTTP Get stats and exports them via HTTP for Prometheus consumption.

grafana

Features

  • IPv4 & IPv6 support
  • Configuration reloading (By interval or OS signal)
  • Dynamically Add or Remove targets without affecting the currently running tests
  • Automatic update of the target IP when the DNS resolution changes
  • Targets can be executed on all hosts or a list of specified ones probe
  • Extra labels when defining targets
  • Configurable logging levels and format (text or json)
  • Configurable DNS Server
  • Configurable Source IP per target source_ip (optional), The IP has to be configured on one of the instance's interfaces

Exported metrics

  • ping_up Exporter state
  • ping_targets Number of active targets
  • ping_status: Ping Status
  • ping_rtt_seconds{type=best}: Best round trip time in seconds
  • ping_rtt_seconds{type=worst}: Worst round trip time in seconds
  • ping_rtt_seconds{type=mean}: Mean round trip time in seconds
  • ping_rtt_seconds{type=sum}: Sum round trip time in seconds
  • ping_rtt_seconds{type=sd}: Squared deviation in seconds
  • ping_rtt_seconds{type=usd}: Standard deviation without correction in seconds
  • ping_rtt_seconds{type=csd}: Standard deviation with correction (Bessel's) in seconds
  • ping_rtt_seconds{type=range}: Range in seconds
  • ping_loss_percent: Packet loss in percent

  • mtr_up Exporter state
  • mtr_targets Number of active targets
  • mtr_hops Number of route hops
  • mtr_rtt_seconds{type=last}: Last round trip time in seconds
  • mtr_rtt_seconds{type=best}: Best round trip time in seconds
  • mtr_rtt_seconds{type=worst}: Worst round trip time in seconds
  • mtr_rtt_seconds{type=mean}: Mean round trip time in seconds
  • mtr_rtt_seconds{type=sum}: Sum round trip time in seconds
  • mtr_rtt_seconds{type=sd}: Squared deviation in seconds
  • mtr_rtt_seconds{type=usd}: Standard deviation without correction in seconds
  • mtr_rtt_seconds{type=csd}: Standard deviation with correction (Bessel's) in seconds
  • mtr_rtt_seconds{type=range}: Range in seconds
  • mtr_rtt_seconds{type=loss}: Packet loss in percent

  • tcp_up Exporter state
  • tcp_targets Number of active targets
  • tcp_connection_status Connection Status
  • tcp_connection_seconds Connection time in seconds

  • http_get_up Exporter state
  • http_get_targets Number of active targets
  • http_get_status HTTP Status Code and Connection Status
  • http_get_content_bytes HTTP Get Content Size in bytes
  • http_get_seconds{type=DNSLookup}: DNSLookup connection drill down time in seconds
  • http_get_seconds{type=TCPConnection}: TCPConnection connection drill down time in seconds
  • http_get_seconds{type=TLSHandshake}: TLSHandshake connection drill down time in seconds
  • http_get_seconds{type=TLSEarliestCertExpiry}: TLSEarliestCertExpiry cert expiration time in epoch
  • http_get_seconds{type=TLSLastChainExpiry}: TLSLastChainExpiry cert expiration time in epoch
  • http_get_seconds{type=ServerProcessing}: ServerProcessing connection drill down time in seconds
  • http_get_seconds{type=ContentTransfer}: ContentTransfer connection drill down time in seconds
  • http_get_seconds{type=Total}: Total connection time in seconds

Each metric contains the below labels and additionally the ones added in the configuration file.

  • name (ALL: The target name)
  • target (ALL: The target defined Hostname or IP)
  • target_ip (ALL: The target resolved IP Address)
  • source_ip (ALL: The source IP Address)
  • port (TCP: The target TCP Port)
  • ttl (MTR: Time to live)
  • path (MTR: Traceroute IP)

Building and running the software

Prerequisites for Linux

apt update
apt install docker
apt install docker.io
touch network_exporter.yml

Local Build

$ goreleaser release --skip-publish --snapshot --rm-dist
$ ls -l artifacts/network_exporter_*6?
# If you want to run it with a non root user
$ sudo setcap cap_net_raw=+ep artifacts/network_exporter_linux_amd64/network_exporter

Building with Docker

To run the network_exporter as a Docker container by builing your own image or using https://hub.docker.com/r/syepes/network_exporter

docker build -t syepes/network_exporter .
# Default mode
docker run -p 9427:9427 -v $PWD/network_exporter.yml:/app/cfg/network_exporter.yml:ro --name network_exporter syepes/network_exporter
# Debug level
docker run -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

Configuration

To see all available configuration flags:

./network_exporter -h

The configuration (YAML) is mainly separated into three sections Main, Protocols and Targets. The file network_exporter.yml can be either edited before building the docker container or changed it runtime.

# Main Config
conf:
  refresh: 15m
  nameserver: 192.168.0.1:53

# Specific Protocol settings
icmp:
  interval: 3s
  timeout: 1s
  count: 6

mtr:
  interval: 3s
  timeout: 500ms
  max-hops: 30
  count: 6

tcp:
  interval: 3s
  timeout: 1s

http_get:
  interval: 15m
  timeout: 5s

# Target list and settings
targets:
  - name: internal
    host: 192.168.0.1
    type: ICMP
    probe:
      - hostname1
      - hostname2
    labels:
      dc: home
      rack: a1
  - name: google-dns1
    host: 8.8.8.8
    type: ICMP
  - name: google-dns2
    host: 8.8.4.4
    type: MTR
  - name: cloudflare-dns
    host: 1.1.1.1
    type: ICMP+MTR
  - name: cloudflare-dns-https
    host: 1.1.1.1:443
    source_ip: 192.168.1.1
    type: TCP
  - name: download-file-64M
    host: http://test-debit.free.fr/65536.rnd
    type: HTTPGet
  - name: download-file-64M-proxy
    host: http://test-debit.free.fr/65536.rnd
    type: HTTPGet
    proxy: http://localhost:3128

Note: Domain names are resolved (regularly) to their corresponding A and AAAA records (IPv4 and IPv6). By default if not configured, network_exporter uses the system resolver to translate domain names to IP addresses. You can also override the DNS resolver address by specifying the conf.nameserver configuration setting.

SRV records: If the host field of a target contains a SRV record with the format _<service>._<protocol>.<domain> 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. Every field of the parent target with a SRV record will be inherited by sub targets except name and host

SRV record supported for ICMP/MTR/TCP target types. TCP SRV record specifcs:

  • Target type should be TCP and _protocol part in the SRV record should be _tcp as well
  • Port will be taken from the 3rd number, just before the hostname

TCP SRV example

_connectivity-check._tcp.example.com. 86400 IN SRV 10 5 80 server.example.com.
_connectivity-check._tcp.example.com. 86400 IN SRV 10 5 443 server2.example.com.
_connectivity-check._tcp.example.com. 86400 IN SRV 10 5 9247 server3.example.com.

ICMP SRV example

_connectivity-check._icmp.example.com. 86400 IN SRV 10 5 8 server.example.com.
_connectivity-check._icmp.example.com. 86400 IN SRV 10 5 8 server2.example.com.
_connectivity-check._icmp.example.com. 86400 IN SRV 10 5 8 server3.example.com.

Configuration reference

  - name: test-srv-record
    host: _connectivity-check._icmp.example.com
    type: ICMP
  - name: test-srv-record
    host: _connectivity-check._tcp_.example.com
    type: TCP

Will be resolved to 3 separate targets:

  - name: server.example.com
    host: server.example.com
    type: ICMP
  - name: server2.example.com
    host: server2.example.com
    type: ICMP
  - name: server3.example.com
    host: server3.example.com
    type: ICMP
  - name: server.example.com:80
    host: server.example.com:80
    type: TCP
  - name: server2.example.com:443
    host: server2.example.com:443
    type: TCP
  - name: server3.example.com:9427
    host: server3.example.com:9427
    type: TCP

Source IP

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. Supported for all types of the checks

  - name: server3.example.com:9427
    host: server3.example.com:9427
    type: TCP
    source_ip: 192.168.1.1

Deployment

This 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. This docker compose will deploy and configure all the components plus setup Grafana with the Datasource and Dashboard

Deployment example

Deployment architecture

Contribute

If 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.

License

All content is distributed under the Apache 2.0 License Copyright © 2020-2022, Sebastian YEPES

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].