class AvogadroKeyUpDownAgent(AvogadroAgent): name = "KeyUpDown" minVal = 0.0 maxVal = 300.0 numBuckets = 284 resolution = max(0.001, (maxVal - minVal) / numBuckets) ENCODER_PARAMS = { name: { "name": name, "fieldname": name, "resolution": resolution, "seed": 42, "type": "RandomDistributedScalarEncoder" } } MODEL_PARAMS = getModelParams(ENCODER_PARAMS, name) def collect(self): inPath = os.path.dirname(os.path.realpath(__file__)) + "/keys.temp" if os.path.isfile(inPath): with open(inPath, "rb") as inputFile: csvreader = csv.reader(inputFile) for row in csvreader: data = float(row[2]) return data
class AvogadroMemoryAgent(AvogadroAgent): name = "MemoryPercent" minVal = 0.0 maxVal = 100.0 numBuckets = 284 resolution = max(0.001, (maxVal - minVal) / numBuckets) ENCODER_PARAMS = { name: { "name": name, "fieldname": name, "resolution": resolution, "seed": 42, "type": "RandomDistributedScalarEncoder" } } MODEL_PARAMS = getModelParams(ENCODER_PARAMS, name) def collect(self): return psutil.virtual_memory().percent
class AvogadroNetworkBytesReceivedAgent(AvogadroAgent): name = "NetworkBytesReceived" datasourceType = "DERIVE" minVal = 0 maxVal = 1000000 numBuckets = 284 resolution = max(0.001, (maxVal - minVal) / numBuckets) ENCODER_PARAMS = { name: { "name": name, "fieldname": name, "resolution": resolution, "seed": 42, "type": "RandomDistributedScalarEncoder" } } MODEL_PARAMS = getModelParams(ENCODER_PARAMS, name) def collect(self): return psutil.net_io_counters().bytes_recv
class AvogadroDiskWriteTimeAgent(AvogadroAgent): name = "DiskWriteTime" datasourceType = "DERIVE" minVal = 0 maxVal = 3000 numBuckets = 284 resolution = max(0.001, (maxVal - minVal) / numBuckets) ENCODER_PARAMS = { name: { "name": name, "fieldname": name, "resolution": resolution, "seed": 42, "type": "RandomDistributedScalarEncoder" } } MODEL_PARAMS = getModelParams(ENCODER_PARAMS, name) def collect(self): return psutil.disk_io_counters().write_time