************ Chargeback ************ Robin provides an in-built chargeback utility which allows one to track the usage and cost of the resources utilized by Robin Bundle applications on a deployed Robin cluster regardless of environment. The resources that are accounted for include: CPU, memory and storage space consumed. This cost visibility and insight into resource consumption not only encourages accountability among application owners but also enables cluster administrators to make better decisions about resource requirements and priorities with regards to their Robin cluster. This in turn improves the meaningful utilization of resources on a Robin Cluster. The chargeback counters for each of the aforementioned resources are initially started when an application is successfully created and its requested resources are allocated. In addition the following situations could also result in a counter (re)starting: - Individual pod is created - Application or individual pod is (re)started - Failed pod is successfully redeployed (either manually or via Autopilot) On the other hand counters for an application and its associated resources are stopped when the application is deleted. In addition the following situations could also result in a counter being stopped: - Individual pod is deleted or removed - Application or individual pod is stopped - Redeployment of pod fails (when it initially was in a good state) The above scenarios cover all of the operations on an application that could result in a change of resource utilization. These include: scaling an application in/out horizontally, scaling an application up/down vertically, rolling an application back and adding a new volume to an application. .. Note:: Separate counters are maintained for every combination of pod and resource tracked. **Topics covered in this chapter:** ================================== ================================================================= ``robin chargeback price-sheet`` View and manipulate the prices enforced by chargeback counters ``robin chargeback report`` View chargeback report ``robin chargeback resource-list`` View list of resources tracked as part of chargeback ``robin chargeback resource-info`` View information on a resource tracked as part of chargeback ================================== ================================================================= Viewing and editing Chargeback pricing scheme ============================================== .. tabs:: .. tab:: CLI Upon installation, Robin creates a default price sheet (in USD) wherein which prices are associated with each tracked resources and applied to the whole cluster. In addition they can be updated by the Robin Cluster Superadmin so as to customize it for the deployment. Issue the following command to view/update the chargeback price sheet: .. code-block:: text # robin chargeback price-sheet --price-per-cpu --price-per-mem --price-per-hdd --price-per-ssd --currency ================================ ========================================================= ``--price-per-cpu `` Price of 1 cpu per day ``--price-per-mem `` Price of 1 GB of memory per day ``--price-per-hdd `` Price of 1 GB of HDD storage per day ``--price-per-ssd `` Price of 1 GB of SSD storage per day ``--currency `` Currency in 3 letter format as per ISO-4217 standard ================================ ========================================================= **Example 1: View price sheet** .. code-block:: text # robin chargeback price-sheet Chargeback Price-sheet Currency: USD Resource Type | Unit size | Price Per Day --------------+-----------+--------------- CPU | 1 CPU | 0.12000 HDD | 1G | 0.00420 MEMORY | 1G | 0.25000 SSD | 1G | 0.00150 **Example 2: Update price sheet** .. code-block:: text # robin chargeback price-sheet --price-per-cpu 0.14 --price-per-mem 0.3 --price-per-hdd 0.0004 --price-per-ssd 0.0015 --currency JPY Successfully updated the chargeback price-sheet # robin chargeback price-sheet Chargeback Price-sheet Currency: JPY Resource Type | Unit size | Price Per Day --------------+-----------+--------------- CPU | 1 CPU | 0.14000 HDD | 1G | 0.00040 MEMORY | 1G | 0.30000 SSD | 1G | 0.00150 .. tab:: API Returns the chargeback price sheet which contains details on the prices associated with each type of tracked resource (in the selected currency). **End Point:** /api/v3/robin_server/chargeback **Method:** GET **URL Parameters:** - ``pricesheet=true`` : This mandatory parameter specifies that details of the price sheet should be returned. **Data Parameters:** None **Port:** RCM Port (default value is 29442) **Headers:** - ``Authorization: `` : Authorization token to identify which user is sending the request. The token can be acquired from the login API. **Success Response Code:** 200 **Error Response Code:** 500 (Internal Server Error), 401 (Unauthorized Error), 400 (Invalid API Usage Error) **Example Response:** .. raw:: html
Output .. code-block:: text { "items":{ "currency":"USD", "resources":[ { "unit_size":1073741824, "type":"MEMORY", "unit_price":0.25 }, { "unit_size":1073741824, "type":"SSD", "unit_price":0.0042 }, { "unit_size":1073741824, "type":"HDD", "unit_price":0.0015 }, { "unit_size":1, "type":"CPU", "unit_price":0.12 } ] } } .. raw:: html
Generating Chargeback report ============================= .. tabs:: .. tab:: CLI Robin generates a Chargeback report that allows one to the track the cost of an application in the cluster. The report can be filtered by tenants, users, application, or date interval in order to provide more focused information. Issue the following command to generate the Chargeback report: .. code-block:: text # robin chargeback report --app --tenant --user --starttime --endtime --interval --details .. Note:: Chargeback reports for deleted applications are saved. This enables historical cost information to be viewed. ================================================= ================================================================================================================================ ``--app `` Application name to filter by ``--tenant `` Tenant name to filter by ``--user `` User name to filter by ``--starttime `` Start time in format YYYY-MM-DDTHH:MM:SS or YYYY-MM-DD or YYYY-MM ``--endtime `` End time in format YYYY-MM-DDTHH:MM:SS or YYYY-MM-DD or YYYY-MM ``--interval `` Interval of report. Options include: yearly or monthly ``--details`` Provide additional information for each application ================================================= ================================================================================================================================ **Example:** .. code-block:: text # robin chargeback report App | User | Tenant | State/Status | Resource Type | Price (USD) ----------+-------+----------------+-----------------+---------------+------------- centos | robin | Administrators | ONLINE/Ready | CPU | 87.74 | | | | HDD | 11.05 | | | | MEMORY | 35.7 ubuntu | user2 | Administrators | ONLINE/Ready | CPU | 0.13 | | | | HDD | 0.03 | | | | MEMORY | 0.26 Postgres | user1 | Administrators | ONLINE/Ready | CPU | 0.19 | | | | HDD | 0.03 | | | | MEMORY | 0.39 nginx | user1 | Administrators | ONLINE/Ready | CPU | 0.19 | | | | HDD | 0.02 | | | | MEMORY | 0.23 postgres1 | user2 | Administrators | Deleted/Deleted | CPU | 0.01 | | | | HDD | 0.0 | | | | MEMORY | 0.02 .. tab:: API Generates a Chargeback report that allows one to the track the cost of an application in the cluster. The report can be filtered by tenants, users, application, or date interval in order to provide more focused information. **End Point:** /api/v3/robin_server/chargeback **Method:** GET **URL Parameters:** - ``appname=`` : Utilizing this parameter filters the results such that only applications whose name match the specified application name are returned. - ``tenantname=`` : Utilizing this parameter filters the results such that only applications within the specified tenant are returned. - ``username=`` : Utilizing this parameter filters the results such that only applications created by the specified user are returned. - ``starttime=`` : Utilizing this parameter results in the price of each application being calculated from the specified start time. This field should be specified in one of the following formats: YYYY-MM-DDTHH:MM:SS, YYYY-MM-DD or YYYY-MM. - ``endtime=`` : Utilizing this parameter results in the price of each application being calculated until the specified end time. This field should be specified in one of the following formats: YYYY-MM-DDTHH:MM:SS, YYYY-MM-DD or YYYY-MM. - ``details=true`` : Utilizing this parameter results in additional information for each application being returned. - ``interval=[1,2]`` : Utilizing this parameter results in application information within the specified interval being returned. Options include 1, indicating a yearly interval, or 2 which indicates a monthly interval. **Data Parameters:** None **Port:** RCM Port (default value is 29442) **Headers:** - ``Authorization: `` : Authorization token to identify which user is sending the request. The token can be acquired from the login API. **Success Response Code:** 200 **Error Response Code:** 500 (Internal Server Error), 401 (Unauthorized Error), 400 (Invalid API Usage Error) **Example Response:** .. raw:: html
Output .. code-block:: text { "items":[ { "name":"test-app", "username":"robin", "state":"Deleted", "resources":{ "3":{ "unit_size":1, "max_units":1, "price":"0.12", "total_time":86657, "type":"CPU", "min_units":1 }, "4":{ "unit_size":1048576, "max_units":200, "price":"0.05", "total_time":17331400, "type":"MEMORY", "min_units":200 }, "5":{ "unit_size":1048576, "max_units":2457, "price":"0.0", "total_time":212916249, "type":"HDD", "min_units":2457 } }, "pods":{ "1":{ "name":"test-app.server.01.deleted", "resource_entries":[ ] } }, "appid":1, "status":"Deleted", "tenantname":"Administrators" }, { "name":"test-app-2", "username":"robin", "state":"Deleted", "resources":{ "3":{ "unit_size":1, "max_units":1, "price":"0.0", "total_time":3248, "type":"CPU", "min_units":1 }, "4":{ "unit_size":1048576, "max_units":200, "price":"0.0", "total_time":649600, "type":"MEMORY", "min_units":200 }, "5":{ "unit_size":1048576, "max_units":2457, "price":"0.0", "total_time":7980336, "type":"HDD", "min_units":2457 } }, "pods":{ "2":{ "name":"test-app-2.server.01.deleted", "resource_entries":[ ] } }, "appid":2, "status":"Deleted", "tenantname":"Administrators" }, { "name":"test-app", "username":"robin", "state":"Deleted", "resources":{ "3":{ "unit_size":1, "max_units":1, "price":"0.33", "total_time":234599, "type":"CPU", "min_units":1 }, "4":{ "unit_size":1048576, "max_units":200, "price":"0.13", "total_time":46919800, "type":"MEMORY", "min_units":200 }, "5":{ "unit_size":1048576, "max_units":2457, "price":"0.01", "total_time":576409743, "type":"HDD", "min_units":2457 } }, "pods":{ "4":{ "name":"test-app.server.01.deleted", "resource_entries":[ ] } }, "appid":4, "status":"Deleted", "tenantname":"Administrators" }, { "name":"test-app", "username":"robin", "state":"Deleted", "resources":{ "3":{ "unit_size":1, "max_units":1, "price":"0.01", "total_time":8463, "type":"CPU", "min_units":1 }, "4":{ "unit_size":1048576, "max_units":200, "price":"0.0", "total_time":1692600, "type":"MEMORY", "min_units":200 }, "5":{ "unit_size":1048576, "max_units":2457, "price":"0.0", "total_time":20793591, "type":"HDD", "min_units":2457 } }, "pods":{ "5":{ "name":"test-app.server.01.deleted", "resource_entries":[ ] } }, "appid":5, "status":"Deleted", "tenantname":"Administrators" }, { "name":"test-app", "username":"robin", "state":"Deleted", "resources":{ "3":{ "unit_size":1, "max_units":1, "price":"0.04", "total_time":28216, "type":"CPU", "min_units":1 }, "4":{ "unit_size":1048576, "max_units":200, "price":"0.02", "total_time":5643200, "type":"MEMORY", "min_units":200 }, "5":{ "unit_size":1048576, "max_units":2457, "price":"0.0", "total_time":69326712, "type":"HDD", "min_units":2457 } }, "pods":{ "6":{ "name":"test-app.server.01.deleted", "resource_entries":[ ] } }, "appid":6, "status":"Deleted", "tenantname":"Administrators" }, { "name":"second-EMS-1", "username":"robin", "state":"ONLINE", "resources":{ "3":{ "unit_size":1, "max_units":1, "price":"0.09", "total_time":68221, "type":"CPU", "min_units":1 }, "4":{ "unit_size":1048576, "max_units":200, "price":"0.04", "total_time":13644200, "type":"MEMORY", "min_units":200 }, "5":{ "unit_size":1048576, "max_units":2457, "price":"0.0", "total_time":167618997, "type":"HDD", "min_units":2457 } }, "pods":{ "7":{ "name":"second-EMS-1.server.01", "resource_entries":[ ] } }, "appid":7, "status":"Ready", "tenantname":"Administrators" }, { "name":"test-app", "username":"robin", "state":"Deleted", "resources":{ "3":{ "unit_size":1, "max_units":1, "price":"0.0", "total_time":1740, "type":"CPU", "min_units":1 }, "4":{ "unit_size":1048576, "max_units":200, "price":"0.0", "total_time":348000, "type":"MEMORY", "min_units":200 } }, "pods":{ "8":{ "name":"test-app.db.01.deleted", "resource_entries":[ ] }, "9":{ "name":"test-app.frontend.01.deleted", "resource_entries":[ ] } }, "appid":8, "status":"Deleted", "tenantname":"Administrators" }, { "name":"banned-app", "username":"robin", "state":"ONLINE", "resources":{ "3":{ "unit_size":1, "max_units":1, "price":"0.08", "total_time":54883, "type":"CPU", "min_units":1 }, "4":{ "unit_size":1048576, "max_units":200, "price":"0.03", "total_time":10976600, "type":"MEMORY", "min_units":200 }, "5":{ "unit_size":1048576, "max_units":2457, "price":"0.0", "total_time":134847531, "type":"HDD", "min_units":2457 } }, "pods":{ "10":{ "name":"banned-app.server.01", "resource_entries":[ ] } }, "appid":9, "status":"Ready", "tenantname":"Administrators" }, { "name":"test-app-1", "username":"robin", "state":"Deleted", "resources":{ "3":{ "unit_size":1, "max_units":1, "price":"0.0", "total_time":365, "type":"CPU", "min_units":1 }, "4":{ "unit_size":1048576, "max_units":200, "price":"0.0", "total_time":73000, "type":"MEMORY", "min_units":200 } }, "pods":{ "11":{ "name":"test-app-1.db.01.deleted", "resource_entries":[ ] }, "12":{ "name":"test-app-1.frontend.01.deleted", "resource_entries":[ ] } }, "appid":10, "status":"Deleted", "tenantname":"Administrators" } ] } .. raw:: html
List all tracked resources =========================== .. tabs:: .. tab:: CLI To view all physical resources that could be utilized by applications and consequently tracked by independent chargeback counters, issue the following command: .. code-block:: text # robin chargeback resource-list --json ================================================= ================================================================================================================================ ``--json`` Output in JSON ================================================= ================================================================================================================================ **Example:** .. code-block:: text # robin chargeback resource-list +----+-----------------------------------------------+--------+----------+ | ID | Name | Type | NumHosts | +----+-----------------------------------------------+--------+----------+ | 1 | Intel Xeon E312xx (Sandy Bridge, IBRS update) | CPU | 2 | | 2 | UNKNOWN-GENERIC-UNKNOWN | MEMORY | 3 | | 3 | UNKNOWN-UNKNOWN-53687091200 | HDD | 1 | | 4 | Intel Xeon E3-12xx v2 (Ivy Bridge, IBRS) | CPU | 1 | | 5 | UNKNOWN-UNKNOWN-107374182400 | HDD | 2 | +----+-----------------------------------------------+--------+----------+ .. tab:: API Returns all physical resources that could be utilized by applications and consequently tracked by independent chargeback counters. **End Point:** /api/v3/robin_server/chargeback **Method:** GET **URL Parameters:** - ``resourceonly=true`` : This mandatory parameter specifies that only information on available resources should be returned. **Data Parameters:** None **Port:** RCM Port (default value is 29442) **Headers:** - ``Authorization: `` : Authorization token to identify which user is sending the request. The token can be acquired from the login API. **Success Response Code:** 200 **Error Response Code:** 500 (Internal Server Error), 401 (Unauthorized Error), 400 (Invalid API Usage Error) **Example Response:** .. raw:: html
Output .. code-block:: text { "items":[ { "name":"DEFAULT-HDD", "id":1, "hosts":[ ], "attributes":{ "default":true, "type":"HDD" }, "type":"HDD" }, { "name":"DEFAULT-SSD", "id":2, "hosts":[ ], "attributes":{ "default":true, "type":"SSD" }, "type":"SSD" }, { "name":"Intel(R) Xeon(R) Gold 5220 CPU @ 2.20GHz", "id":3, "hosts":[ "cscale-82-140.robinsystems.com", "cscale-82-139.robinsystems.com" ], "attributes":{ "cache_size_kb":25344, "min_speed_mhz":null, "model_name":"Intel(R) Xeon(R) Gold 5220 CPU @ 2.20GHz", "max_speed_mhz":null, "flags":"fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt avx512cd avx512bw avx512vl xsaveopt xsavec spec_ctrl intel_stibp flush_l1d arch_capabilities", "online":1, "cur_speed_mhz":2194.841, "cpu_index":0, "vendor_id":"GenuineIntel", "model":85, "physical_id":0, "core_id":0 }, "type":"CPU" }, { "name":"UNKNOWN-GENERIC-UNKNOWN", "id":4, "hosts":[ "cscale-82-140.robinsystems.com", "cscale-82-139.robinsystems.com" ], "attributes":{ }, "type":"MEMORY" }, { "name":"UNKNOWN-UNKNOWN-107374182400", "id":5, "hosts":[ "cscale-82-140.robinsystems.com", "cscale-82-139.robinsystems.com" ], "attributes":{ "0x600224804c48fd7e16c608dea0919064":{ "aws_path":null, "availability_zone":null, "devpath":"\/dev\/disk\/by-id\/scsi-3600224804c48fd7e16c608dea0919064", "log_sec_size":512, "capacity":107374182400, "kernel_name":"\/dev\/sdb", "smart_info":{ "enabled":false, "available":false }, "Valid":true, "discard":{ "enabled":true, "zeroes_data":0, "granularity":2097152, "max_bytes":4294966784 }, "make":null, "type":"HDD", "phy_sec_size":4096, "model":null, "wwn":"0x600224804c48fd7e16c608dea0919064" }, "0x60022480940ed076551cfaf75612e24e":{ "aws_path":null, "availability_zone":null, "devpath":"\/dev\/disk\/by-id\/scsi-360022480940ed076551cfaf75612e24e", "log_sec_size":512, "capacity":107374182400, "kernel_name":"\/dev\/sdb", "smart_info":{ "enabled":false, "available":false }, "Valid":true, "discard":{ "enabled":true, "zeroes_data":0, "granularity":2097152, "max_bytes":4294966784 }, "make":null, "type":"HDD", "phy_sec_size":4096, "model":null, "wwn":"0x60022480940ed076551cfaf75612e24e" }, "0x60022480ffcf3deb224fb37d78fe7767":{ "aws_path":null, "availability_zone":null, "devpath":"\/dev\/disk\/by-id\/scsi-360022480ffcf3deb224fb37d78fe7767", "log_sec_size":512, "capacity":107374182400, "kernel_name":"\/dev\/sdc", "smart_info":{ "enabled":false, "available":false }, "Valid":true, "discard":{ "enabled":true, "zeroes_data":0, "granularity":2097152, "max_bytes":4294966784 }, "make":null, "type":"HDD", "phy_sec_size":4096, "model":null, "wwn":"0x60022480ffcf3deb224fb37d78fe7767" }, "0x600224803bcdafde95b1f5cd27ceb5fb":{ "aws_path":null, "availability_zone":null, "devpath":"\/dev\/disk\/by-id\/scsi-3600224803bcdafde95b1f5cd27ceb5fb", "log_sec_size":512, "capacity":107374182400, "kernel_name":"\/dev\/sdc", "smart_info":{ "enabled":false, "available":false }, "Valid":true, "discard":{ "enabled":true, "zeroes_data":0, "granularity":2097152, "max_bytes":4294966784 }, "make":null, "type":"HDD", "phy_sec_size":4096, "model":null, "wwn":"0x600224803bcdafde95b1f5cd27ceb5fb" } }, "type":"HDD" } ] } .. raw:: html
Show information about a specific resource ============================================= .. tabs:: .. tab:: CLI To view detailed information about a particular resource, such as the host(s) on which it resides and resource specific attributes, issue the following command: .. code-block:: text # robin chargeback resource-info [] ================================================= ================================================================================================================================ ``resource_id`` ID of the resource. Can be obtained by running ``robin chargeback resource-list`` ================================================= ================================================================================================================================ **Example:** .. code-block:: text # robin chargeback resource-info 1 ID: 1 Name: Intel Xeon E312xx (Sandy Bridge, IBRS update) Type: CPU Attributes: vendor_id : GenuineIntel online : 1 model_name : Intel Xeon E312xx (Sandy Bridge, IBRS update) max_speed_mhz : None cpu_index : 0 cur_speed_mhz : 1999.999 model : 42 core_id : 0 physical_id : 0 cache_size_kb : 4096 flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat min_speed_mhz : None Hosts: vnode36.robinsystems.com vnode89.robinsystems.com .. tab:: API Returns detailed information about a particular resource, such as the host(s) on which it resides and resource specific attributes. **End Point:** /api/v3/robin_server/chargeback **Method:** GET **URL Parameters:** - ``resourceonly=true`` : This mandatory parameter specifies that only information on available resources should be returned. - ``restypeid=``: This mandatory parameter specifies the ID of the resource for which information should be returned. **Data Parameters:** None **Port:** RCM Port (default value is 29442) **Headers:** - ``Authorization: `` : Authorization token to identify which user is sending the request. The token can be acquired from the login API. **Success Response Code:** 200 **Error Response Code:** 500 (Internal Server Error), 401 (Unauthorized Error), 400 (Invalid API Usage Error), 404 (Not Found Error) **Example Response:** .. raw:: html
Output .. code-block:: text { "items":[ { "name":"Intel(R) Xeon(R) Gold 5220 CPU @ 2.20GHz", "id":3, "hosts":[ "cscale-82-140.robinsystems.com", "cscale-82-139.robinsystems.com" ], "attributes":{ "cache_size_kb":25344, "min_speed_mhz":null, "model_name":"Intel(R) Xeon(R) Gold 5220 CPU @ 2.20GHz", "max_speed_mhz":null, "flags":"fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt avx512cd avx512bw avx512vl xsaveopt xsavec spec_ctrl intel_stibp flush_l1d arch_capabilities", "online":1, "cur_speed_mhz":2194.841, "cpu_index":0, "vendor_id":"GenuineIntel", "model":85, "physical_id":0, "core_id":0 }, "type":"CPU" } ] } .. raw:: html