check_disk: compare inode thresholds against the correct value (#2223)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Spellcheck / codespell (push) Has been cancelled
Tests / Running unit and integrationt tests (push) Has been cancelled
Tests / Running rpm build test on almalinux:9 (push) Has been cancelled
Tests / Running rpm build test on fedora:latest (push) Has been cancelled
Tests / Running rpm build test on rockylinux:8 (push) Has been cancelled

* check_disk: compare inode thresholds against the correct value

* check_disk: Detect free inode number correctly in tests

---------

Co-authored-by: Lorenz Kästle <lorenz.kaestle@netways.de>
This commit is contained in:
Lorenz Kästle 2026-01-16 12:16:45 +01:00 committed by GitHub
parent b58e244cc7
commit f5f60f5717
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

View file

@ -1262,6 +1262,10 @@ mp_subcheck evaluate_filesystem(measurement_unit measurement_unit, bool display_
double free_inode_percentage =
calculate_percent(measurement_unit.inodes_free, measurement_unit.inodes_total);
mp_perfdata inode_percentage_pd = perfdata_init();
inode_percentage_pd = mp_set_pd_value(inode_percentage_pd, free_inode_percentage);
inode_percentage_pd = mp_pd_set_thresholds(inode_percentage_pd, measurement_unit.freeinodes_percent_thresholds);
if (verbose > 0) {
printf("free inode percentage computed: %g\n", free_inode_percentage);
}
@ -1293,7 +1297,7 @@ mp_subcheck evaluate_filesystem(measurement_unit measurement_unit, bool display_
inodes_pd = mp_pd_set_thresholds(inodes_pd, absolut_inode_thresholds);
freeindodes_percent_sc =
mp_set_subcheck_state(freeindodes_percent_sc, mp_get_pd_status(inodes_pd));
mp_set_subcheck_state(freeindodes_percent_sc, mp_get_pd_status(inode_percentage_pd));
if (display_inodes_perfdata) {
mp_add_perfdata_to_subcheck(&freeindodes_percent_sc, inodes_pd);
}

View file

@ -80,14 +80,25 @@ if($free_percent_on_mp1 == $avg_free_percent || $free_percent_on_mp2 == $avg_fre
die "One mountpoints has average space free - cannot do rest of test";
}
my $free_inodes_on_mp1 = $result->{'mp_test_result'}->{'checks'}->[1]->{'checks'}[2]->{'perfdata'}->[0]->{'value'}->{'value'};
my $used_inodes_on_mp1 = $result->{'mp_test_result'}->{'checks'}->[1]->{'checks'}[2]->{'perfdata'}->[0]->{'value'}->{'value'};
my $total_inodes_on_mp1 = $result->{'mp_test_result'}->{'checks'}->[1]->{'checks'}[2]->{'perfdata'}->[0]->{'max'}->{'value'};
my $free_inodes_on_mp1 = $total_inodes_on_mp1 - $used_inodes_on_mp1;
my $free_inode_percentage_on_mp1 = $free_inodes_on_mp1 / ($total_inodes_on_mp1 / 100);
my $free_inodes_on_mp2 = $result->{'mp_test_result'}->{'checks'}->[0]->{'checks'}[2]->{'perfdata'}->[0]->{'value'}->{'value'};
# print("free inodes on mp1: " . $free_inodes_on_mp1 . "\n");
# print("total inodes on mp1: " . $total_inodes_on_mp1 . "\n");
# print("free inode percentage on mp1: " . $free_inode_percentage_on_mp1 . "\n");
my $used_inodes_on_mp2 = $result->{'mp_test_result'}->{'checks'}->[0]->{'checks'}[2]->{'perfdata'}->[0]->{'value'}->{'value'};
my $total_inodes_on_mp2 = $result->{'mp_test_result'}->{'checks'}->[0]->{'checks'}[2]->{'perfdata'}->[0]->{'max'}->{'value'};
my $free_inodes_on_mp2 = $total_inodes_on_mp2 - $used_inodes_on_mp2;
my $free_inode_percentage_on_mp2 = $free_inodes_on_mp2 / ($total_inodes_on_mp2 / 100);
# print("free inodes on mp2: " . $free_inodes_on_mp2 . "\n");
# print("total inodes on mp2: " . $total_inodes_on_mp2 . "\n");
# print("free inode percentage on mp2: " . $free_inode_percentage_on_mp2 . "\n");
my $avg_inode_free_percentage = ceil(($free_inode_percentage_on_mp1 + $free_inode_percentage_on_mp2)/2);
my ($more_inode_free, $less_inode_free);
if ($free_inode_percentage_on_mp1 > $free_inode_percentage_on_mp2) {