Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additions to a10 check. #1

Open
asteriskie opened this issue Jun 15, 2015 · 0 comments
Open

Additions to a10 check. #1

asteriskie opened this issue Jun 15, 2015 · 0 comments

Comments

@asteriskie
Copy link

First things first, I had an issue with having the checks work with an extension. I removed the extension from a10_memory and a10_cpu then the checks worked fine.
I added a percentage to the output of the a10_memory (math is probably wrong)
diff NEW OLD
18,19d17
< prct_used = used_mb / total_mb * 100
<
40c38
< infotext = "%.1fMB%s of %.1fMB used (%.1f%% used)" % (used_mb, label, total_mb, prct_used)
---
> infotext = "%.1fMB%s of %.1fMB used" % (used_mb, label, total_mb)

then I wrote an a10_memory.py perfometer addon web/plugins/perfometer/a10_memory.py
Thought these additions might be of use to you or somebody else.

a10_memory.py

def perfometer_check_a10_memory(row, check_command, perf_data):
    used = float(perf_data[0][1])
    warn = float(perf_data[0][3])
    crit = float(perf_data[0][4])
    maxim= float(perf_data[0][6])

    usedp = used / maxim * 100
    warnp = warn / maxim * 100
    critp = crit / maxim * 100

    if usedp >= critp:
        color = "#ff0000"
    elif usedp >= warnp:
        color = "#ffff00"
    else:
        color = "#00ff00"

    return "%.0f%% " % usedp, perfometer_linear(usedp, color)

    #Uncomment to test columns.
    #used = float(perf_data[0][4])
    #color = "#00ff00"
    #return "%.0f%%" % used, perfometer_linear(used, color)

perfometers["check_mk-a10_memory"] = perfometer_check_a10_memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant