Пример #1
0
 def __init__(self,
              api_key=None,
              app_id=None,
              release=None,
              version="",
              base_url="https://api.auklet.io/",
              monitoring=True):
     if release is None:
         raise AukletConfigurationError(
             "Must include release in Monitoring Creation")
     global except_hook_set
     sys.excepthook = self.handle_exc
     if not except_hook_set:
         # ensure not attempting to set threading excepthook more than once
         setup_thread_excepthook()
         except_hook_set = True
     self.auklet_dir = create_dir()
     self.version = version
     self.app_id = app_id
     self.mac_hash = get_mac()
     self.client = Client(api_key, app_id, release, base_url, self.mac_hash,
                          self.version, self.auklet_dir)
     self.emission_rate = update_data_limits(self.client)
     self.tree = MonitoringTree(self.mac_hash)
     self.broker = MQTTClient(self.client)
     self.monitor = monitoring
     signal.signal(self.sig, self.sample)
     signal.siginterrupt(self.sig, False)
     super(Monitoring, self).__init__()
Пример #2
0
 def setUp(self):
     with patch("auklet.monitoring.processing.Client._register_device",
                new=self.__register_device):
         self.broker_username = "******"
         self.broker_password = "******"
         self.client = Client(apikey="",
                              app_id="",
                              base_url="https://api-staging.auklet.io/")
         self.monitoring_tree = MonitoringTree()
 def setUp(self):
     with patch("auklet.monitoring.processing.Client._register_device",
                new=self.__register_device):
         self.client = Client(apikey="",
                              app_id="",
                              base_url="https://api-staging.auklet.io/")
         with patch('auklet.broker.MQTTClient._get_conf') as _get_conf:
             _get_conf.side_effect = self.get_conf
             self.broker = MQTTClient(self.client)
Пример #4
0
 def setUp(self):
     with patch("auklet.monitoring.processing.Client._register_device",
                new=self.__register_device):
         self.client = Client(
             api_key="",
             app_id="",
             base_url="https://api-staging.auklet.io/",
             auklet_dir=".auklet",
         )
Пример #5
0
 def setUp(self):
     with patch("auklet.monitoring.processing.Client._register_device",
                new=self.__register_device):
         self.client = Client(api_key="",
                              app_id="",
                              base_url="https://api-staging.auklet.io/",
                              auklet_dir=".auklet")
         with patch('auklet.broker.MQTTClient._get_conf') as _get_conf:
             with patch("os.path.isfile") as is_file_mock:
                 is_file_mock.return_value = False
                 _get_conf.side_effect = self.get_conf
                 self.broker = MQTTClient(self.client)
Пример #6
0
 def __init__(self, apikey=None, app_id=None,
              base_url="https://api.auklet.io/", monitoring=True):
     global except_hook_set
     sys.excepthook = self.handle_exc
     if not except_hook_set:
         # ensure not attempting to set threading excepthook more than once
         setup_thread_excepthook()
         except_hook_set = True
     self.app_id = app_id
     self.mac_hash = get_mac()
     self.client = Client(apikey, app_id, base_url, self.mac_hash)
     self.emission_rate = self.client.update_limits()
     self.tree = MonitoringTree(self.mac_hash)
     self.broker = MQTTClient(self.client)
     self.monitor = monitoring
     signal.signal(self.sig, self.sample)
     signal.siginterrupt(self.sig, False)
     super(Monitoring, self).__init__()