Skip to content

Commit

Permalink
Merge pull request #75 from skafandri/CPCLOUD-2743
Browse files Browse the repository at this point in the history
[CPCLOUD-2743] Add exclude partitions option to diskusage plugin
  • Loading branch information
vfuse authored Jan 29, 2025
2 parents 1b57d50 + 95d1411 commit f58ee99
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
18 changes: 16 additions & 2 deletions agent360/plugins/diskusage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,27 @@ class Plugin(plugins.BasePlugin):


def run(self, config):
'''
Returns disk partitions usage statistics.
Example config for /etc/agent360.ini:
[diskusage]
enabled = yes
exclude = /dev/loop,/dev/snap,/squashfs,/cagefs-skeleton
'''

disk = {}
disk['df-psutil'] = []

ignored_partitions = config.get('diskusage', 'exclude', fallback='').split(',')
if ignored_partitions == ['']:
ignored_partitions = ['/loop', '/snap', 'squashfs', 'cagefs-skeleton']
else:
ignored_partitions += ['/loop', '/snap', 'squashfs', 'cagefs-skeleton']

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
Expand Down
2 changes: 1 addition & 1 deletion agent360/plugins/dovecot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def run(self, config):
Returns active dovecot IMAP and POP3 session and the current version.
Sudo permission to acces doveadm and dovecot commands are required.
Exampel config for /etc/agent360.ini:
Example config for /etc/agent360.ini:
[dovecot]
enabled = yes
'''
Expand Down
2 changes: 1 addition & 1 deletion agent360/plugins/postfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def run(self, config):
Monitoring of the Postfix MTA log and optionally the Postfix version and the mailqueue
Dependency: Pflogsumm log analyzer, sudo access
Exampel config for /etc/agent360.ini:
Example config for /etc/agent360.ini:
[postfix]
enabled = yes
log = /var/log/mail.log
Expand Down

0 comments on commit f58ee99

Please sign in to comment.