Ejemplo n.º 1
0
    def __init__(self):
        auklet_config = settings.AUKLET_CONFIG
        self.apikey = auklet_config.get("api_key", None)
        self.app_id = auklet_config.get("application", None)
        self.release = auklet_config.get("release", None)
        self.version = auklet_config.get("version", None)
        self.org_id = auklet_config.get("organization", None)
        self.broker_url = auklet_config.get("broker", "mq.feeds.auklet.io")
        self.port = auklet_config.get("port", 8883)
        self.base_url = auklet_config.get("base_url", "https://api.auklet.io/")

        if self.apikey is None:
            raise AukletConfigurationError(
                "Please set api_key in AUKLET_CONFIG settings")
        if self.app_id is None:
            raise AukletConfigurationError(
                "Please set application in AUKLET_CONFIG settings")
        if self.org_id is None:
            raise AukletConfigurationError(
                "Please set organization in AUKLET_CONFIG settings")
        self.auklet_dir = create_dir()
        self.mac_hash = get_mac()
        self.device_ip = get_device_ip()
        self.agent_version = get_agent_version()
        self.broker = MQTTClient(self.broker_url, self.port, self.app_id,
                                 self.org_id, self.apikey, self.base_url,
                                 self.auklet_dir)
        self.broker._get_certs()
        self.file_cache = FilenameCaches()
Ejemplo n.º 2
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__()
Ejemplo n.º 3
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__()