Univention Bugzilla – Attachment 8902 Details for
Bug 35859
Free space on root file system less than 10 %
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
35859-diagnostic-disk-space-420.patch
35859-diagnostic-disk-space-420.patch (text/plain), 9.77 KB, created by
Lukas Oyen
on 2017-06-06 17:16:23 CEST
(
hide
)
Description:
35859-diagnostic-disk-space-420.patch
Filename:
MIME Type:
Creator:
Lukas Oyen
Created:
2017-06-06 17:16:23 CEST
Size:
9.77 KB
patch
obsolete
>From 1e60130ba299745b445d49d94b471751fb2afab9 Mon Sep 17 00:00:00 2001 >From: Lukas Oyen <oyen@univention.de> >Date: Tue, 6 Jun 2017 16:15:34 +0200 >Subject: [PATCH 1/2] Bug #35859: ucm-diagnostic: new check disk_usage.py > >--- > .../umc/python/diagnostic/plugins/disk_usage.py | 148 +++++++++++++++++++++ > 1 file changed, 148 insertions(+) > create mode 100755 management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/disk_usage.py > >diff --git a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/disk_usage.py b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/disk_usage.py >new file mode 100755 >index 0000000..79852c3 >--- /dev/null >+++ b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/disk_usage.py >@@ -0,0 +1,148 @@ >+#!/usr/bin/python2.7 >+# coding: utf-8 >+# >+# Univention Management Console module: >+# System Diagnosis UMC module >+# >+# Copyright 2017 Univention GmbH >+# >+# http://www.univention.de/ >+# >+# All rights reserved. >+# >+# The source code of this program is made available >+# under the terms of the GNU Affero General Public License version 3 >+# (GNU AGPL V3) as published by the Free Software Foundation. >+# >+# Binary versions of this program provided by Univention to you as >+# well as other copyrighted, protected or trademarked materials like >+# Logos, graphics, fonts, specific documentations and configurations, >+# cryptographic keys etc. are subject to a license agreement between >+# you and Univention and not subject to the GNU AGPL V3. >+# >+# In the case you use this program under the terms of the GNU AGPL V3, >+# the program is provided in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU Affero General Public License for more details. >+# >+# You should have received a copy of the GNU Affero General Public >+# License with the Debian GNU/Linux or Univention distribution in file >+# /usr/share/common-licenses/AGPL-3; if not, see >+# <http://www.gnu.org/licenses/>. >+ >+import psutil >+ >+import univention.config_registry >+from univention.management.console.modules.diagnostic import Warning, Critical >+ >+from univention.lib.i18n import Translation >+_ = Translation('univention-management-console-module-diagnostic').translate >+ >+title = _('Check free disk space') >+description = _('Enough free disk space available.') >+ >+DISK_USAGE_THRESHOLD = 90 >+ >+ >+def mount_points(): >+ for dp in psutil.disk_partitions(): >+ yield dp.mountpoint >+ >+ >+def high_disk_usage(): >+ high = ((mp, psutil.disk_usage(mp).percent) for mp in mount_points()) >+ return {mp: pc for (mp, pc) in high if pc > DISK_USAGE_THRESHOLD} >+ >+ >+def local_repository_exists(): >+ configRegistry = univention.config_registry.ConfigRegistry() >+ configRegistry.load() >+ return configRegistry.is_true('local/repository', False) >+ >+ >+def is_varlog_own_partition(): >+ mp = set(mount_points()) >+ return '/var' in mp or '/var/log' in mp >+ >+ >+def high_log_levels(): >+ def is_high(variable, default): >+ return lambda ucr: int(ucr.get(variable, default)) > default >+ >+ def is_on(variable): >+ return lambda ucr: ucr.is_true(variable, False) >+ >+ checks = ( >+ is_high('connector/debug/function', 0), >+ is_high('connector/debug/level', 2), >+ is_high('samba/debug/level', 33), >+ is_high('directory/manager/cmd/debug/level', 0), >+ is_high('dns/debug/level', 0), >+ is_high('dns/dlz/debug/level', 0), >+ is_high('ldap/debug/level', 0), >+ is_high('listener/debug/level', 2), >+ is_high('mail/postfix/ldaptable/debuglevel', 0), >+ is_high('notifier/debug/level', 1), >+ is_high('nscd/debug/level', 0), >+ is_high('stunnel/debuglevel', 4), >+ is_high('umc/module/debug/level', 2), >+ is_high('umc/server/debug/level', 2), >+ is_high('grub/loglevel', 0), >+ is_high('mail/postfix/smtp/tls/loglevel', 0), >+ is_high('mail/postfix/smtpd/tls/loglevel', 0), >+ is_on('kerberos/defaults/debug'), >+ is_on('mail/postfix/smtpd/debug'), >+ is_on('samba4/sysvol/sync/debug'), >+ is_on('aml/idp/ldap/debug'), >+ is_on('saml/idp/log/debug/enabled'), >+ is_on('pdate/check/boot/debug'), >+ is_on('update/check/cron/debug'), >+ lambda ucr: ucr.get('apache2/loglevel', 'warn') in ('notice', 'info', 'debug') >+ ) >+ >+ configRegistry = univention.config_registry.ConfigRegistry() >+ configRegistry.load() >+ return any(check(configRegistry) for check in checks) >+ >+ >+def solutions(): >+ yield _('You may want to uninstall software via {appcenter:appcenter}.') >+ if not is_varlog_own_partition(): >+ yield _('You may want to move /var/log to another disk or storage.') >+ if local_repository_exists(): >+ yield _('You may want to move the local repository to another server.') >+ yield _('You may want to exchange the hard drive.') >+ >+ >+def run(): >+ high = high_disk_usage() >+ tmpl = _('- Disk for mountpoint %(mp)s is %(pc)s%% full.') >+ disk_errors = [tmpl % {'mp': mp, 'pc': pc} for (mp, pc) in high.iteritems()] >+ >+ problem_on_root = '/' in high >+ problem_on_varlog = '/var/log' in high or '/var' in high or \ >+ (problem_on_root and not is_varlog_own_partition()) >+ >+ if disk_errors: >+ umc_modules = [{'module': 'appcenter', 'flavor': 'appcenter'}] >+ error_descriptions = [_('Some disks are nearly full:')] >+ error_descriptions.extend(disk_errors) >+ >+ if problem_on_root: >+ error_descriptions.append('\n'.join(solutions())) >+ >+ if problem_on_varlog and high_log_levels(): >+ lvl_errors = (_('You have configured some high log levels.'), >+ _('You may want to reset them via {ucr}.')) >+ umc_modules.append({'module': 'ucr'}) >+ error_descriptions.append(' '.join(lvl_errors)) >+ >+ if problem_on_root: >+ raise Critical('\n'.join(error_descriptions), umc_modules=umc_modules) >+ raise Warning('\n'.join(error_descriptions), umc_modules=umc_modules) >+ >+ >+if __name__ == '__main__': >+ from univention.management.console.modules.diagnostic import main >+ main() >-- >2.7.4 > > >From e97ea6719a65bf59672ae2d58405270b968fcc9c Mon Sep 17 00:00:00 2001 >From: Lukas Oyen <oyen@univention.de> >Date: Tue, 6 Jun 2017 16:50:26 +0200 >Subject: [PATCH 2/2] Bug #35859: ucm-diagnostic: new check disk_usage.py (po) > >--- > .../umc/python/diagnostic/de.po | 47 +++++++++++++++++++++- > 1 file changed, 45 insertions(+), 2 deletions(-) > >diff --git a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po >index affad86..87a1d3a 100644 >--- a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po >+++ b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po >@@ -2,8 +2,8 @@ > msgid "" > msgstr "" > "Project-Id-Version: univention-management-console-module-diagnostic\n" >-"Report-Msgid-Bugs-To: packages@univention.de\n" >-"POT-Creation-Date: 2016-01-14 12:19+0100\n" >+"Report-Msgid-Bugs-To: \n" >+"POT-Creation-Date: 2017-06-06 17:08+0200\n" > "PO-Revision-Date: \n" > "Last-Translator: Univention GmbH <packages@univention.de>\n" > "Language-Team: Univention GmbH <packages@univention.de>\n" >@@ -17,6 +17,11 @@ msgstr "" > msgid "%d of the configured nameservers are not responding to DNS queries." > msgstr "%d der konfigurierten Nameserver anworten nicht auf DNS-Anfragen." > >+#: umc/python/diagnostic/plugins/disk_usage.py:120 >+#, python-format >+msgid "- Disk for mountpoint %(mp)s is %(pc)s%% full." >+msgstr "- Festplatte für Moint Point %(mp)s ist %(pc)s%% voll." >+ > #: umc/python/diagnostic/plugins/nameserver.py:46 > msgid "A timeout occurred while reaching the nameserver (is it online?)." > msgstr "" >@@ -27,6 +32,14 @@ msgstr "" > msgid "Adjust to suggested limits" > msgstr "An vorgeschlagene Limits anpassen" > >+#: umc/python/diagnostic/plugins/disk_usage.py:42 >+msgid "Check free disk space" >+msgstr "Ãberprüfe freien Festplatten Platz" >+ >+#: umc/python/diagnostic/plugins/disk_usage.py:43 >+msgid "Enough free disk space available." >+msgstr "AuÃreichend freier Festplatten Platz vorhanden." >+ > #: umc/python/diagnostic/plugins/gateway.py:11 > msgid "Gateway is not reachable" > msgstr "Gateway ist nicht erreichbar" >@@ -137,6 +150,10 @@ msgstr "SSH-Verbindung zu anderem UCS Server fehlgeschlagen!" > msgid "Security limits exceeded" > msgstr "Sicherheitslimits überschritten" > >+#: umc/python/diagnostic/plugins/disk_usage.py:129 >+msgid "Some disks are nearly full:" >+msgstr "Einige Festplatten sind beinahe voll:" >+ > #: umc/python/diagnostic/__init__.py:262 > msgid "Test again" > msgstr "Erneut testen" >@@ -260,6 +277,32 @@ msgstr "" > "dass Authentifikations-Zugangsdaten (falls existierend) korrekt sind und die " > "ACL's des Proxy-Servers nicht verbieten, Anfragen an %s zu stellen." > >+#: umc/python/diagnostic/plugins/disk_usage.py:136 >+msgid "You have configured some high log levels." >+msgstr "Sie haben erhöhten Detailgrad für Logmeldungen eingestellt." >+ >+#: umc/python/diagnostic/plugins/disk_usage.py:115 >+msgid "You may want to exchange the hard drive." >+msgstr "Sie können die Festplatte austauschen." >+ >+#: umc/python/diagnostic/plugins/disk_usage.py:112 >+msgid "You may want to move /var/log to another disk or storage." >+msgstr "" >+"Sie können /var/log auf eine andere Festplatte oder Speicher verschieben." >+ >+#: umc/python/diagnostic/plugins/disk_usage.py:114 >+msgid "You may want to move the local repository to another server." >+msgstr "Sie können lokale Repositorys auf einen anderen Server auslagern." >+ >+#: umc/python/diagnostic/plugins/disk_usage.py:137 >+#, python-brace-format >+msgid "You may want to reset them via {ucr}." >+msgstr "Sie können sie per {ucr} zurück setzen." >+ >+#: umc/python/diagnostic/plugins/disk_usage.py:110 >+msgid "You may want to uninstall software via {appcenter:appcenter}." >+msgstr "Sie können per {appcenter:appcenter} Software entfernen." >+ > #: umc/python/diagnostic/plugins/package_status.py:28 > msgid "some" > msgstr "einigen" >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 35859
: 8902