def __init__(self): Monitor.__init__(self, Constants.CPU_PERCENT_MONITOR) logger.info("Initializing CPU % Usage Monitor") self._minimum = 0.0 self._maximum = 100 logger.info("Minimum: {}, Current: {}, Maximum: {} ".format( self._minimum, self.poll(), self._maximum))
def __init__(self): Monitor.__init__(self, Constants.BYTES_RECEIVED_MONITOR) logger.info("Initializing Bytes Received Monitor") self._casual_name = "Network Received Monitor" self._minimum = 0.0 self._maximum = sys.maxsize logger.info("Minimum: {}, Current: {}, Maximum: {} ".format(self._minimum, self.poll(), self._maximum))
def __init__(self): Monitor.__init__(self, Constants.SWAP_BYTE_MONITOR) logger.info("Initializing Swap MB Usage Monitor") memory_object = psutil.swap_memory() self._minimum = 0.0 self._maximum = memory_object.total logging.info("Minimum: {}, Current: {}, Maximum: {} ".format(self._minimum, self.poll(), self._maximum))
def __init__(self): Monitor.__init__(self, Constants.BYTES_RECEIVED_MONITOR) logger.info("Initializing Bytes Received Monitor") self._casual_name = "Network Received Monitor" self._minimum = 0.0 self._maximum = sys.maxsize logger.info("Minimum: {}, Current: {}, Maximum: {} ".format( self._minimum, self.poll(), self._maximum))
def __init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name): Monitor.__init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name) zhixinDelay_conf = parse_conf("./zhixinDelay.conf") self.hostname_list = [] for item in zhixinDelay_conf: if(item['status'] == 1): self.hostname_list.append(item['hostname']) logging.info(self.hostname_list)
def __init__(self, drive_root): Monitor.__init__(self, "{0} {1}".format(Constants.STORAGE_BYTE_MONITOR, str(drive_root))) logger.info("Initializing Storage Byte Monitor") self._drive_root = drive_root self._minimum = 0.0 storage_object = psutil.disk_usage(self._drive_root) self._maximum = float(storage_object.total) logger.info("Minimum: {}, Current: {}, Maximum: {} ".format(self._minimum, self.poll(), self._maximum))
def __init__(self): Monitor.__init__(self, Constants.RAM_BYTE_MONITOR) logger.info("Initializing RAM MB Usage Monitor") memory_object = psutil.virtual_memory() self._minimum = 0.0 self._maximum = memory_object.total logger.info("Minimum: {}, Current: {}, Maximum: {} ".format( self._minimum, self.poll(), self._maximum))
def __init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name): Monitor.__init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name) now_time = datetime.datetime.now() self.timeStamp=now_time.strftime('%Y-%m-%d-%H%M%S') self.dataList=list() self.dataDictTemp=dict() self.accountInfo =list() self.resList=list() self.finalresult=dict()
def __init__(self, *args, **kwargs): Monitor.__init__(self, *args, **kwargs) if HOSTNAME == "top-pi": self.sensor_group = 0 elif HOSTNAME == "mid-pi": self.sensor_group = 1 elif HOSTNAME == "bottom-pi": self.sensor_group = 2 else: raise ValueError('unknown host')
def __init__(self, drive_root): Monitor.__init__( self, "{0} {1}".format(Constants.STORAGE_BYTE_MONITOR, str(drive_root))) logger.info("Initializing Storage Byte Monitor") self._drive_root = drive_root self._minimum = 0.0 storage_object = psutil.disk_usage(self._drive_root) self._maximum = float(storage_object.total) logger.info("Minimum: {}, Current: {}, Maximum: {} ".format( self._minimum, self.poll(), self._maximum))
def __init__(self, channels, channel_names, conversion=None): Monitor.__init__(self, channels, channel_names) # Not sure what these two lines do ... self.task = None self.task_in_stream = None self.reader = None # Are we making a conversion from voltage to some other unit here? self.convert = isinstance(conversion, type({})) # print "NIDAQ self.convert = {}".format(self.convert) # print "NIDAQ conversions = {}".format(conversion) # If so let's make sure the conversion dictionary is going to work err_type = "Error: Conversion should have lambda function at lowest level" if self.convert: err_shp = "Error: Conversion should have the same shape as channels" ch1 = self.channels.keys() ch2 = conversion.keys() assert set(ch1) == set(ch2), err_shp if self.many_channels: for key, value in self.channels.iteritems(): ch3 = value.keys() assert isinstance(conversion[key], type({})), err_shp ch4 = conversion[key].keys() assert set(ch3) == set(ch4), err_shp for key, value in conversion.iteritems(): for func in value.values(): assert isinstance(func, type(lambda x: x + 1)), err_type else: for key, value in conversion.iteritems(): assert isinstance(value, type(lambda x: x + 1)), err_type self.conversion = conversion # List the analog in channels we will be monitoring on the DAQ if self.many_channels: # For Issue self.channels_to_open = [] print self.channels.values() for channel in self.channels.values(): # make a list of all unique channels being opened self.channels_to_open = list( set(self.channels_to_open) | set(channel.values())) else: self.channels_to_open = channels.values() self.channels_to_open.sort() print self.channels_to_open self.mychans = self.channel_string() # initialize data location self.data = numpy.zeros(len(self.channels_to_open)) self.prepare_task()
def __init__(self): Monitor.__init__(self) #make a brand new black (empty) matrix self.matrix = [] for pixelOffY in range(self.config['STRIPES_NO'] * self.config['STRIPES_BLOCKS']): self.matrix.append([]) for pixelOffX in range(self.config['LED_COUNT_PER_STRIPE']): self.matrix[pixelOffY].append( Pixel(pixelOffX * scale, pixelOffY * scale, (000, 000, 000)))
def __init__(self, channels, channel_names, mains=60, tc_type='k', dll_path=""): """ Initialize and start up the Picos unit :param channels: :param mains: :param tc_type: :param dll_path: """ Mon.__init__(self, channels, channel_names) self.mains = mains self.tc_type = tc_type dll_filename = os.path.join(dll_path, 'usbtc08.dll') self._dll = ctypes.windll.LoadLibrary(dll_filename) self._handle = None # handle for device self._temp = np.zeros((9, ), dtype=np.float32) self._overflow_flags = np.zeros((1, ), dtype=np.int16) self._units = self.TC_UNITS['CENTIGRADE'] if self.many_channels: self.channels_to_open = [] for channel in self.channels.values(): for stream in channel: if stream not in self.channels_to_open: self.channels_to_open.append(stream) else: self.channels_to_open = channels.values() self.status = self.start_unit()
def __init__(self, *args, **kwargs): Monitor.__init__(self, *args, **kwargs) self.port = '/dev/ttyUSB0' # stty settings self.stty = "5:0:8be:0:0:0:0:0:0:a" + ":0" * 26
def __init__(self, channels, channel_names): Mon.__init__(self, channels, channel_names)
def __init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name): Monitor.__init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name) self.dataList = list() self.warnList = list()
def __init__(self): Monitor.__init__(self, Constants.CPU_PERCENT_MONITOR) logger.info("Initializing CPU % Usage Monitor") self._minimum = 0.0 self._maximum = 100 logger.info("Minimum: {}, Current: {}, Maximum: {} ".format(self._minimum, self.poll(), self._maximum))
def __init__(self, *args, **kwargs): Monitor.__init__(self, *args, **kwargs)
def __init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name): Monitor.__init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name) now_time = datetime.datetime.now() self.dataList=list() self.accountInfo =list()
def __init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name): Monitor.__init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name) self.account = list() self.dataList = list() self.dataListTemp = list() self.resList = list()
def __init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name): Monitor.__init__(self, log_file, last_id, monitorObj_id, monitorMetrics_id, monitorMetrics_name) self.TSMInterface_conf = parse_conf("./TSMInterface.conf")
def __init__(self, *args, **kwargs): Monitor.__init__(self, *args, **kwargs) # open tcp connection self.connection = None self.tcp_socket = None