Skip to content

check_drivesize: accept drive argument if drive+seperator string equals the argument#384

Merged
sni merged 2 commits into
mainfrom
check-drivesize-accept-drives-with-separators-at-end
Jun 10, 2026
Merged

check_drivesize: accept drive argument if drive+seperator string equals the argument#384
sni merged 2 commits into
mainfrom
check-drivesize-accept-drives-with-separators-at-end

Conversation

@inqrphl

@inqrphl inqrphl commented May 28, 2026

Copy link
Copy Markdown
Contributor

example drive=/boot and drive=/boot/ to arguments both work now, previously it was only /boot

[18:23:38.361][D][check_drivesize_other:125] Taking drive: '/boot' for path: '/boot/' since it just needs a separator: '/' at the end

checked windows as it has its own setCustomPath function. It is already accepting all forms of the drive argument, no need to make changes

  • c
  • C
  • c:
  • C:
  • c:\
  • C:\
  • c:/
  • C:/

Ahmet Oeztuerk added 2 commits May 28, 2026 18:08
…ls the argument

example drive=/boot and drive=/boot/ to arguments both work now, previously it was only /boot
…the log message about seperator

check_drivesize drive='/<drive>/' used to print perfdata labels using the '/drive/' unlike drive='/[drive]'

trim that seperator if there is a match with the drive including the seperator at the end.

now both drive='/[drive]' and drive='/[drive]/' forms use '/[drive]' in perfdata labels

check_drivesize drive='/tmp/'
OK - All 1 drive(s) are ok |'/tmp used'=464523264B;26737934336;30080176128;0;33422417920 '/tmp used %'=1.4%;80;90;0;100

additionally, improve the confusing log message. now is more verbose about what it does:

[check_drivesize_other:125] For search path: '/tmp/', taking drive: '/tmp' since adding a seperator: '/' matches the search path: '/tmp/'
@inqrphl inqrphl force-pushed the check-drivesize-accept-drives-with-separators-at-end branch from 5869e1b to edf836b Compare June 3, 2026 14:24
@inqrphl

inqrphl commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Example:

Direct match with the drive, without separator

./snclient -vvv --logfile stdout run check_drivesize drive='/tmp'
...
OK - All 1 drive(s) are ok |'/tmp used'=464523264B;26737934336;30080176128;0;33422417920 '/tmp used %'=1.4%;80;90;0;100

Not a direct match, has an extra separator at the end

./snclient -vvv --logfile stdout run check_drivesize drive='/tmp/'
....
[16:21:02.764][D][check_drivesize_other:125] For search path: '/tmp/', taking drive: '/tmp' since adding a separator: '/' matches the search path: '/tmp/' 
...
OK - All 1 drive(s) are ok |'/tmp used'=464523264B;26737934336;30080176128;0;33422417920 '/tmp used %'=1.4%;80;90;0;100

@sni sni merged commit 4b80def into main Jun 10, 2026
139 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants