contype = resp.info()['Content-type']
    if (contype != "application/json"):
        if (verbose >= 2):
            print "Login may have failed"
        raise Exception("Response has wrong content-type: " + contype)

    data = json.loads(resp.read())

    # Avoid leaving open sessions
    req = Request(plugin.options.httphost + '/logout.cgi')
    resp = urlopen(req)

    # Collect performance data
    plugin.addPerformanceData('signal',
                              str(data['wireless']['signal']),
                              0,
                              min='-100',
                              max='0')
    plugin.addPerformanceData('signalchain0',
                              str((96 - data['wireless']['chainrssi'][0]) *
                                  -1),
                              1,
                              min='-100',
                              max='0')
    plugin.addPerformanceData('signalchain1',
                              str((96 - data['wireless']['chainrssi'][1]) *
                                  -1),
                              2,
                              min='-100',
                              max='0')
    plugin.addPerformanceData('noise',
Пример #2
0
	# Check content-type (last resort) before passing to JSON parser
	contype = resp.info()['Content-type']
	if (contype != "application/json"):
		if (verbose >= 2):
			print "Login may have failed"
		raise Exception("Response has wrong content-type: " + contype)

	data = json.loads(resp.read())

	# Avoid leaving open sessions
	req = Request(plugin.options.httphost + '/logout.cgi')
	resp = urlopen(req)

	# Collect performance data
	plugin.addPerformanceData ('signal', str (data['wireless']['signal']), 0, min='-100', max='0')
	plugin.addPerformanceData ('signalchain0', str ((96 - data['wireless']['chainrssi'][0]) * -1), 1, min='-100', max='0')
	plugin.addPerformanceData ('signalchain1', str ((96 - data['wireless']['chainrssi'][1]) * -1), 2, min='-100', max='0')
	plugin.addPerformanceData ('noise', str (data['wireless']['noisef']), 3, min='-100', max='0')
	plugin.addPerformanceData ('ccq', str (data['wireless']['ccq'] / 10), 4, UOM='%')
	plugin.addPerformanceData ('airmaxquality', str (data['wireless']['polling']['quality']), 5, UOM='%')
	plugin.addPerformanceData ('airmaxcapacity', str (data['wireless']['polling']['capacity']), 6, UOM='%')
	plugin.addPerformanceData ('txrate', data['wireless']['txrate'], 7, min='0', max='270')
	plugin.addPerformanceData ('rxrate', data['wireless']['rxrate'], 8, min='0', max='270')

 	# Check thresholds
	if (plugin.checkThreshold (data['wireless']['signal'], 0) != plugin.returnValues['OK']):
		plugin.returnString += " signal"
	if (plugin.checkThreshold ((96 - data['wireless']['chainrssi'][0]) * -1, 1) != plugin.returnValues['OK']):
		plugin.returnString += " signalchain0"
	if (plugin.checkThreshold ((96 - data['wireless']['chainrssi'][1]) * -1, 2) != plugin.returnValues['OK']):
Пример #3
0
        if verbose >= 2:
            print "Login may have failed"
        raise Exception("Response has wrong content-type: " + contype)

    data = json.loads(resp.read())
    data = DictDotLookup(data)

    # Avoid leaving open sessions
    req = Request(plugin.options.httphost + "/logout.cgi")
    resp = urlopen(req)

    # dactemp0/dactemp1 not available beyond fwversion v1.x
    temperature_data_available = True if (data.host.fwversion.find("v1.") == 0) else False

    # Collect performance data
    plugin.addPerformanceData("airfiber.rxpower0", str(data.airfiber.rxpower0), 0, min="-100", max="0")
    plugin.addPerformanceData("airfiber.rxpower1", str(data.airfiber.rxpower1), 1, min="-100", max="0")
    plugin.addPerformanceData("airfiber.rxcapacity", data.airfiber.rxcapacity, 2, min="0", max="750000000")
    plugin.addPerformanceData("airfiber.txcapacity", data.airfiber.txcapacity, 3, min="0", max="750000000")
    txmodrate = str(data.airfiber.txmodrate).rstrip("x")
    plugin.addPerformanceData("airfiber.txmodrate", txmodrate, 4, min="0", max="6")
    plugin.addPerformanceData("wireless.distance", data.wireless.distance, 5, min="100", max="15000")
    if temperature_data_available:
        plugin.addPerformanceData("airfiber.dactemp0", str(data.airfiber.dactemp0), 6, min="-50", max="65")
        plugin.addPerformanceData("airfiber.dactemp1", str(data.airfiber.dactemp1), 7, min="-50", max="65")
    gps_dop = float(data.gps.dop)
    gps_dop_qual = 0
    if gps_dop > 20:
        gps_dop_qual = 10
    elif gps_dop > 15:
        gps_dop_qual = 20
Пример #4
0
    if (contype != "application/json"):
        if (verbose >= 2):
            print "Login may have failed"
        raise Exception("Response has wrong content-type: " + contype)

    data = json.loads(resp.read())
    data = DictDotLookup(data)

    # Avoid leaving open sessions
    req = Request(plugin.options.httphost + '/logout.cgi')
    resp = urlopen(req)

    # Collect performance data
    plugin.addPerformanceData('airfiber.rxpower0',
                              str(data.airfiber.rxpower0),
                              0,
                              min='-100',
                              max='0')
    plugin.addPerformanceData('airfiber.rxpower1',
                              str(data.airfiber.rxpower1),
                              1,
                              min='-100',
                              max='0')
    plugin.addPerformanceData('airfiber.rxcapacity',
                              data.airfiber.rxcapacity,
                              2,
                              min='0',
                              max='750000000')
    plugin.addPerformanceData('airfiber.txcapacity',
                              data.airfiber.txcapacity,
                              3,