-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new iptables plugin #1471
Add new iptables plugin #1471
Conversation
Hello, |
if len(mv) == 0 || len(mv[0]) != 5 { | ||
continue | ||
} | ||
tags := map[string]string{"table": ipt.Table, "chain": mchain[1], "ruleid": strconv.Itoa(i + 1)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think using the line number as an identifier tag is a good idea. From the perspective of someone looking at the data in influxdb (or wherever the telegraf data is going), ruleid=4
is going to mean next to nothing. Also, if another iptables rule is inserted, then line 4 becomes line 5, and tracking the metrics over time gets screwed up. It also may not be consistent between hosts (one host's rule 4 may not be the same as another host's rule 4).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I am using comments exclusively myself to identify the rules. I considered using the rule number as a fallback for rules that do not have a comment. For the sake of clarify I suggest to ignore rules that do not have a comment. What do you think ? Any other suggestion to distinguish a rule from another ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ririsoft is it common not to have a comment? I'm fine with ignoring uncommented lines as long as it's not too huge of a burden on users, though it will need to be documented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sparrc: I have no idea if it is common or not. I can add an option to let the user ignore rules without comment or not as he prefer. If rules without comment are to be included then the ruleid will be the rule number. What do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the "rule id" should ever be used, that seems like it can only lead to confusion among users, and can also lead to bad data when rules are added/deleted. If there is no way to uniquely identify it then I think it's best to skip it.
I am preparing a new version of the plugin that will:
It will be available next week. |
sounds great, thank you @ririsoft |
Pull request is now completed. The failing CI does not sound related to this development. |
OK, thanks @ririsoft, can you:
|
The iptables plugin aims at monitoring bytes and packet counters matching a given set of iptables rules. Typically the user would set a dedicated monitoring chain into a given iptables table, and add the rules to monitor to this chain. The plugin will allow to focus on the counters for this particular table/chain.
Sorry I messed up with the CHANGELOG.md but it should be ok now: I rebased and squashed all the porcelain. Thank you very much for your kind help on this PR. |
The iptables plugin aims at monitoring bytes and packet counters matching a given set of iptables rules. Typically the user would set a dedicated monitoring chain into a given iptables table, and add the rules to monitor to this chain. The plugin will allow to focus on the counters for this particular table/chain. closes #1471
Required for all PRs:
The iptables plugin aims at monitoring bytes and packet counters
matching a given set of iptables rules.
Typically the user would set a dedicated monitoring chain into a given
iptables table, and add the rules to monitor to this chain. The plugin
will allow to focus on the counters for this particular table/chain.