influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.93k stars 5.6k forks source link

ipset: Monitor set size #12078

Open fxedel opened 2 years ago

fxedel commented 2 years ago

Use Case

I don't want to monitor each entry in my ipset, but I want to monitor the whole ipset size, because I automatically add new items to it.

Expected behavior

The current metric should be optional (e.g. gather_entries like in mysql). Furthermore, there should be an option to gather the whole set size using the ipset list command.

Actual behavior

Only monitoring the entries via ipset save is possible.

Additional info

Example commands:

$ sudo ipset save
create myset hash:net family inet hashsize 1024 maxelem 65536 counters comment
add myset 10.69.152.1 packets 0 bytes 0

→ existing use case, results in metric like ipset,rule=10.69.152.1,set=myset bytes_total=0i,packets_total=0i 1507615028000000000

$ sudo ipset list
Name: myset
Type: hash:net
Revision: 6
Header: family inet hashsize 1024 maxelem 65536 counters comment
Size in memory: 552
References: 0
Number of entries: 1
Members:
10.69.152.1 packets 0 bytes 0

→ new use case, results in metric like ipset_size,set=myset entries=1i,memory_size=552i 1507615028000000000

reimda commented 2 years ago

Hi Felix, it makes sense to change the ipset input to gather sizes of sets like you described. Would you like to put together a PR to make the change? Thanks!