コード例 #1
0
ファイル: gui_preferences.py プロジェクト: jamesabel/mops
    def __init__(self):
        super(GUIPreferences, self).__init__()

        preferences = mops.preferences.MopsPreferences()

        layout = QGridLayout(self)

        end_point, password = preferences.get_redis_login()
        max_width = mops.util.str_max_width([end_point, password])
        self.endpoint_line_edit = QLineEdit(end_point)
        self.endpoint_line_edit.setMinimumWidth(max_width)
        self.password_line_edit = QLineEdit(password)
        self.password_line_edit.setMinimumWidth(max_width)
        layout.addWidget(QLabel('redis endpoint:', alignment=Qt.AlignRight), 0, 0)
        layout.addWidget(self.endpoint_line_edit, 0, 1)
        layout.addWidget(QLabel('redis password:'******''), 2, 0)
        layout.addWidget(QLabel("If you don't already have a redis database you can get one free at:"), 3, 1)
        get_redis_le = QLineEdit("www.redislabs.com")
        get_redis_le.setReadOnly(True)
        layout.addWidget(get_redis_le, 4, 1)

        buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        layout.addWidget(buttons, 5, 1)

        self.show()
コード例 #2
0
ファイル: app.py プロジェクト: jamesabel/mops
 def run(self):
     time.sleep(5)  # todo: implement an event in system_metrics that we can wait on until all system metrics filled in
     mops.logger.log.info('starting SystemUpdater: update_period: %s' % self.update_period)
     while not self.exit_event.is_set():
         mops.logger.log.info('SystemUpdater attempting DB update')
         preferences = mops.preferences.MopsPreferences()
         endpoint, password = preferences.get_redis_login()
         if endpoint and password:
             db = mops.server_db.ServerDB(endpoint, password)
             db.set(self.system_metrics.get_metrics())
         mops.logger.log.info('SystemUpdater waiting for %s seconds' % self.update_period)
         self.exit_event.wait(self.update_period)
     mops.logger.log.info('SystemUpdater leaving run()')
コード例 #3
0
 def run(self):
     time.sleep(
         5
     )  # todo: implement an event in system_metrics that we can wait on until all system metrics filled in
     mops.logger.log.info('starting SystemUpdater: update_period: %s' %
                          self.update_period)
     while not self.exit_event.is_set():
         mops.logger.log.info('SystemUpdater attempting DB update')
         preferences = mops.preferences.MopsPreferences()
         endpoint, password = preferences.get_redis_login()
         if endpoint and password:
             db = mops.server_db.ServerDB(endpoint, password)
             db.set(self.system_metrics.get_metrics())
         mops.logger.log.info('SystemUpdater waiting for %s seconds' %
                              self.update_period)
         self.exit_event.wait(self.update_period)
     mops.logger.log.info('SystemUpdater leaving run()')
コード例 #4
0
ファイル: app.py プロジェクト: jamesabel/mops
    def _systems(self):
        preferences = mops.preferences.MopsPreferences()
        endpoint, password = preferences.get_redis_login()
        systems = None

        if self.test_mode:
            # use this computer's metrics twice just for testing
            systems = self.system_metrics.get_metrics()
            computer_name = mops.system_metrics.get_computer_name()
            systems['system'][computer_name + '_a'] = systems['system'][computer_name].copy()
            systems['system'][computer_name + '_b'] = systems['system'][computer_name].copy()
        else:
            if endpoint and password:
                db = mops.server_db.ServerDB(endpoint, password)
                systems = db.get()
            else:
                mops.logger.log.warn('redis login not set')  # todo: pop up a GUI warning message

        if systems:
            g = mops.gui_systems.GUI(self.verbose)
            g.run(systems)
コード例 #5
0
    def _systems(self):
        preferences = mops.preferences.MopsPreferences()
        endpoint, password = preferences.get_redis_login()
        systems = None

        if self.test_mode:
            # use this computer's metrics twice just for testing
            systems = self.system_metrics.get_metrics()
            computer_name = mops.system_metrics.get_computer_name()
            systems['system'][computer_name +
                              '_a'] = systems['system'][computer_name].copy()
            systems['system'][computer_name +
                              '_b'] = systems['system'][computer_name].copy()
        else:
            if endpoint and password:
                db = mops.server_db.ServerDB(endpoint, password)
                systems = db.get()
            else:
                mops.logger.log.warn('redis login not set'
                                     )  # todo: pop up a GUI warning message

        if systems:
            g = mops.gui_systems.GUI(self.verbose)
            g.run(systems)