def values(): devicelist = dict( diskIOTable=NewdiskIOTable, diskIOIndex=diskIOIndex, diskIOEntry=diskIOEntry, diskIODevice=diskIODevice, diskIONRead=diskIONRead, diskIONWritten=diskIONWritten, diskIOReads=diskIOReads, diskIOWrites=diskIOWrites #diskIONReadX = diskIONReadX, #diskIONWrittenX = diskIONWrittenX ) fp = open('/proc/diskstats') diskstats = fp.readlines() fp.close() for index in range(len(diskstats)): values = diskstats[index].split() is_partition = len(values) == 7 devicelist['diskIOIndex' + str(index)] = MibScalarInstance( diskIOIndex.getName(), (int(index) + 1, ), diskIOIndex.getSyntax().clone(int(index) + 1)) devicelist['diskIODevice' + str(index)] = MibScalarInstance( diskIODevice.getName(), (int(index) + 1, ), diskIODevice.getSyntax().clone(values[2])) devicelist['diskIONRead' + str(index)] = MibScalarInstance( diskIONRead.getName(), (int(index) + 1, ), validate(Counter32(), int(values[5]) * 512)) devicelist['diskIONWritten' + str(index)] = MibScalarInstance( diskIONWritten.getName(), (int(index) + 1, ), validate(Counter32(), int(values[9]) * 512 if not is_partition else 0)) devicelist['diskIOReads' + str(index)] = MibScalarInstance( diskIOReads.getName(), (int(index) + 1, ), validate(Counter32(), values[3])) devicelist['diskIOWrites' + str(index)] = MibScalarInstance( diskIOWrites.getName(), (int(index) + 1, ), validate(Counter32(), values[7] if not is_partition else 0)) #devicelist['diskIONReadX' + str(index)] = MibScalarInstance(diskIONReadX.getName(), (int(index)+1,), validate(Counter64(), int(values[5])*512)) #devicelist['diskIONWrittenX' + str(index)] = MibScalarInstance(diskIONWrittenX.getName(), (int(index)+1,), validate(Counter64(), int(values[9])*512)) return devicelist
def values(): devicelist = dict( diskIOTable=NewdiskIOTable, diskIOIndex=diskIOIndex, diskIOEntry=diskIOEntry, diskIODevice=diskIODevice, diskIONRead=diskIONRead, diskIONWritten=diskIONWritten, diskIOReads=diskIOReads, diskIOWrites=diskIOWrites # diskIONReadX = diskIONReadX, # diskIONWrittenX = diskIONWrittenX ) fp = open("/proc/diskstats") diskstats = fp.readlines() fp.close() for index in range(len(diskstats)): values = diskstats[index].split() is_partition = len(values) == 7 devicelist["diskIOIndex" + str(index)] = MibScalarInstance( diskIOIndex.getName(), (int(index) + 1,), diskIOIndex.getSyntax().clone(int(index) + 1) ) devicelist["diskIODevice" + str(index)] = MibScalarInstance( diskIODevice.getName(), (int(index) + 1,), diskIODevice.getSyntax().clone(values[2]) ) devicelist["diskIONRead" + str(index)] = MibScalarInstance( diskIONRead.getName(), (int(index) + 1,), validate(Counter32(), int(values[5]) * 512) ) devicelist["diskIONWritten" + str(index)] = MibScalarInstance( diskIONWritten.getName(), (int(index) + 1,), validate(Counter32(), int(values[9]) * 512 if not is_partition else 0), ) devicelist["diskIOReads" + str(index)] = MibScalarInstance( diskIOReads.getName(), (int(index) + 1,), validate(Counter32(), values[3]) ) devicelist["diskIOWrites" + str(index)] = MibScalarInstance( diskIOWrites.getName(), (int(index) + 1,), validate(Counter32(), values[7] if not is_partition else 0) ) # devicelist['diskIONReadX' + str(index)] = MibScalarInstance(diskIONReadX.getName(), (int(index)+1,), validate(Counter64(), int(values[5])*512)) # devicelist['diskIONWrittenX' + str(index)] = MibScalarInstance(diskIONWrittenX.getName(), (int(index)+1,), validate(Counter64(), int(values[9])*512)) return devicelist
def clone(self): if self.iface != None and self.direction != None: file = open("/proc/net/dev", "r") list = file.readlines() file.close() for row in list: row = re.sub(":", " ", row) if re.match("^\s+" + self.iface, row): values = row.split() return validate(Counter32(), values[directions[self.direction]])
def clone(self): if self.iface != None and self.direction != None: file = open('/proc/net/dev', "r") list = file.readlines() file.close() for row in list: row = re.sub(':', ' ', row) if re.match('^\s+' + self.iface, row): values = row.split() return validate(Counter32(), values[directions[self.direction]])
def clone(self, **kwargs): if kwargs.get('value') is None: kwargs['value'] = validate(Integer32(), _get_memory_value('SwapTotal'), False) return apply(Integer32.clone, [self], kwargs)
def clone(self, **kwargs): if kwargs.get('value') is None: kwargs['value'] = validate(Counter32(), _get_cpu_value('system'), False) return apply(Counter32.clone, [self], kwargs)
def clone(self, **kwargs): if kwargs.get('value') is None: kwargs['value'] = validate(Integer32(), _get_memory_value('^Cached:'), False) return apply(Integer32.clone, [self], kwargs)