ngraph is a metrics collector tool designed to work in conjunction with node_exporter. Its primary goal is to provide information about existing network connections on a machine, which can then be utilized to build a graph of network interactions within your infrastructure.
-
Clone the repository:
git clone https://github.com/alebsys/ngraph.git
-
Build the
ngraphbinary:cd ngraph go build -
Run the
ngraphbinary:./ngraph
ngraph accepts command-line arguments to customize its behavior. Below are the available options:
--interval: Interval for generating metrics (default: 15 seconds).--output: Path for metric files (default: "/tmp/node_exporter/textfile").--all: Scrape connections from all network namespaces (default: false).
Example:
./ngraph --interval=30 --output=/path/to/metrics --allngraph generates Prometheus-compatible metrics in a textfile format. The resulting metrics are stored in the specified output directory with the filename ngraph.prom.
The primary metrics provided is:
network_connections_input_total: Total input number of unique network connections per hosts;network_connections_output_total: Total output number of unique network connections per hosts.
Example:
network_connections_input_total{dest_ip="10.12.57.104", src_ip="10.12.57.27", peer_hostname="example.com"} 3
network_connections_output_total{src_ip="10.12.57.104", dest_ip="10.24.127.27", peer_hostname="example.com"} 2Example of possible visualization of metrics in grafana:
Feel free to contribute to ngraph by opening issues, proposing new features, or submitting pull requests. Your feedback and contributions are highly valued.
This project is licensed under the MIT License.
ngraph makes use of the procfs library to interact with the /proc filesystem. Special thanks to the authors and contributors of procfs.
