Git Product home page Git Product logo

check_disk_btrfs's People

Contributors

adrienr avatar brueggemann avatar darkspir avatar dependabot[bot] avatar martialblog avatar mxhash avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

check_disk_btrfs's Issues

Error on run

File "./check_disk_btrfs", line 78
print " ".join(cmd)
^
SyntaxError: invalid syntax

(but deprecated version works)

Sudo permission error

The README states that the sudo permission line in /etc/sudoers needs to be set up as icinga ALL=(ALL) NOPASSWD: /usr/sbin/btrfs filesystem status *

But I can see from the code, that the called command is btrfs filesystem usage -b .

So the sudoers needs to be: icinga ALL=(ALL) NOPASSWD: /usr/sbin/btrfs filesystem usage *

[Feature]: Extend metrics being evaluated in the plugin

Please try to fill out as much of the information below as you can. Thank you!

  • Yes, I've searched similar issues on GitHub and didn't find any.

Which version contains the bug?

3.1.0

Describe the bug

The usage output might be wrong and or confusing. Maybe we'll just use the percentage the btrfs output shows.

Output from the plugin:

'Data,RAID1': 11.66842% used (0.42458TB/3.6387TB), 
'Metadata,RAID1': 0.01452% used (0.00053TB/3.6387TB), 
'System,RAID1': 0.0% used (0.0TB/3.6387TB

Output from btrfs filesystem usage

Data,RAID1: Size:469225177088, Used:466829971456 (99.49%)
   /dev/sda     469225177088
   /dev/sdb     469225177088

Metadata,RAID1: Size:2147483648, Used:580681728 (27.04%)
   /dev/sda     2147483648
   /dev/sdb     2147483648

System,RAID1: Size:41943040, Used:81920 (0.20%)
   /dev/sda       41943040
   /dev/sdb       41943040

Full output:

check_disk_btrfs --btrfs-path /usr/bin/btrfs -V /tank --no-sudo -w 100 -c 100 -v --missing --error
/usr/bin/btrfs filesystem usage -b /tank
Label: Data,RAID1, Total: 469225177088, Used: 466829971456
Label: Metadata,RAID1, Total: 2147483648, Used: 580730880
Label: System,RAID1, Total: 41943040, Used: 81920
/usr/bin/btrfs filesystem show /tank
/usr/bin/btrfs scrub stat /tank
OK: 'Data,RAID1': 11.66842% used (0.42458TB/3.6387TB), 'Metadata,RAID1': 0.01452% used (0.00053TB/3.6387TB), 'System,RAID1': 0.0% used (0.0TB/3.6387TB) | dataraid1_used=466829971456;100;100;; dataraid1_total=4000797868032;100;100;; metadataraid1_used=580730880;100;100;; metadataraid1_total=4000797868032;100;100;; systemraid1_used=81920;100;100;; systemraid1_total=4000797868032;100;100;;
/usr/bin/btrfs filesystem usage -b /tank
Overall:
    Device size:                     4000797868032
    Device allocated:                 942829207552
    Device unallocated:              3057968660480
    Device missing:                              0
    Device slack:                                0
    Used:                             934821470208
    Free (estimated):                1531379535872      (min: 1531379535872)
    Free (statfs, df):               1531378462720
    Data ratio:                               2.00
    Metadata ratio:                           2.00
    Global reserve:                      485900288      (used: 0)
    Multiple profiles:                          no

Data,RAID1: Size:469225177088, Used:466829971456 (99.49%)
   /dev/sda     469225177088
   /dev/sdb     469225177088

Metadata,RAID1: Size:2147483648, Used:580681728 (27.04%)
   /dev/sda     2147483648
   /dev/sdb     2147483648

System,RAID1: Size:41943040, Used:81920 (0.20%)
   /dev/sda       41943040
   /dev/sdb       41943040

Unallocated:
   /dev/sda     1528984330240
   /dev/sdb     1528984330240

See also #13

How to recreate the bug?

No response

script works only with python 2

Python 2 has been deprecated since the beginning of 2020. This script seems to require Python 2, nevertheless.

Some of the more obvious failures when running with Python 3:

  • print is a function now
  • raise assumes exceptions to classes

UNKNOWN - Error with raid1 volume on ubuntu 20.04

Hi,

I've created a btrfs mirror over two disks and try to monitor that using this plugin.
I could not find a way to make it work, I always get UNKNOWN state with an error.

root@nas:/usr/lib/nagios/plugins# ./check_disk_btrfs --btrfs-path /usr/bin/btrfs -V /tank --no-sudo -w 30 -c 40 -v --missing --error
/usr/bin/btrfs filesystem usage -b /tank
Label: Data,RAID1, Total: 469225177088, Used: 466829971456
Label: Metadata,RAID1, Total: 2147483648, Used: 580681728
Label: System,RAID1, Total: 41943040, Used: 81920
UNKNOWN - Error: ('Data,RAID1', ('469225177088', '466829971456'))
  File "/usr/lib/nagios/plugins/./check_disk_btrfs", line 335, in <module>
    sys.exit(main(ARGS))
             ^^^^^^^^^^
  File "/usr/lib/nagios/plugins/./check_disk_btrfs", line 256, in main
    (total, used) = values[label]
                    ~~~~~~^^^^^^^

Looking into the raw output for the filesystem usage it shows:

root@nas:/usr/lib/nagios/plugins# /usr/bin/btrfs filesystem usage -b /tank
Overall:
    Device size:                     4000797868032
    Device allocated:                 942829207552
    Device unallocated:              3057968660480
    Device missing:                              0
    Device slack:                                0
    Used:                             934821470208
    Free (estimated):                1531379535872      (min: 1531379535872)
    Free (statfs, df):               1531378462720
    Data ratio:                               2.00
    Metadata ratio:                           2.00
    Global reserve:                      485900288      (used: 0)
    Multiple profiles:                          no

Data,RAID1: Size:469225177088, Used:466829971456 (99.49%)
   /dev/sda     469225177088
   /dev/sdb     469225177088

Metadata,RAID1: Size:2147483648, Used:580681728 (27.04%)
   /dev/sda     2147483648
   /dev/sdb     2147483648

System,RAID1: Size:41943040, Used:81920 (0.20%)
   /dev/sda       41943040
   /dev/sdb       41943040

Unallocated:
   /dev/sda     1528984330240
   /dev/sdb     1528984330240

As you can see, the "Data" section shows 99.49% usage, but that's only for the btrfs allocated stuff. Checking the real disk usage with df -h shows about 24% usage:

root@nas:/usr/lib/nagios/plugins# df -h /tank
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda        1.9T  436G  1.4T  24% /tank

I'm using the latest release, 3.1.0, running with python 3.11.6 on an updated ubuntu 20.04.

Thanks,
Simon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.