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

Beacon diskusage reporting incorrect diskusage value. #49174

Closed
rbthomp opened this issue Aug 17, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@rbthomp
Copy link
Contributor

commented Aug 17, 2018

Description of Issue/Question

The Beacon diskusage is reporting the incorrect diskusage in the event.

This is due to wrong value being referenced. In the diskusage beacon module.

I corrected this by referencing _mount instead of mount
before:

                try:
                    _current_usage = psutil.disk_usage(mount)
                except OSError:
                    log.warning('%s is not a valid mount point.', mount)
                    continue

corrected

                try:
                    _current_usage = psutil.disk_usage(_mount)
                except OSError:
                    log.warning('%s is not a valid mount point.', _mount)
                    continue

This will set _current_usage with the partition found using the regex and not the one listed in the config. This should also correct the issue of triggering an exception that occurs when trying to get usage of a mount from the beacon config that is a regular expression.

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

Steps to Reproduce Issue

Setup a diskusage beacon.

pillar

  beacons:
    diskusage:
      - '/.*': 10%
      - interval: 120

monitor events
salt-run state.event pretty=true

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

@gtmanfred

This comment has been minimized.

Copy link
Contributor

commented Aug 20, 2018

Can you submit a PR with this fix?

https://docs.saltstack.com/en/latest/topics/development/contributing.html

Thanks!
Daniel

@gtmanfred

This comment has been minimized.

Copy link
Contributor

commented Aug 22, 2018

I have submitted your change as a pr here #49264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.