/usr/share/check_mk/checks/zypper is in check-mk-server 1.2.8p16-1ubuntu0.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# |             ____ _               _        __  __ _  __           |
# |            / ___| |__   ___  ___| | __   |  \/  | |/ /           |
# |           | |   | '_ \ / _ \/ __| |/ /   | |\/| | ' /            |
# |           | |___| | | |  __/ (__|   <    | |  | | . \            |
# |            \____|_| |_|\___|\___|_|\_\___|_|  |_|_|\_\           |
# |                                                                  |
# | Copyright Mathias Kettner 2014             mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software;  you can redistribute it and/or modify it
# under the  terms of the  GNU General Public License  as published by
# the Free Software Foundation in version 2.  check_mk is  distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;  with-
# out even the implied warranty of  MERCHANTABILITY  or  FITNESS FOR A
# PARTICULAR PURPOSE. See the  GNU General Public License for more de-
# tails. You should have  received  a copy of the  GNU  General Public
# License along with GNU Make; see the file  COPYING.  If  not,  write
# 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
# Updates for openSUSE 12.1 12.1-1.4 | openSUSE-2012-316 | 1       | security    | needed | bind: Fixed a remote denial of service
# Updates for openSUSE 12.1 12.1-1.4 | openSUSE-2012-318 | 1       | recommended | needed | mdadm: fixed some race conditions during startup
# Updates for openSUSE 12.1 12.1-1.4 | openSUSE-2012-320 | 1       | security    | needed | update for libxml2
# Updates for openSUSE 12.1 12.1-1.4 | openSUSE-2012-321 | 1       | recommended | needed | sudo: fixed pam session leak and tls option handling
# 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
    # detected that zypper is installed, therefore the check
    # can always register
    return [(None,{})]
def check_zypper(_no_item, _no_params, info):
    patch_types = {}
    updates = 0
    locks = []
    firstline = " ".join(info[0])
    if re.match("ERROR:", firstline):
        return 3, firstline
    for line in info:
        # 5 patches needed (2 security patches)
        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])
    state = 0
    infotext = "%d updates" % updates
    if updates:
        patch_items = patch_types.items()
        patch_items.sort()
        infos = []
        for t,c in patch_items:
            if t == "security":
                marker = '(!!)'
                state = 2
            elif t == "recommended":
                marker = '(!)'
                state = max(state, 1)
            else:
                marker = ''
            infos.append("%s: %d%s" % (t, c, marker))
        infotext += " (" + ", ".join(infos) + ")"
    if locks:
        state = max(1, state)
        infotext += ", %d locks(!)" % len(locks)
    return state, infotext
check_info['zypper'] = {
    "check_function"          : check_zypper,
    "inventory_function"      : inventory_zypper,
    "service_description"     : "Zypper Updates",
    "group"                   : "zypper",
}
 |