/usr/share/check_mk/checks/sylo is in check-mk-server 1.2.6p12-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 116 117 118 119 120 121 122 123 | #!/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-
# ails.  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.
# Author: Lars Michelsen <lm@mathias-kettner.de
# Example output of agent:
#<<<sylo>>>
#            7859            7859           10240
#
# Syntax of the hint file:
#
# +------------------------------------------+
# | in offset (Ascii, space padded, bytes)   |  16 Bytes
# +------------------------------------------+
# | out offset                               |  16 Bytes
# +------------------------------------------+
# | Size of sylo                             |  16 Bytes
# +------------------------------------------+
#
# The check_mk_agents add the mtime in front of the hint file contents
# 0: alive_report (max age of hint file in seconds)
# 1: warn fill level in percent
# 2: crit fill level in percent
sylo_default_levels = (70, 5, 25)
def inventory_sylo(info):
    if len(info) > 0 and len(info[0]) == 4:
        return [ (None, "", "sylo_default_levels") ]
def check_sylo(item, params, info):
    if len(info) != 1:
        return (2, "No hint file (sylo probably never ran on this system)")
    if len(info[0]) == 4:
        msg = ""
        alive_report, warn, crit = params
        mtime     = int(info[0][0])
        inOffset  = int(info[0][1])
        outOffset = int(info[0][2])
        size      = int(info[0][3])
        size_mb   = size / (1024 * 1024.0)
        warn_mb   = size_mb * warn / 100.0
        crit_mb   = size_mb * crit / 100.0
        # CRIT: too old
        now = int(time.time())
        age = now - mtime
        if age > alive_report:
            status = 2
            return (2, "Sylo not running (Hintfile too old: last update %d secs ago)" % age)
        # Current fill state
        if inOffset == outOffset:
            bytesUsed = 0
        elif inOffset > outOffset:
            bytesUsed = inOffset - outOffset
        elif inOffset < outOffset:
            bytesUsed = size - outOffset + inOffset
        percUsed = float(bytesUsed) / size * 100
        used_mb  = bytesUsed / (1024 * 1024.0)
        # Rates for input and output
        rate_output = ''
        rate_perfdata = [ ('in', 0.0), ('out', 0.0) ]
        in_rate  = get_rate("sylo.in",  mtime, inOffset)
        out_rate = get_rate("sylo.out", mtime, outOffset)
        rate_output = ', (in %.1f B/s, out %.1f B/s)' % (in_rate, out_rate)
        rate_pefdata = [ ('in', '%f' % in_rate ),
                         ('out', '%f' % out_rate ) ]
        msg += "Silo is filled %.1fMB (%.1f%%)%s" % \
             (bytesUsed / (1024*1024.0), percUsed, rate_output)
        # CRIT/WARN: Filled up
        status = 0
        if percUsed >= crit and status < 2:
            status = 2
        elif percUsed >= warn and status < 1:
            status = 1
        perfdata = rate_perfdata + [
            ('used', '%f' % used_mb, warn_mb, crit_mb, 0, size_mb)
        ]
        return (status, msg, perfdata)
    return (3, "Invalid hint file contents: " % info)
check_info["sylo"] = {
    'check_function':          check_sylo,
    'inventory_function':      inventory_sylo,
    'service_description':     'Sylo',
    'has_perfdata':            True,
}
 |