飞儿乐队 发表于 2018-5-11 16:38:33

LR开发接口脚本

char token_id,tenant_id;
    web_add_header("Accept","application/json");
    web_add_header("Content-Type","application/json");
    web_add_header("User-Agent","python-novaclient");

    web_reg_save_param("token_id",
      "LB=\"id\": \"",
      "RB=\", \"tenant\"",
      LAST);

    web_reg_save_param("tenant_id",
      "LB=\"id\": \"",
      "RB=\"",
      "Ord=2",
      LAST);

    web_custom_request("get_token_id",
      "URL=http://25.0.0.2:5000/v2.0/tokens",
      "Method=POST",
      "Resource=0",
      "Referer=",
      "Mode=HTTP",
      "Body={\"auth\": {\"tenantName\":\"luolijun\",\"passwordCredentials\":{\"username\":\"luolijun\",\"password\":\"test1234\"}}}",
      LAST);

    web_add_header("User-Agent","ceilometerclient.openstack.common.apiclient");
    web_add_header("X-Auth-Token","{token_id}");

    web_custom_request("select_cpu_id",
      "URL=http://25.0.0.2:8777/v2/meters/cpu_util?q.field=project_id&q.op=eq&q.type=&q.value={tenant_id}&limit=1",
      "Method=GET",
      "Resource=0",
      "Referer=",
      "Mode=HTTP",

qqq911 发表于 2018-5-28 10:42:04

感谢分享

Miss_love 发表于 2020-12-29 16:48:32

支持分享
页: [1]
查看完整版本: LR开发接口脚本