Пример #1
0
#!/usr/bin/env python

import requests
import json
import auth

URL, HEADERS = auth.plugin("cinderv2")

response = requests.get(URL + '/volumes/detail?all_tenants=1', headers=HEADERS, verify=False)

data = json.loads(response.text)

t = [["id", "name", "size", "status", "type", "zone", "bootable", "cg", "description", "encrypted", "multiattach", "os_host", "user_id", "tenant_id", "created_at", "updated_at"]]

for volume in data['volumes']:
    t.append([
        volume['id'],
        volume['name'],
        volume['size'],
        volume['status'],
        volume['volume_type'],
        volume['availability_zone'],
        volume['bootable'],
        volume['consistencygroup_id'],
        volume['description'],
        volume['encrypted'],
        volume['multiattach'],
        volume['os-vol-host-attr:host'],
        volume['user_id'],
        volume['os-vol-tenant-attr:tenant_id'],
        volume['created_at'],
Пример #2
0
#!/usr/bin/env python

import requests
import json
import auth

URL, HEADERS = auth.plugin("keystone")

response = requests.get(URL + '/projects', headers=HEADERS, verify=False)

t = [["id", "name", "description", "enabled", "domain_id", "parent_id"]]

data = json.loads(response.text)

for project in data['projects']:
    t.append([
        project['id'],
        project['name'],
        project['description'],
        project['enabled'],
        project['domain_id'],
        project['parent_id']
    ])

for line in t:
    print("{0};{1};{2};{3};{4};{5}".format(line[0], line[1], line[2], line[3], line[4], line[5]))
Пример #3
0
#!/usr/bin/env python

import requests
import json
import auth
import telemetry

URL, HEADERS = auth.plugin("nova")

a = telemetry.nova_plugin("fee49497-f699-4e91-b073-74bf758e3dec",HEADERS)

print(json.dumps(a, sort_keys=True, indent=4, separators=(',', ': ')))
Пример #4
0
#!/usr/bin/env python

import requests
import json
import auth
import datetime

URL, HEADERS = auth.plugin("ceilometer")

timestamp = str(datetime.datetime.now() - datetime.timedelta(hours=1))

data = "{\"filter\": \"{\\\">\\\":{\\\"timestamp\\\":\\\"" + timestamp + \
       "\\\"}}\", \"orderby\": \"[{\\\"timestamp\\\": \\\"DESC\\\"}]\", \"limit\": 100000}"

response = requests.post(URL + '/v2/query/samples', data=data, headers=HEADERS, verify=False)

t = [["id",
      "metadata",
      "meter",
      "project_id",
      "recorded_at",
      "resource_id",
      "source",
      "timestamp",
      "type",
      "unit",
      "user_id",
      "volume"
    ]]

for line in json.loads(response.text):