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

[CPCLOUD-2743] Add exclude partitions option to diskusage plugin #75

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading