Exemplo n.º 1
0
def perfometer_vms_system_ios(row, check_command, perf_data):
    h = '<div class="stacked">'
    direct = float(perf_data[0][1])
    buffered = float(perf_data[1][1])
    h += perfometer_logarithmic(buffered, 10000, 3, "#38b0cf")
    h += perfometer_logarithmic(direct, 10000, 3, "#38808f")
    h += '</div>'
    return "%.0f / %.0f" % (direct, buffered), h  # perfometer_logarithmic(100, 200, 2, "#883875")
Exemplo n.º 2
0
def perfometer_check_http(row, check_command, perfdata):
    try:
        time_ms = float(perfdata[0][1]) * 1000.0
    except (IndexError, ValueError):
        time_ms = 0
    return "%.1f ms" % time_ms, \
        perfometer_logarithmic(time_ms, 1000, 10, "#66ccff")
Exemplo n.º 3
0
def perfometer_ipmi_sensors(row, check_command, perf_data):
    state = row["service_state"]
    color = "#39f"
    value = float(perf_data[0][1])
    crit = utils.savefloat(perf_data[0][4])
    if not crit:
        return "%d" % int(value), perfometer_logarithmic(value, 40, 1.2, color)

    perc = value * 100.0 / crit
    # some sensors get critical if the value is < crit (fans), some if > crit (temp)
    if value <= crit:
        data = [(perc, color), (100 - perc, get_themed_perfometer_bg_color())]
    elif state == 0:  # fan, OK
        m = max(value, 10000.0)
        perc_crit = crit * 100.0 / m
        perc_value = (value - crit) * 100.0 / m
        perc_free = (m - value) * 100.0 / m
        data = [(perc_crit, color), (perc_value, color),
                (perc_free, get_themed_perfometer_bg_color())]
    else:
        data = []

    if perf_data[0][0] == "temp":
        unit = "°C"
    else:
        unit = ""
    return (u"%d%s" % (int(value), unit)), render_perfometer(data)
Exemplo n.º 4
0
def perfometer_check_mk_uptime(row, check_command, perf_data):
    seconds = int(float(perf_data[0][1]))
    days, rest = divmod(seconds, 60 * 60 * 24)
    hours, rest = divmod(rest, 60 * 60)
    minutes, seconds = divmod(rest, 60)

    return "%02dd %02dh %02dm" % (days, hours, minutes), perfometer_logarithmic(
        seconds, 2592000.0, 2, '#80F000')
Exemplo n.º 5
0
def perfometer_check_http(row: Row, check_command: str,
                          perfdata: Perfdata) -> LegacyPerfometerResult:
    try:
        time_ms = float(perfdata[0][1]) * 1000.0
    except (IndexError, ValueError):
        time_ms = 0
    return "%.1f ms" % time_ms, perfometer_logarithmic(time_ms, 1000, 10,
                                                       "#66ccff")
Exemplo n.º 6
0
def perfometer_oracle_sessions(row, check_command, perf_data):
    if check_command != "check_mk-oracle_sessions":
        color = "#008f48"
        unit = ""
    else:
        color = "#4800ff"
        unit = "/h"
    value = int(perf_data[0][1])
    return "%d%s" % (value, unit), perfometer_logarithmic(value, 50, 2, color)
Exemplo n.º 7
0
def perfometer_mysql_capacity(row, check_command, perf_data):
    color = {0: "#68f", 1: "#ff2", 2: "#f22", 3: "#fa2"}[row["service_state"]]

    size = float(perf_data[0][1])
    # put the vertical middle at 40GB DB size, this makes small databases look small
    # and big ones big. raise every 18 months by Moore's law :)
    median = 40 * 1024 * 1024 * 1024

    return "%s" % number_human_readable(size), perfometer_logarithmic(size, median, 10, color)
Exemplo n.º 8
0
def perfometer_msx_queues(row, check_command, perf_data):
    length = int(perf_data[0][1])
    state = row["service_state"]
    if state == 1:
        color = "#ffd020"
    elif state == 2:
        color = "#ff2020"
    else:
        color = "#6090ff"
    return "%d" % length, perfometer_logarithmic(length, 100, 2, color)
