Module: check_mk
Branch: master
Commit: 9513cc8d7c99b6d64fccb08f6dfba3072125fed4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9513cc8d7c99b6…
Author: Marcel Schulte <ms(a)mathias-kettner.de>
Date: Tue Nov 15 08:12:21 2016 +0100
3941 FIX zypper: fixed broken check for sections since agent OS SLES12
eck was broken for agent sections generated at agent OS since SLES12. This has been fixed
now.
---
.werks/3941 | 10 ++++++++++
ChangeLog | 1 +
checks/zypper | 35 +++++++++++++++++++++++++++++------
3 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/.werks/3941 b/.werks/3941
new file mode 100644
index 0000000..738eae4
--- /dev/null
+++ b/.werks/3941
@@ -0,0 +1,10 @@
+Title: zypper: fixed broken check for sections since agent OS SLES12
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i3
+Date: 1479193781
+
+eck was broken for agent sections generated at agent OS since SLES12. This has been fixed
now.
diff --git a/ChangeLog b/ChangeLog
index 6b4c691..c1d671b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
* 3983 FIX: mssql_instance: Be more robust agains missing instance info in case of
connection issues
* 3963 FIX: check_mk_agent.linux: fixed strayed output of postfix status command
* 3940 FIX: aix_hacmp_services: fixed broken check in case of agent section showing
extra information before the "Status(...)" line...
+ * 3941 FIX: zypper: fixed broken check for sections since agent OS SLES12...
Multisite:
* 3974 FIX: Sorting comments in hover menu of comments icon by time now
diff --git a/checks/zypper b/checks/zypper
index 86a5384..d97a48a 100644
--- a/checks/zypper
+++ b/checks/zypper
@@ -24,6 +24,9 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+# example agent output sections...
+#
+# ...for openSUSE 12:
# <<<zypper:sep(124)>>>
# 5 patches needed (2 security patches)
# Updates for openSUSE 12.1 12.1-1.4 | openSUSE-2012-326 | 1 | recommended | needed
| Softwarestack update
@@ -34,7 +37,22 @@
# Updates for openSUSE 12.1 12.1-1.4 | openSUSE-2012-324 | 1 | recommended | needed
| util-linux: make mount honor 'noexec' and 'user' option
# 1 | apache | package | (any)
# 2 | mysql | package | (any)
-
+#
+# ...for SLES11:
+# <<<zypper:sep(124)>>>
+# 4 patches needed (2 security patches)
+# SLE11-SDK-SP4-Updates | sdksp4-apache2-mod_fcgid-12653 | 1 | security |
needed
+# SLES11-SP4-Updates | slessp4-mysql-12847 | 1 | security |
needed
+# SLES11-SP4-Updates | slessp4-timezone-12844 | 1 | recommended |
needed
+# SLES11-SP4-Updates | slessp4-wget-12826 | 1 | recommended |
needed
+#
+# ...new since SLES12:
+# <<<zypper:sep(124)>>>
+# 4 patches needed (1 security patches)
+# SLES12-SP1-Updates | SUSE-SLE-SERVER-12-SP1-2016-1141 | security | moderate | ---
| needed | Security update for sqlite3
+# SLES12-SP1-Updates | SUSE-SLE-SERVER-12-SP1-2016-1147 | recommended | moderate | ---
| needed | Recommended update for dracut
+# SLES12-SP1-Updates | SUSE-SLE-SERVER-12-SP1-2016-1149 | recommended | low | ---
| needed | Recommended update for gcc48
+# SLES12-SP1-Updates | SUSE-SLE-SERVER-12-SP1-2016-1150 | recommended | low | ---
| needed | Recommended update for release-notes-sles
def inventory_zypper(info):
# the agent section is only present when the agent has
@@ -51,11 +69,16 @@ def check_zypper(_no_item, _no_params, info):
return 3, firstline
for line in info:
# 5 patches needed (2 security patches)
- if len(line) >= 5 and line[4].lower().strip() == 'needed':
- patch_type = line[3].strip()
- patch_types.setdefault(patch_type, 0)
- patch_types[patch_type] += 1
- updates += 1
+ if len(line) >= 5:
+ patch_type = None
+ if len(line) >= 6 and line[5].lower().strip() == 'needed': # since
SLES12
+ patch_type = line[2].strip()
+ elif line[4].lower().strip() == 'needed':
+ patch_type = line[3].strip()
+ if patch_type:
+ patch_types.setdefault(patch_type, 0)
+ patch_types[patch_type] += 1
+ updates += 1
elif len(line) == 4:
locks.append(line[1])