Skip to content

Commit

Permalink
#52 hide /snap /loop /squashfs /cagefs
Browse files Browse the repository at this point in the history
  • Loading branch information
vfuse authored Apr 21, 2022
1 parent 9516e74 commit b323e63
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions nixstatsagent/plugins/diskusage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ def run(self, config):
disk['df-psutil'] = []

for part in psutil.disk_partitions(False):
valid_part = True
ignored_partitions = ['/loop', '/snap', 'squashfs', 'cagefs-skeleton']

for ignore in ignored_partitions:
if ignore in part.device or ignore in part.mountpoint or ignore in part.fstype:
valid_part = False
if valid_part == False:
continue

if os.name == 'nt':
if 'cdrom' in part.opts or part.fstype == '':
# skip cd-rom drives with no disk in it; they may raise
Expand Down Expand Up @@ -75,8 +84,8 @@ def run(self, config):

# For LVM volume group monitoring, requires sudo access to vgs
# add vgs to /etc/sudoers
# nixstats ALL=(ALL) NOPASSWD: /usr/sbin/vgs
# set lvm = yes right under enabled = yes in /etc/nixstats.ini
# agent360 ALL=(ALL) NOPASSWD: /usr/sbin/vgs
# set lvm = yes right under enabled = yes in /etc/agent360.ini
if lvm_stats == 'yes':
try:
lines = [s.split(', ') for s in os.popen("sudo vgs --all --units b --noheadings --separator ', '").read().splitlines()]
Expand Down

0 comments on commit b323e63

Please sign in to comment.