-
Notifications
You must be signed in to change notification settings - Fork 97
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
[check-disk] skip checks if there are no inodes #265
Conversation
check-disk/lib/check-disk.go
Outdated
current = status | ||
} | ||
|
||
if !chkInode && (v > freePct || v > inodesFreePct) { | ||
if !chkInode && (v > freePct || (disk.InodesTotal != 0 && v > inodesFreePct)) { |
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 comparing inodesFreePct
here is correct behavior, since the help says Exit with WARNING status if less than N units or N% of disk are free
, not N% of inodes.
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.
Right. Maybe we can omit this inodesFreePct
checking from this if
.
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.
Or we should split checkStatus into two (one for usage, one for inode)
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 will propose changing this in another PR. Thanks!
check-disk/lib/check-disk.go
Outdated
current = status | ||
} | ||
|
||
if !chkInode && (v > freePct || v > inodesFreePct) { | ||
if !chkInode && (v > freePct || (disk.InodesTotal != 0 && v > inodesFreePct)) { |
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.
Right. Maybe we can omit this inodesFreePct
checking from this if
.
check-disk/lib/check-disk.go
Outdated
current = status | ||
} | ||
|
||
if !chkInode && (v > freePct || v > inodesFreePct) { | ||
if !chkInode && (v > freePct || (disk.InodesTotal != 0 && v > inodesFreePct)) { |
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.
Or we should split checkStatus into two (one for usage, one for inode)
This change itself looks good. |
check-disk/lib/check-disk.go
Outdated
|
||
if chkInode && v > inodesFreePct { | ||
if chkInode && (disk.InodesTotal != 0 && v > inodesFreePct) { |
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.
It is not related to this issues, but I confused what is v...
How about using percentThreshold
or pctThreshold
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.
renamed in bea07d5 👍
|
||
if chkInode && v > inodesFreePct { | ||
if chkInode && (disk.InodesTotal != 0 && v > inodesFreePct) { | ||
current = status |
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 did not understand what disk.InodesTotal! = 0 means for just a moment. So How about writing comment, for example If InodesTotal == 0, the system don't use inode
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 added a note 94e20dc 👍
On Windows, there are no "inodes" and checks on them should be skipped.
However, the current version always raises wranings / errors if
-w N%
/-c N%
is specified.This PR fixes it by skipping checks if total inodes is zero (
gopsutil/disk
returnsInodesTotal = 0
on Windows https://github.com/shirou/gopsutil/blob/master/disk/disk_windows.go).The change may affect other (non-Windows) environments, but I think it is OK because talking about the "percentage" of 0/0 is nonsense...