Module: check_mk
Branch: master
Commit: f5f41946d9be03f50e832dd3dcb6891c05bb3334
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f5f41946d9be03…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Oct 31 11:48:37 2015 +0100
#2672 FIX mounts: ignore options that are allowed to change on btrfs filesystems
This prevents the service from complaining about <tt>subvolid</tt> and <tt>subvol</tt>.
---
.werks/2672 | 10 ++++++++++
ChangeLog | 1 +
checks/mounts | 15 +++++++++++----
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/.werks/2672 b/.werks/2672
new file mode 100644
index 0000000..c531409
--- /dev/null
+++ b/.werks/2672
@@ -0,0 +1,10 @@
+Title: mounts: ignore options that are allowed to change on btrfs filesystems
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i4
+Date: 1446288478
+
+This prevents the service from complaining about <tt>subvolid</tt> and <tt>subvol</tt>.
diff --git a/ChangeLog b/ChangeLog
index 82b7f8f..9473b2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,7 @@
* 2706 FIX: winperf_if: fixed rare crashes of windows_if.ps1 plugin...
* 1297 FIX: emcvnx_hba: Prevent old emc versions from inventory...
* 2698 FIX: ups_capacity: fixed missing battery time and fuel information
+ * 2672 FIX: mounts: ignore options that are allowed to change on btrfs filesystems...
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checks/mounts b/checks/mounts
index 40d0ead..3dd5f65 100644
--- a/checks/mounts
+++ b/checks/mounts
@@ -24,6 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
def inventory_mounts(info):
inventory = []
devices = []
@@ -36,6 +37,14 @@ def inventory_mounts(info):
return inventory
def check_mounts(item, targetopts, info):
+
+ # Ignore options that are allowed to change
+ def should_ignore_option(option):
+ for ignored_option in [ "commit=", "localalloc=", "subvol=", "subvolid=" ]:
+ if option.startswith(ignored_option):
+ return True
+ return False
+
for dev, mp, fstype, options, dump, fsck in info:
if item == mp:
opts = options.split(",")
@@ -43,14 +52,12 @@ def check_mounts(item, targetopts, info):
exceeding = []
for o in opts:
- if o not in targetopts and not o.startswith("commit=") \
- and not o.startswith("localalloc="):
+ if o not in targetopts and not should_ignore_option(o):
exceeding.append(o)
missing = []
for o in targetopts:
- if o not in opts and not o.startswith("commit=") \
- and not o.startswith("localalloc="):
+ if o not in opts and not should_ignore_option(o):
missing.append(o)
if not missing and not exceeding:
Module: check_mk
Branch: master
Commit: bf1ad637a2eec45e430636e92428024c426d8146
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bf1ad637a2eec4…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Oct 31 11:42:16 2015 +0100
#2671 df: avoid duplicate items for btrfs that is mounted several times
With SLES 12 btrfs has been introduced. Here one filesystem (e.g. <tt>/dev/sda1</tt>) is
mounted at a lot of directories at the same times and Check_MK had created one service
for each of this - showing exactly the same stats. This has now been fixed so that only
one filesystem check is being created for each btrfs device. The service in our example
has the name <tt>Filesystem btrfs /dev/sda1</tt>. You need to redo service discovery
or the affected hosts.
---
.werks/2671 | 14 ++++++++++++++
ChangeLog | 2 ++
checks/df | 26 +++++++++++++++++++++++++-
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/.werks/2671 b/.werks/2671
new file mode 100644
index 0000000..25f899e
--- /dev/null
+++ b/.werks/2671
@@ -0,0 +1,14 @@
+Title: df: avoid duplicate items for btrfs that is mounted several times
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.7i4
+Date: 1446287956
+Class: feature
+
+With SLES 12 btrfs has been introduced. Here one filesystem (e.g. <tt>/dev/sda1</tt>) is
+mounted at a lot of directories at the same times and Check_MK had created one service
+for each of this - showing exactly the same stats. This has now been fixed so that only
+one filesystem check is being created for each btrfs device. The service in our example
+has the name <tt>Filesystem btrfs /dev/sda1</tt>. You need to redo service discovery
+or the affected hosts.
diff --git a/ChangeLog b/ChangeLog
index bf984d9..82b7f8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@
* 2703 logwatch.ec: now transfers the service level to the event console...
* 2705 winperf_if: added option to warn if an interface is using dhcp...
* 2699 windows_tasks: new task success constant 'an instance of the task is already running'
+ * 2671 df: avoid duplicate items for btrfs that is mounted several times...
+ NOTE: Please refer to the migration notes!
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/checks/df b/checks/df
index 74bbebc..0ab4b9c 100644
--- a/checks/df
+++ b/checks/df
@@ -37,10 +37,28 @@
# Data NTFS 976506816 528665344 447841472 55% D:\
# PS3 PlayStation(R)3 File System 0 0 0 0% P:\
+# An example with btrfs (SLES 12). Here the same device is mounted
+# several times at different mount point. But must only be monitored
+# once. We use the device instead of the mount point in this case.
+# <<<df>>>
+# /dev/sda1 btrfs 20970496 4169036 16539348 21% /
+# devtmpfs devtmpfs 497396 0 497396 0% /dev
+# tmpfs tmpfs 506312 0 506312 0% /dev/shm
+# tmpfs tmpfs 506312 6980 499332 2% /run
+# tmpfs tmpfs 506312 0 506312 0% /sys/fs/cgroup
+# /dev/sda1 btrfs 20970496 4169036 16539348 21% /.snapshots
+# /dev/sda1 btrfs 20970496 4169036 16539348 21% /var/tmp
+# /dev/sda1 btrfs 20970496 4169036 16539348 21% /var/spool
+# /dev/sda1 btrfs 20970496 4169036 16539348 21% /var/opt
+# /dev/sda1 btrfs 20970496 4169036 16539348 21% /var/log
+
+
def df_parse_info(info):
df_blocks = []
df_inodes = []
+ btrfs_devices = set() # We might generalize that later
lines = iter(info)
+
try:
is_inode = False
while True:
@@ -55,7 +73,13 @@ def df_parse_info(info):
# Handle known cases, where the file system contains spaces
if line[2] == "File" and line[3] == "System":
line = [ line[0], " ".join(line[1:4]) ] + line[4:]
- df_blocks.append(line)
+ if line[1] == "btrfs":
+ device = line[0]
+ if device not in btrfs_devices:
+ btrfs_devices.add(device)
+ df_blocks.append(line[:6] + [ "btrfs " + line[0] ]) # replace mount point with device
+ else:
+ df_blocks.append(line)
else:
df_inodes.append(line)
except StopIteration:
Module: check_mk
Branch: master
Commit: 302028c5926b934697208d25f5f7b026570baec3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=302028c5926b93…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Oct 30 16:11:36 2015 +0100
Removed Python 2.3 compatibility code - 2.4 is the oldest supported version
---
modules/check_mk_base.py | 7 -------
web/htdocs/bi.py | 8 --------
web/htdocs/config.py | 8 --------
web/htdocs/dashboard.py | 7 -------
web/htdocs/htmllib.py | 6 ------
web/htdocs/livestatus.py | 7 -------
web/htdocs/views.py | 7 -------
web/htdocs/webapi.py | 7 -------
web/plugins/sidebar/bi.py | 7 -------
9 files changed, 64 deletions(-)
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 6d743ca..ea758c3 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -65,13 +65,6 @@ import subprocess
# or define a new output function
# - Also create a function bail_out() for printing and error and exiting
-# Python 2.3 does not have 'set' in normal namespace.
-# But it can be imported from 'sets'
-try:
- set()
-except NameError:
- from sets import Set as set
-
#.
# .--Globals-------------------------------------------------------------.
# | ____ _ _ _ |
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index df1aea0..56c0a36 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -27,14 +27,6 @@
import config, re, pprint, time, views
from lib import *
-
-# Python 2.3 does not have 'set' in normal namespace.
-# But it can be imported from 'sets'
-try:
- set()
-except NameError:
- from sets import Set as set
-
# Datastructures and functions needed before plugins can be loaded
loaded_with_language = False
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index 0a0051d..f7aa6ca 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -36,14 +36,6 @@ try:
except:
import defaults_standalone as defaults
-# Python 2.3 does not have 'set' in normal namespace.
-# But it can be imported from 'sets'
-# FIXME: We should officially drop Python 2.3 support
-try:
- set()
-except NameError:
- from sets import Set as set
-
# FIXME: Make clear whether or not user related values should be part
# of the "config" module. Maybe move to dedicated module (userdb?). Then
# move all user related stuff there. e.g. html.user should also be moved
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 069b64f..477c3d8 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -29,13 +29,6 @@ from valuespec import *
from lib import *
import wato
-# Python 2.3 does not have 'set' in normal namespace.
-# But it can be imported from 'sets'
-try:
- set()
-except NameError:
- from sets import Set as set
-
loaded_with_language = False
builtin_dashboards = {}
dashlet_types = {}
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 1e36f51..22a671c 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -53,12 +53,6 @@ except ImportError:
import json
from lib import *
-# Python 2.3 does not have 'set' in normal namespace.
-# But it can be imported from 'sets'
-try:
- set()
-except NameError:
- from sets import Set as set
# Only parse variable adhering to the following regular expressions
varname_regex = re.compile('^[\w\d_.%+-\\\*]+$')
diff --git a/web/htdocs/livestatus.py b/web/htdocs/livestatus.py
index 562345f..fb6865c 100644
--- a/web/htdocs/livestatus.py
+++ b/web/htdocs/livestatus.py
@@ -26,13 +26,6 @@
import socket, time, re
-# Python 2.3 does not have 'set' in normal namespace.
-# But it can be imported from 'sets'
-try:
- set()
-except NameError:
- from sets import Set as set
-
"""MK Livestatus Python API
This module allows easy access to Nagios via MK Livestatus.
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index ad9d264..e571785 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -28,13 +28,6 @@ import config, defaults, livestatus, time, os, re, pprint, time
import weblib, traceback, forms, valuespec, inventory, visuals
from lib import *
-# Python 2.3 does not have 'set' in normal namespace.
-# But it can be imported from 'sets'
-try:
- set()
-except NameError:
- from sets import Set as set
-
# Datastructures and functions needed before plugins can be loaded
loaded_with_language = False
diff --git a/web/htdocs/webapi.py b/web/htdocs/webapi.py
index 35eb977..eae3c50 100644
--- a/web/htdocs/webapi.py
+++ b/web/htdocs/webapi.py
@@ -28,13 +28,6 @@ from lib import *
from wato import API
import config
-# Python 2.3 does not have 'set' in normal namespace.
-# But it can be imported from 'sets'
-try:
- set()
-except NameError:
- from sets import Set as set
-
try:
import simplejson as json
except ImportError:
diff --git a/web/plugins/sidebar/bi.py b/web/plugins/sidebar/bi.py
index 10dfd25..be5c0d0 100644
--- a/web/plugins/sidebar/bi.py
+++ b/web/plugins/sidebar/bi.py
@@ -26,13 +26,6 @@
import bi
-# Python 2.3 does not have 'set' in normal namespace.
-# But it can be imported from 'sets'
-try:
- set()
-except NameError:
- from sets import Set as set
-
def render_bi_groups():
html.write("<ul>")
for group in bi.aggregation_groups():