-
Notifications
You must be signed in to change notification settings - Fork 638
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
Support "nf_conntrack", check for 90% full #369
Conversation
Welcome @arekkusu! |
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Hi @arekkusu. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
CLA should be ok now (reply should trigger re-check) |
/ok-to-test |
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.
Thanks for the PR @arekkusu !
Overall it looks good to me :) However there are a few small stylistic suggestions, following this Bash style guide.
If you can help addressing them, that'd be great, and I'll happily approve the PR :) Thank you!
config/plugin/network_problem.sh
Outdated
|
||
conntrack_max=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max) | ||
conntrack_count=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_count) | ||
if [ -f $NF_CONNTRACK_COUNT ] && [ -f $NF_CONNTRACK_MAX ]; then |
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.
nit: Could you help change the [ -f xxx ]
s here and below into [[ -f xxx ]]
? Thanks! :)
This is because [[ ]]
is more prefered than [ ]
. If you could help use this chance to help improve the code quality, I'm sure everyone would appreciate it :)
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.
Updated to use [[ ]]
, I also switched to 2 space indent to follow Google Shell Style Guide.
I think same should be done for check_ntp.sh
.
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.
Thanks! Yes I agree, we should update check_ntp.sh
as well as a small improvement.
config/plugin/network_problem.sh
Outdated
exit $UNKNOWN | ||
fi | ||
|
||
conntrack_count=$(< $CONNTRACK_COUNT) || exit $UNKNOWN |
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.
nit: We have conntrack_count
and CONNTRACK_COUNT
, one for the value and another one for the path. do you mind appending _PATH
to the path constants (CONNTRACK_*
, NF_CONNTRACK_*
, IP_CONNTRACK_*
)? Thanks so much!
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.
Not a nit, you're right about the naming.
I added PATH
and shortened CONNTRACK
to CT
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.
Sounds good to me! Thanks! :)
config/plugin/network_problem.sh
Outdated
if (( conntrack_count >= conntrack_max )); then | ||
echo "Conntrack table full" | ||
if (( conntrack_count > conntrack_max /10 * 9)); then | ||
echo "Conntrack table is more than 90% full" |
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.
Maybe
echo "Conntrack table is more than 90% used: ${conntrack_count} out of ${conntrack_max}"
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.
Update to included this additional information for both OK
and NONOK
exit.
In addition I choose to output to STDERR
for NONOK
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.
Sorry for the trouble. Could you help change the print back to STDOUT
? :P
This is a small detail in custom-plugin-monitor
's interface, where only STDOUT
is collected, and STDERR
is ignored. See the design and the implementation for this detail.
Really appreciate your review and input. Have a look at the update and let me know what you think. |
Hi @arekkusu , thanks a lot for making the changes! Just one more small item for the |
And by the way, you can (optionally) squash all the 2-3 commits into one. We typically do this to have a simpler/cleaner commit history. But I understand that a lot of people choose to not do that to keep a history for the code review. |
- Script was checking for "ip_conntrack_..." which was replaced by "nf_conntrack_..." on newer system. Now support both. - Return failure ("not ok") when table is more than 90% full. - Not sure what value is best here but I think that is better than when the table is full. Otherwise we might end up with a value close to the max or bouncing around. - Replaced cat by "$(< file )" to avoid calling external command - Follow Google "Shell Style Guide": 2 space indent, use preferred "[[ test ]]", add "readonly" - Include current connection usage in output message
Ok regarding outputting to BTW do see any changes needed to network-problem-monitor.json node-problem-detector/config/network-problem-monitor.json Lines 1 to 20 in 599ca53
|
I think the (draft?) design doc doesn't clearly indicate the UNKNOWN return status. Implementation considers anything else than 0 or 1 as unknown node-problem-detector/pkg/custompluginmonitor/plugin/plugin.go Lines 153 to 161 in 8704ec0
This test does refer to exit code 2 as unkown
Let me know if you think it's better to use 3 as exit code for UNKNOWN ... |
I agree with you, I think
I think keeping it as is (which is /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: arekkusu, xueweiz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Script was checking for "ip_conntrack_..." which was replaced by "nf_conntrack_..." on newer system. Now support both.
Return failure ("not ok") when table is more than 90% full. Note sure what value is best here but I think that is better than when the table is full. Otherwise we might end up with a value close to the max or bouncing around.
Replaced cat by "$(< file )" to avoid calling external command