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

[in_node_exporter_meterics/ne_filesystem_linux.c] reports incorrect available / free size in bytes #9901

Open
tswaehn opened this issue Jan 31, 2025 · 3 comments
Labels
status: waiting-for-triage waiting-for-user Waiting for more information, tests or requested changes

Comments

@tswaehn
Copy link

tswaehn commented Jan 31, 2025

Bug Report

Describe the bug

compared to the output of stat -f which uses the same library:

$ stat -f /storagebox/
  File: "/storagebox/"
    ID: 0        Namelen: 255     Type: fuseblk
Block size: 131072     Fundamental block size: 512
Blocks: Total: 2147483648 Free: 1457905063 Available: 1457905063
Inodes: Total: 1457930588 Free: 1457905063

we get an actual disc size of: 1TB = (2147483648 * 512) = (Blocks Total * Fundamental block size) - correct

however the plugin uses the optimal transfer block size in this case 131072, so the the reported disc size is: 280TB - wrong

Replication Procedure

  • for most discs the optimal block size and the fundamental block size are equal, so the output will be correct in most cases.
  • however in the case they are not same the output is 100% incorrect.

Your Environment

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/

Linux dev-debian 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux

@patrick-stephens
Copy link
Contributor

Please follow the template for PRs to capture all relevant details - in this case the config and version of FB would be super helpful.

@patrick-stephens patrick-stephens added the waiting-for-user Waiting for more information, tests or requested changes label Feb 3, 2025
@tswaehn
Copy link
Author

tswaehn commented Feb 3, 2025

It's an issue with the latest main source code.

Package: fluent-bit
Version: 3.2.5
Priority: optional
Section: devel
Maintainer: Eduardo Silva <[email protected]>
# System - Complete Node Metrics
[INPUT]
    name                        node_exporter_metrics
    tag                         gateway_metrics
    scrape_interval             5s 

@tswaehn
Copy link
Author

tswaehn commented Feb 4, 2025

the issue is here

https://github.com/fluent/fluent-bit/blob/e2461d63cbebb7567549c092976012c543553231/plugins/in_node_exporter_metrics/ne_filesystem_linux.c#L217C21-L217C73

result = statfs(field_values[1], &mount_point_info);

and here

cmt_gauge_set(ctx->fs_free_bytes,

                        cmt_gauge_set(ctx->fs_free_bytes,
                                      timestamp,
                                      mount_point_info.f_bsize *
                                      mount_point_info.f_bfree,
                                      3, labels);

where statfs() delivers the "optimal blocksize" however not the physical block size, refer to:

https://www.man7.org/linux/man-pages/man2/statfs.2.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage waiting-for-user Waiting for more information, tests or requested changes
Projects
None yet
Development

No branches or pull requests

2 participants