Skip to content
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

Fix state conditions in check_memory and check_swap #6811

Merged
merged 1 commit into from Dec 3, 2018

Conversation

mcktr
Copy link
Member

@mcktr mcktr commented Nov 29, 2018

This fixes the state conditions in check_memory and check_swap. This
turns the if/else if/else statements in simple if statements, since they
won't work properly when both thresholds are broken.

This also implements a new function to get a given state as wstring.

Tests

check_memory

.\check_memory.exe -u mb -w 55%
MEMORY WARNING - 13.467% free| 'memory'=551.55MB;2252.5525000000002;;0;4095.55

.\check_memory.exe -u mb -w 55% -c 60%
MEMORY CRITICAL - 10.4848% free| 'memory'=429.41MB;2252.5525000000002;2457.3299999999999;0;4095.55

.\check_memory.exe -u mb -w 80%  -U
MEMORY WARNING - 89.184% used| 'memory'=3652.57MB;3276.4400000000005;;0;4095.55

.\check_memory.exe -u mb -w 80% -c 85% -U
MEMORY CRITICAL - 89.0834% used| 'memory'=3648.46MB;3276.4400000000005;3481.2175000000002;0;4095.55

check_swap

 .\check_swap.exe -u mb -w 90%
SWAP OK 90.0452% free | 'swap'=1990MB;1989;;0;2210

.\check_swap.exe -u mb -w 91%
SWAP WARNING 90.0452% free | 'swap'=1990MB;2011.1000000000001;;0;2210

.\check_swap.exe -u mb -w 91% -c 92%
SWAP CRITICAL 90.0452% free | 'swap'=1990MB;2011.1000000000001;2033.2;0;2210

.\check_swap.exe -u mb -w 8% -U
SWAP WARNING 9.68326% used | 'swap'=214MB;176.80000000000001;;0;2210

.\check_swap.exe -u mb -w 8% -c 9% -U
SWAP CRITICAL 9.68326% used | 'swap'=214MB;176.80000000000001;198.90000000000001;0;2210

fixes #6810

This fixes the state conditions in check_memory and check_swap. This
turns the if/else if/else statements in simple if statements, since they
won't work properly when both thresholds are broken.

This also implements a new function to get a given state as wstring.
@mcktr mcktr added bug Something isn't working Plugins area/windows Windows agent and plugins labels Nov 29, 2018
@dnsmichi dnsmichi added this to the 2.10.3 milestone Dec 3, 2018
@dnsmichi dnsmichi merged commit 7b39591 into master Dec 3, 2018
@dnsmichi dnsmichi deleted the bugfix/win-check-memory-state-condition branch December 3, 2018 14:06
@dnsmichi dnsmichi added the backported Fix was included in a bugfix release label Dec 5, 2018
mcktr added a commit that referenced this pull request Jan 30, 2019
This fixes a small formatting mistake introduced by #6811. To keep the
check_swap output in sync with all other plugins I fixed the formatting.
@mcktr mcktr mentioned this pull request Jan 30, 2019
dnsmichi pushed a commit that referenced this pull request Feb 11, 2019
This fixes a small formatting mistake introduced by #6811. To keep the
check_swap output in sync with all other plugins I fixed the formatting.
@dnsmichi dnsmichi added area/windows Windows agent and plugins and removed area/windows Windows agent and plugins labels May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/windows Windows agent and plugins backported Fix was included in a bugfix release bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows check_memory never gets critical
2 participants