Openstack CloudKitty 计量计费命令行操作

Openstack CloudKitty 计量计费命令行操作

case1

创建云主机服务instance_test, 并对其创建名为flavor_name的fields,并设置规格为t3.large 的云主机单价为1元。

[root@control1 ~]# openstack rating hashmap service create instance_test
+---------------+--------------------------------------+
| Name          | Service ID                           |
+---------------+--------------------------------------+
| instance_test | 634d2249-ef3e-4bbf-b15a-56403e77d3da |
+---------------+--------------------------------------+

[root@control1 ~]# openstack rating hashmap field create 634d2249-ef3e-4bbf-b15a-56403e77d3da flavor_name

+-------------+--------------------------------------+--------------------------------------+
| Name        | Field ID                             | Service ID                           |
+-------------+--------------------------------------+--------------------------------------+
| flavor_name | e96c8b3e-183b-4308-bfbc-e3cf4123779c | 634d2249-ef3e-4bbf-b15a-56403e77d3da |
+-------------+--------------------------------------+--------------------------------------+

[root@control1 ~]# openstack rating hashmap mapping create  --field-id e96c8b3e-183b-4308-bfbc-e3cf4123779c  -t flat --value  t3.large 1
+--------------------------------------+----------+------------+------+--------------------------------------+------------+----------+------------+
| Mapping ID                           | Value    | Cost       | Type | Field ID                             | Service ID | Group ID | Project ID |
+--------------------------------------+----------+------------+------+--------------------------------------+------------+----------+------------+
| b1b2eedd-a5c9-4866-8721-c2b118d70c0a | t3.large | 1.00000000 | flat | e96c8b3e-183b-4308-bfbc-e3cf4123779c | None       | None     | None       |
+--------------------------------------+----------+------------+------+--------------------------------------+------------+----------+------------+

case2

创建镜像服务(可命名为image_size_test),并为该服置单价为0.8元

[root@control1 ~]# openstack rating hashmap service create image_size_test
+-----------------+--------------------------------------+
| Name            | Service ID                           |
+-----------------+--------------------------------------+
| image_size_test | 28163728-68a6-4122-8e49-b85b962fcd01 |
+-----------------+--------------------------------------+

[root@control1 ~]# openstack rating hashmap mapping create -s  28163728-68a6-4122-8e49-b85b962fcd01  -t flat 0.8
+--------------------------------------+-------+------------+------+----------+--------------------------------------+----------+------------+
| Mapping ID                           | Value | Cost       | Type | Field ID | Service ID                           | Group ID | Project ID |
+--------------------------------------+-------+------------+------+----------+--------------------------------------+----------+------------+
| 3eef6bca-005e-486b-acfa-615cf8a49417 | None  | 0.80000000 | flat | None     | 28163728-68a6-4122-8e49-b85b962fcd01 | None     | None       |
+--------------------------------------+-------+------------+------+----------+--------------------------------------+----------+------------+

case3

创建名为abc_tests的服务,并为该服务设置单价为0.8元,并为该服务设置当使用量超过10000时,8折优惠

[root@control1 ~]# openstack rating hashmap service create abc_tests
+-----------+--------------------------------------+
| Name      | Service ID                           |
+-----------+--------------------------------------+
| abc_tests | f34087b2-ac1c-45b0-83f9-50c68771311c |
+-----------+--------------------------------------+

[root@control1 ~]# openstack rating hashmap mapping create -s  f34087b2-ac1c-45b0-83f9-50c68771311c  -t flat 0.8
+--------------------------------------+-------+------------+------+----------+--------------------------------------+----------+------------+
| Mapping ID                           | Value | Cost       | Type | Field ID | Service ID                           | Group ID | Project ID |
+--------------------------------------+-------+------------+------+----------+--------------------------------------+----------+------------+
| c8101b71-7bae-4570-a6f1-3c4972bd6ae4 | None  | 0.80000000 | flat | None     | f34087b2-ac1c-45b0-83f9-50c68771311c | None     | None       |
+--------------------------------------+-------+------------+------+----------+--------------------------------------+----------+------------+

[root@control1 ~]# openstack rating hashmap threshold create -s f34087b2-ac1c-45b0-83f9-50c68771311c -t rate 10000 0.8
+--------------------------------------+----------------+------------+------+----------+--------------------------------------+----------+------------+
| Threshold ID                         | Level          | Cost       | Type | Field ID | Service ID                           | Group ID | Project ID |
+--------------------------------------+----------------+------------+------+----------+--------------------------------------+----------+------------+
| 95d5fda5-d93d-4f22-b044-4fb7e09af566 | 10000.00000000 | 0.80000000 | rate | None     | f34087b2-ac1c-45b0-83f9-50c68771311c | None     | None       |
+--------------------------------------+----------------+------------+------+----------+--------------------------------------+----------+------------+

case4

case3的基础上设置其abc_type字段为aaa类型时8折优惠

[root@control1 ~]# openstack rating hashmap field create  f34087b2-ac1c-45b0-83f9-50c68771311c abc_tyep
+----------+--------------------------------------+--------------------------------------+
| Name     | Field ID                             | Service ID                           |
+----------+--------------------------------------+--------------------------------------+
| abc_tyep | 0b86249c-4ed2-4e80-87e9-275a8a905e12 | f34087b2-ac1c-45b0-83f9-50c68771311c |
+----------+--------------------------------------+--------------------------------------+

[root@control1 ~]# openstack rating hashmap mapping create --field-id  0b86249c-4ed2-4e80-87e9-275a8a905e12  --value aaa  -t rate 0.8
+--------------------------------------+-------+------------+------+--------------------------------------+------------+----------+------------+
| Mapping ID                           | Value | Cost       | Type | Field ID                             | Service ID | Group ID | Project ID |
+--------------------------------------+-------+------------+------+--------------------------------------+------------+----------+------------+
| 02286031-6294-413c-bf2b-6399427beb5e | aaa   | 0.80000000 | rate | 0b86249c-4ed2-4e80-87e9-275a8a905e12 | None       | None     | None       |
+--------------------------------------+-------+------------+------+--------------------------------------+------------+----------+------------+

case5

case3的基础上设置其abc_another_usage字段分别超过10,100,1000时单价增加0.1,0.2,0.3元

[root@control1 ~]# openstack rating hashmap field create  f34087b2-ac1c-45b0-83f9-50c68771311c abc_another_usage
+-------------------+--------------------------------------+--------------------------------------+
| Name              | Field ID                             | Service ID                           |
+-------------------+--------------------------------------+--------------------------------------+
| abc_another_usage | 6ea4513b-4c57-48d4-8555-abef0f29e03c | f34087b2-ac1c-45b0-83f9-50c68771311c |
+-------------------+--------------------------------------+--------------------------------------+

[root@control1 ~]# openstack rating hashmap threshold create --field-id 6ea4513b-4c57-48d4-8555-abef0f29e03c  -t flat  10 0.1
+--------------------------------------+-------------+------------+------+--------------------------------------+------------+----------+------------+
| Threshold ID                         | Level       | Cost       | Type | Field ID                             | Service ID | Group ID | Project ID |
+--------------------------------------+-------------+------------+------+--------------------------------------+------------+----------+------------+
| 2da5e7a4-34e9-49a8-968e-fe864e4bc95b | 10.00000000 | 0.10000000 | flat | 6ea4513b-4c57-48d4-8555-abef0f29e03c | None       | None     | None       |
+--------------------------------------+-------------+------------+------+--------------------------------------+------------+----------+------------+

[root@control1 ~]# openstack rating hashmap threshold create --field-id 6ea4513b-4c57-48d4-8555-abef0f29e03c  -t flat  100 0.2
+--------------------------------------+--------------+------------+------+--------------------------------------+------------+----------+------------+
| Threshold ID                         | Level        | Cost       | Type | Field ID                             | Service ID | Group ID | Project ID |
+--------------------------------------+--------------+------------+------+--------------------------------------+------------+----------+------------+
| 907f8074-7311-4440-9422-f5b03f3c2010 | 100.00000000 | 0.20000000 | flat | 6ea4513b-4c57-48d4-8555-abef0f29e03c | None       | None     | None       |
+--------------------------------------+--------------+------------+------+--------------------------------------+------------+----------+------------+

[root@control1 ~]# openstack rating hashmap threshold create --field-id 6ea4513b-4c57-48d4-8555-abef0f29e03c  -t flat  1000 0.3
+--------------------------------------+---------------+------------+------+--------------------------------------+------------+----------+------------+
| Threshold ID                         | Level         | Cost       | Type | Field ID                             | Service ID | Group ID | Project ID |
+--------------------------------------+---------------+------------+------+--------------------------------------+------------+----------+------------+
| bf0dd4b7-5aa9-4b7d-b6ee-513e0c5a1d71 | 1000.00000000 | 0.30000000 | flat | 6ea4513b-4c57-48d4-8555-abef0f29e03c | None       | None     | None       |
+--------------------------------------+---------------+------------+------+--------------------------------------+------------+----------+------------+

猜你喜欢

转载自www.cnblogs.com/yanling-coder/p/12595737.html