Exemplo n.º 9
0
def perfometer_fileinfo(row, check_command, perf_data):
    h = '<div class="stacked">'
    texts = []
    for i, color, base, scale, verbfunc in [
        (0, "#ffcc50", 1000000, 10, lambda v: number_human_readable(v, precision=0)),  # size
        (1, "#ccff50", 3600, 10, cmk.utils.render.approx_age)
    ]:  # age
        val = float(perf_data[i][1])
        h += perfometer_logarithmic(val, base, scale, color)
        texts.append(verbfunc(val))
    h += '</div>'
    return " / ".join(texts), h  # perfometer_logarithmic(100, 200, 2, "#883875")
Exemplo n.º 10
0
def perfometer_fileinfo_groups(row, check_command, perf_data):
    h = '<div class="stacked">'
    texts = []
    for i, color, base, scale, verbfunc in [
        (2, "#aabb50", 10000, 10, lambda v: ("%d Tot") % v),  # count
        (1, "#ccff50", 3600, 10, cmk.utils.render.approx_age)
    ]:  # age_newest
        val = float(perf_data[i][1])
        h += perfometer_logarithmic(val, base, scale, color)
        texts.append(verbfunc(val))
    h += '</div>'
    return " / ".join(texts), h  # perfometer_logarithmic(100, 200, 2, "#883875")
Exemplo n.º 11
0
def perfometer_raritan_pdu_inlet(row, check_command, perf_data):
    display_color = "#50f020"
    cap = perf_data[0][0].split('-')[-1]
    value = float(perf_data[0][1])
    unit = perf_data[0][2]
    display_str = perf_data[0][1] + " " + unit
    if cap.startswith("rmsCurrent"):
        return display_str, perfometer_logarithmic(value, 1, 2, display_color)
    if cap.startswith("unbalancedCurrent"):
        return display_str, perfometer_linear(value, display_color)
    if cap.startswith("rmsVoltage"):
        return display_str, perfometer_logarithmic(value, 500, 2,
                                                   display_color)
    if cap.startswith("activePower"):
        return display_str, perfometer_logarithmic(value, 20, 2, display_color)
    if cap.startswith("apparentPower"):
        return display_str, perfometer_logarithmic(value, 20, 2, display_color)
    if cap.startswith("powerFactor"):
        return display_str, perfometer_linear(value * 100, display_color)
    if cap.startswith("activeEnergy"):
        return display_str, perfometer_logarithmic(value, 100000, 2,
                                                   display_color)
    if cap.startswith("apparentEnergy"):
        return display_str, perfometer_logarithmic(value, 100000, 2,
                                                   display_color)
    return "unimplemented", perfometer_linear(0,
                                              get_themed_perfometer_bg_color())
Exemplo n.º 12
0
def perfometer_fileinfo_groups(row, check_command, perf_data):
    # No files found in file group yields metrics('count', 'size')
    # Files found in file group yields metrics('count', 'size', 'size_largest', 'size_smallest',
    #                                          'age_oldest', 'age_newest')
    h = '<div class="stacked">'
    texts = []
    perfometer_values = {
        'count': ("#aabb50", 10000, 10, lambda v: ("%d Tot") % v),
        'age_newest': ("#ccff50", 3600, 10, cmk.utils.render.approx_age),
    }
    for name, value, _unit, _min, _max, _warn, _crit in perf_data:
        try:
            color, base, scale, verbfunc = perfometer_values[name]
        except KeyError:
            continue
        value = float(value)
        h += perfometer_logarithmic(value, base, scale, color)
        texts.append(verbfunc(value))
    h += '</div>'
    return " / ".join(
        texts), h  # perfometer_logarithmic(100, 200, 2, "#883875")
Exemplo n.º 13
0
def perfometer_check_oracle_dataguard_stats(row, check_command, perf_data):
    perfdata_found = False
    perfdata1 = ''

    for data in perf_data:
        if data[0] == "apply_lag":
            color = '#80F000'

            perfdata_found = True
            days, rest = divmod(int(data[1]), 60 * 60 * 24)
            hours, rest = divmod(rest, 60 * 60)
            minutes, _seconds = divmod(rest, 60)
            perfdata1 = data[1]

    if not perfdata_found:
        days = 0
        hours = 0
        minutes = 0
        color = "#008f48"

    return "%02dd %02dh %02dm" % (days, hours, minutes), perfometer_logarithmic(
        perfdata1, 2592000, 2, color)
Exemplo n.º 14
0
def perfometer_apc_mod_pdu_modules(row, check_command, perf_data):
    value = int(utils.savefloat(perf_data[0][1]) * 100)
    return "%skw" % perf_data[0][1], perfometer_logarithmic(
        value, 500, 2, "#3366CC")
