Skip to content

disk-usage: handle disk accessibility  #792

@drapiti

Description

@drapiti

This issue respects the following points:

Which variant of the Monitoring Plugins do you use?

  • .rpm/.deb package from repo.linuxfabrik.ch
  • Compiled for Linux (.tar/.zip from download.linuxfabrik.ch)
  • Compiled for Windows (from download.linuxfabrik.ch)
  • Source Code from GitHub

Bug description

At the moment any disk which is not accessible throws an ugly error such as:

Traceback (most recent call last):

  File "C:\PROGRA~3\icinga2\usr\lib64
agios\plugins\disk-usage", line 393, in 'module'

  File "C:\PROGRA~3\icinga2\usr\lib64
agios\plugins\disk-usage", line 233, in main

  File "C:\PROGRA~3\icinga2\usr\lib64
agios\plugins\psutil\__init__.py", line 2040, in disk_usage

  File "C:\PROGRA~3\icinga2\usr\lib64
agios\plugins\psutil\_pswindows.py", line 290, in disk_usage

FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\ClusterStorage\\A_001_PURE_BRONZE_SYSCLUHVA21S\\'

Please add some error checking if the disk is not accessible in terms of disk-usage everything is fine so please skip the non accessible disks. Would like the check to be ok with maybe a not accessible message but not what currently happens where the check goes into unknown for all disks with Traceback errors. We get this a lot on windows systems.

Steps to reproduce - Plugin call

'C:\ProgramData\icinga2\usr\lib64\nagios\plugins\disk-usage.exe' '--critical' '96%USED' '--include-pattern' 'C:\ClusterStorage'

Steps to reproduce - Data

Run check on any disk which is present but not accessible.

Environment

Mainly windows servers

Plugin Version

any

Python version

3.12

List of Python modules

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions