コード例 #1
0
    if (plugin.checkThreshold(data['wireless']['noisef'], 3) !=
            plugin.returnValues['OK']):
        plugin.returnString += " noise"
    if (plugin.checkThreshold(data['wireless']['ccq'] / 10, 4) !=
            plugin.returnValues['OK']):
        plugin.returnString += " ccq"
    if (plugin.checkThreshold(data['wireless']['polling']['quality'], 5) !=
            plugin.returnValues['OK']):
        plugin.returnString += " airmaxquality"
    if (plugin.checkThreshold(data['wireless']['polling']['capacity'], 6) !=
            plugin.returnValues['OK']):
        plugin.returnString += " airmaxcapacity"
    if (plugin.checkThreshold(data['wireless']['txrate'], 7) !=
            plugin.returnValues['OK']):
        plugin.returnString += " txrate"
    if (plugin.checkThreshold(data['wireless']['rxrate'], 8) !=
            plugin.returnValues['OK']):
        plugin.returnString += " rxrate"

# Output result
    plugin.finish()

except Exception, e:
    if (verbose >= 2):
        traceback.print_exc(e)
    plugin.returnValue = plugin.returnValues['UNKNOWN']
    plugin.returnString = str(e)

    # Output result
    plugin.finish()
コード例 #2
0
        plugin.returnString += " gps.sats"

        # Check booleans
    boolchecks = plugin.options.boolean.split(",")
    for boolcheck in boolchecks:
        if not len(boolcheck):
            continue
        boolcheckKeyVal = boolcheck.partition("=")
        if not len(boolcheckKeyVal[0]) or not len(boolcheckKeyVal[2]):
            continue
        try:
            boolcheckKeyVal_data = eval("data." + boolcheckKeyVal[0])
        except AttributeError:
            plugin.returnValue = plugin.returnValues["UNKNOWN"]
            plugin.returnString = boolcheckKeyVal[0]
            plugin.finish()
        if not str(boolcheckKeyVal_data) == boolcheckKeyVal[2]:
            plugin.returnValue = plugin.returnValues["CRITICAL"]
            plugin.returnString += " %s" % boolcheckKeyVal[0]
        plugin.addPerformanceData(boolcheckKeyVal[0], str(boolcheckKeyVal_data))

        # Output result
    plugin.finish()

except Exception, e:
    if verbose >= 2:
        traceback.print_exc(e)
    plugin.returnValue = plugin.returnValues["UNKNOWN"]
    plugin.returnString = str(e)

    # Output result