Skip to content

Instantly share code, notes, and snippets.

@boris-42
Last active August 29, 2015 14:03
Show Gist options
  • Save boris-42/7a0eb24ee4ce6fbca6e9 to your computer and use it in GitHub Desktop.
Save boris-42/7a0eb24ee4ce6fbca6e9 to your computer and use it in GitHub Desktop.
Test a Keystone profiling stuff
from osprofiler import profiler
from osprofiler.parsers import ceilometer as ceilo_parser
from keystoneclient.v2_0 import client as keystone
from ceilometerclient import client as ceilometer
#CREDENTIALS
auth_url = "http://172.16.52.152:5000/v2.0"
username = "admin"
tenant_name = "admin"
password = "admin"
#GET CEILOMETER CLIENT
kc = keystone.Client(auth_url=auth_url, username=username, password=password, tenant_name=tenant_name)
endpoint = kc.service_catalog.get_endpoints()['metering'][0]
auth_token = lambda: kc.auth_token
ceil = ceilometer.Client("2", endpoint=endpoint["publicURL"], token=auth_token)
profiler.init("SECRET_KEY")
user = kc.users.create("name", "pwd", "email@example.com")
user.delete()
result = ceilo_parser.get_notifications(ceil, profiler.get().get_base_id())
print(ceilo_parser.parse_notifications(result))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment