Skip to main content

Iptables exporter

A Prometheus exporter that collects traffic data from iptables rules.

Installation

pip install iptables-exporter

Usage

Test run:

iptables-exporter --dump-data

Run iptables-exporter:

iptables-exporter --port 9119

Point your browser to http://localhost:9119/metrics

Docker

docker run --net=host --cap-add=NET_ADMIN madron/iptables-exporter

Configure iptables

Optionally you can monitor specific rules by adding a comment starting with iptables-exporter:

iptables -A INPUT --dport ssh -j ACCEPT -m comment --comment "iptables-exporter ssh traffic"

collects packets and bytes counter:

iptables_packets{ip_version="4",table="filter",chain="input",rule="ssh traffic"} 347.0
iptables_bytes{ip_version="4",table="filter",chain="input",rule="ssh traffic"} 44512.0

More rules with same name:

iptables -A INPUT -s 10.0.0.0/8     --dport ssh -j ACCEPT -m comment --comment "iptables-exporter ssh traffic"
iptables -A INPUT -s 172.16.0.0/12  --dport ssh -j ACCEPT -m comment --comment "iptables-exporter ssh traffic"
iptables -A INPUT -s 192.168.0.0/16 --dport ssh -j ACCEPT -m comment --comment "iptables-exporter ssh traffic"

exports total packets and bytes for the 3 rules as they have same ip_version, table, chain and name.

Release files for iptables-exporter 0.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iptables-exporter 0.9.3
File Size Uploaded
iptables-exporter-0.9.3.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iptables-exporter 0.9.3
File Interpreter ABI Platform
iptables_exporter-0.9.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 7.6 kB

Release files / iptables-exporter-0.9.3.tar.gz

Download URL iptables-exporter-0.9.3.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dfa263c0c7a554331f8de7f87b8c657bf2e6f919141503d8f43b9c1690a8a74b
BLAKE2b-256 checksum
How to use checksums
3482cfd5d4a145accf7453277dc0e64d38720a808443a86151b823357a56cccf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10

Release files / iptables_exporter-0.9.3-py2.py3-none-any.whl

Download URL iptables_exporter-0.9.3-py2.py3-none-any.whl
Size 4.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
23c83bb8eee45ed07b0d740a71c84d3e0517066f9ba33048dc736b8a6da6f05e
BLAKE2b-256 checksum
How to use checksums
caebd0ac436519e9a7b27d1a2da63f44428f9b0063c43c299f14f30a60df4127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10

Release history Release notifications | RSS feed

This release

0.9.3 This release

2 release files

0.9.2

1 release file

0.9.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page