Exemple #1
0
 def setUp(self):
     config_file = os.environ.get('CIRCONUS_CONFIG')
     cfg = config.load_config(configfile=config_file, nocache=True)
     account = cfg.get('general', 'default_account')
     appname = cfg.get('general', 'appname')
     token = cfg.get('tokens', account)
     api = circonusapi.CirconusAPI(token)
     api.appname = appname
     self.config = cfg
     self.api = api
Exemple #2
0
def get_api():
    token = conf.get('tokens', options['account'], None)
    api = circonusapi.CirconusAPI(token)
    if options['debug']:
        api.debug = True
    return api
        if o == '-e':
            params['endpoint'] = a
        if o == '-f':
            params['filter'] = a

    # Rest of the command line args
    try:
        params['template'] = args[0]
    except IndexError:
        usage(params)
        sys.exit(1)
    params['vars'] = args[1:]

    # Now initialize the API
    api_token = c.get('tokens', account)
    api = circonusapi.CirconusAPI(api_token)

    if params['debug']:
        api.debug = True
        log.debug_enabled = True

    t = template.Template(params['template'])
    params['vars'] = t.parse_nv_params(params['vars'])
    results = run_query(params, api)
    to_add = []
    for r in results:
        merged_params = merge_params(params['vars'], r)
        processed = t.sub(merged_params)
        # Allow multiple resources per template by making the template into a
        # list
        if type(processed) == list:
 def __init__(self, token):
     self.token = token
     self.api = circonusapi.CirconusAPI(token)
Exemple #5
0
 def __init__(self, token):
     self._api = circonusapi.CirconusAPI(token)