Exemplo n.º 15
0
def perfometer_voltage(row, check_command, perf_data):
    color = "#808000"
    value = float(perf_data[0][1])
    return "%0.3f V" % value, perfometer_logarithmic(value, 12, 2, color)
Exemplo n.º 16
0
def perfometer_printer_pages(row, check_command, perf_data):
    color = "#909090"
    return "%d" % int(perf_data[0][1]), perfometer_logarithmic(
        perf_data[0][1], 50000, 6, color)
Exemplo n.º 17
0
def perfometer_check_mk_iops(row, check_command, perf_data):
    iops = int(perf_data[0][1])
    text = "%d/s" % iops

    return text, perfometer_logarithmic(iops, 100000, 2, "#30d050")
Exemplo n.º 18
0
def perfometer_dbmv(row, check_command, perf_data):
    dbmv = float(perf_data[0][1])
    return "%.1f dBmV" % dbmv, perfometer_logarithmic(dbmv, 50, 2, "#da6")
Exemplo n.º 19
0
def perfometer_blower(row, check_command, perf_data):
    rpm = int(perf_data[0][1])
    return "%d RPM" % rpm, perfometer_logarithmic(rpm, 2000, 1.5, "#88c")
Exemplo n.º 20
0
def perfometer_f5_bigip_vserver(row, check_command, perf_data):
    connections = int(perf_data[0][1])
    return str(connections), perfometer_logarithmic(connections, 100, 2,
                                                    "#46a")
Exemplo n.º 21
0
def perfometer_check_mk_vms_system_procs(row, check_command, perf_data):
    color = {0: "#a4f", 1: "#ff2", 2: "#f22", 3: "#fa2"}[row["service_state"]]
    return "%d" % int(perf_data[0][1]), perfometer_logarithmic(
        perf_data[0][1], 100, 2, color)
Exemplo n.º 22
0
def perfometer_genu_screen(row, command, perf):
    value = int(perf[0][1])
    return "%d Sessions" % value, perfometer_logarithmic(
        value, 5000, 2, "#7109AA")
Exemplo n.º 23
0
def perfometer_cmc_lcp(row, check_command, perf_data):
    color = {0: "#68f", 1: "#ff2", 2: "#f22", 3: "#fa2"}[row["service_state"]]
    val = float(perf_data[0][1])
    unit = str(perf_data[0][0])
    return "%.1f %s" % (val, unit), perfometer_logarithmic(val, 4, 2, color)
Exemplo n.º 24
0
def perfometer_fanspeed_logarithmic(row, check_command, perf_data):
    value = float(perf_data[0][1])
    return "%d rpm" % value, perfometer_logarithmic(value, 5000, 2, "silver")
Exemplo n.º 25
0
def perfometer_vmguest_mem_usage(row, command, perf):
    used = float(perf[0][1])
    return number_human_readable(used), perfometer_logarithmic(
        used, 1024 * 1024 * 2000, 2, "#20cf80")
Exemplo n.º 26
0
def perfometer_temperature(row, check_command, perf_data):
    color = "#39f"
    value = float(perf_data[0][1])
    return u"%d °C" % int(value), perfometer_logarithmic(value, 40, 1.2, color)
Exemplo n.º 27
0
def perfometer_airflow_ls(row, check_command, perf_data):
    value = int(float(perf_data[0][1]) * 100)
    return "%sl/s" % perf_data[0][1], perfometer_logarithmic(
        value, 1000, 2, '#3366cc')
Exemplo n.º 28
0
def perfometer_power_simple(row, check_command, perf_data):
    watt = int(perf_data[0][1])
    text = "%s Watt" % watt
    return text, perfometer_logarithmic(watt, 150, 2, "#60f020")
Exemplo n.º 29
0
def perfometer_check_mk_arcserve_backup(row, check_command, perf_data):
    bytes_ = int(perf_data[2][1])
    text = number_human_readable(bytes_)

    return text, perfometer_logarithmic(bytes_, 1000 * 1024 * 1024 * 1024, 2,
                                        "#BDC6DE")
Exemplo n.º 30
0
def perfometer_users(row, check_command, perf_data):
    color = "#39f"
    value = float(perf_data[0][1])
    return u"%d users" % int(value), perfometer_logarithmic(
        value, 50, 2, color)