Exemple #1
0
 def _unix_confd_path(self):
     path = os.path.join(os.path.dirname(configuration.DEFAULT_CONFIG_FILE), 'conf.d')
     path2 = os.path.join(os.getcwd(), 'conf.d')
     if os.path.exists(path):
         return path
     elif os.path.exists(path2):
         return path2
     raise PathNotFound(path)
Exemple #2
0
    def _unix_checksd_path(self):
        # Unix only will look up based on the current directory
        # because checks_d will hang with the other python modules
        cur_path = os.path.dirname(os.path.realpath(__file__))
        checksd_path = os.path.join(cur_path, '../collector/checks_d')

        if os.path.exists(checksd_path):
            return checksd_path
        raise PathNotFound(checksd_path)
Exemple #3
0
    def _unix_confd_path(self):
        try:
            return configuration.Config().get_confd_path()
        except PathNotFound:
            pass

        path = os.path.join(os.getcwd(), 'conf.d')
        if os.path.exists(path):
            return path
        raise PathNotFound(path)
Exemple #4
0
    def _windows_checksd_path(self):
        if hasattr(sys, 'frozen'):
            # we're frozen - from py2exe
            prog_path = os.path.dirname(sys.executable)
            checksd_path = os.path.join(prog_path, '..', 'checks_d')
        else:
            cur_path = os.path.dirname(__file__)
            checksd_path = os.path.join(cur_path, '../collector/checks_d')

        if os.path.exists(checksd_path):
            return checksd_path
        raise PathNotFound(checksd_path)
Exemple #5
0
    def get_confd_path(self):
        bad_path = ''
        try:
            return self._unix_confd_path()
        except PathNotFound as e:
            if len(e.args) > 0:
                bad_path = e.args[0]

        cur_path = os.path.dirname(os.path.realpath(__file__))
        cur_path = os.path.join(cur_path, 'conf.d')

        if os.path.exists(cur_path):
            return cur_path

        raise PathNotFound(bad_path)
Exemple #6
0
 def get_confd_path(self):
     path = os.path.join(os.path.dirname(self._configFile), 'conf.d')
     if os.path.exists(path):
         return path
     raise PathNotFound(path)
Exemple #7
0
 def _windows_confd_path(self):
     common_data = self._windows_commondata_path()
     path = os.path.join(common_data, 'Datadog', 'conf.d')
     if os.path.exists(path):
         return path
     raise PathNotFound(path)