Overview Dashboard
Overview
Customers require comprehensive visibility into their current cloud usage to support forecasting and budgeting decisions. VP mandates reporting of cost data across three major cloud providers: AWS, Azure, and GCP. This documentation guides users on how to obtain cost information across various clouds and their distribution across different accounts, services, and resource groups.
Data Capture and Storage
Data Collection: Cost data is captured on a daily basis through a scheduled CRON job.
Storage: The collected data is stored in a Snowflake database.
User Options for Generating Cost Data Points
Cloud-Specific Costs: Retrieve the cost associated with a specific cloud provider.
Monthly Costs: Obtain the total cost of all resources from a given cloud within a specified month.
Account Distribution: Analyze the cost distribution across various accounts.
Service Distribution: Determine the cost distribution across different services.
Resource Group Distribution: Identify the cost distribution across user-defined resource groups. Refer to Resource Groups Page.
Dashboard and API Integration
The Virtana Platform UI offers an Overview Dashboard that provides various slicing and dicing options for cost data visualization. Additionally, the platform exposes APIs, enabling integration with customers' own dashboards. These APIs are accessible through a GraphQL service, which features a specific schema and set of APIs for retrieving relevant cost data.
Guidelines to Call GraphQL API
API Endpoint:
https://api.app.optimize.virtana.com/graphql/cost
Authorization: Provide Headers Authorization as Bearer {Token}, Refer to Get Bearer Token.
Request Type: Request type is "POST".
Request Format: GraphQL takes query and variable in the request body.
Note
While using Postman it should go under GraphQL data format.
Query Format:
query queryName($variable: variableType!) { field2_to_select, field3_to_select}
Variables Format:
{ "variable": "value" }
Example:
Lets say you have to find cost per account on cloud.
Query
query OrganizationCostByAccount($organizationId: ID!, $cloudId: ID!, $June: QueryFilter!, $previousMay: QueryFilter!, $totalMay: QueryFilter!) { // Current Month June: organization(id: $organizationId) { cloud(id: $cloudId) { // for every cloud there would be cost account wise id accountCost(filter: $June) { totalCost entityCount accountCosts { cloud cost payerAccount usageAccount entityCount __typename } __typename } __typename } __typename } previousMay: organization(id: $organizationId) { cloud(id: $cloudId) { id accountCost(filter: $previousMay) { totalCost entityCount accountCosts { cloud cost payerAccount usageAccount entityCount __typename } __typename } __typename } __typename } totalMay: organization(id: $organizationId) { cloud(id: $cloudId) { id accountCost(filter: $totalMay) { totalCost entityCount accountCosts { cloud cost payerAccount usageAccount entityCount __typename } __typename } __typename } __typename } }
Response
{ "data": { "June": { "cloud": { "id": "AWS,AZURE,GCP", "accountCost": { "totalCost": 11111111, "entityCount": xxxxx, "accountCosts": [ { "cloud": "AWS", "cost": 111111111, "payerAccount": null, "usageAccount": "270852171xx", "entityCount": 20x, "__typename": "CostByAccountDetail" } ], "__typename": "CostByAccountSummary" }, "__typename": "Cloud" }, "__typename": "Organization" } } }
How to get summary for right sizing and idle resources
Refer to Right Sizing Reports
Query
query CSOByEntity($organizationId: ID!, $cloudId: ID!, $isSummaryRequest: Boolean = false, $filterIdleResource: QueryFilter!, $filterRightSize: QueryFilter!) { organization(id: $organizationId) { cloud(id: $cloudId) { idleResource: entityCostSaving( isSummaryRequest: $isSummaryRequest filter: $filterIdleResource ) { costSavingSummary { analysisType elementCount totalSaving __typename } __typename } rightSizing: entityCostSaving( isSummaryRequest: $isSummaryRequest filter: $filterRightSize ) { costSavingSummary { analysisType elementCount totalSaving __typename } __typename } __typename } __typename } }
Response
{ "data": { "organization": { "cloud": { "idleResource": { "costSavingSummary": { "analysisType": "IDLE_RESOURCES", "elementCount": 3, "totalSaving": 9.92xxx, "__typename": "CostSavingSummary" }, "__typename": "CostSavingByEntitySummary" }, "rightSizing": { "costSavingSummary": { "analysisType": "RIGHT_SIZING", "elementCount": 173, "totalSaving": 0, "__typename": "CostSavingSummary" }, "__typename": "CostSavingByEntitySummary" }, "__typename": "Cloud" }, "__typename": "Organization" } } }
How to find cost for a particular resourceGroup
Query
query ResourceGroupCostByAdityaRG($organizationId: ID!, $cloudId: ID!, $resourceGroupName: String, $June: QueryFilter!, $previousMay: QueryFilter!, $totalMay: QueryFilter!) { organization(id: $organizationId) { cloud(id: $cloudId) { June: resourceGroupCost(name: $resourceGroupName, filter: $June) { org_id name totalCost entityCount costDetails { cloud cost name invoiceYearMonth entityCount __typename } __typename } previousMay: resourceGroupCost(name: $resourceGroupName, filter: $previousMay) { org_id name totalCost entityCount costDetails { cloud cost name invoiceYearMonth entityCount __typename } __typename } totalMay: resourceGroupCost(name: $resourceGroupName, filter: $totalMay) { org_id name totalCost entityCount costDetails { cloud cost name invoiceYearMonth entityCount __typename } __typename } __typename } __typename } }
Response
{ "data": { "organization": { "cloud": { "June": { "org_id": "c1b1bee2-4171-4f9e-b7xxxxxxxx", "name": "Aditya RG", "totalCost": 5814.fffffff, "entityCount": 1xxxx, "costDetails": [ { "cloud": "AWS", "cost": 5814.xxxxxx, "name": "(Untagged Resources)", "invoiceYearMonth": "24444444", "entityCount": xxxxx, "__typename": "ResourceGroupCostDetail" } ], "__typename": "ResourceGroupCostSummary" }, "previousMay": { "org_id": "c1b1bee2-4171-4f9e-b778-00xxxxxxxx", "name": "Aditya RG", "totalCost": 7244.xxxxxxxxx, "entityCount": 17377, "costDetails": [ { "cloud": "AWS", "cost": 722222.222222222, "name": "(Untagged Resources)", "invoiceYearMonth": "2022222", "entityCount": 111111, "__typename": "ResourceGroupCostDetail" } ], "__typename": "ResourceGroupCostSummary" }, "totalMay": { "org_id": "c1b1bee2-4171-4f9e-b778-xxxxxxxxx", "name": "Aditya RG", "totalCost": 86xx85.xxxxxx, "entityCount": 2xxxxx, "costDetails": [ { "cloud": "AWS", "cost": 8681.1111xxxxx, "name": "(Untagged Resources)", "invoiceYearMonth": "2xxxx", "entityCount": 21xxx, "__typename": "ResourceGroupCostDetail" } ], "__typename": "ResourceGroupCostSummary" }, "__typename": "Cloud" }, "__typename": "Organization" } } }
By utilizing these tools and APIs, users can gain detailed insights into their cloud expenditures, facilitating better financial planning and resource allocation.