Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Public cloud billing check tool

Tool that This tool checks public cloud billing and customer to Abiquo enterprise mapping.

Change history

Version

Module

Description

6.0.1

Build the tool

You can run this tool on the Abiquo Server. The project is built using Maven. You can build it with the following command:

Code Block
languagebash
mvn clean install

This will output a .jar script as follows.

Code Block
target/public-cloud-billing-check-tool.jar

Configuration

To use this tool in AWS, update your billing-api-user for Abiquo to add the following AWS IAM policy:

Code Block
"Effect": 
	"Allow", 
	"Action": [ "ce:*", ], 
"Resource": "*"

For both providers, add your connection details to the YAML configuration file

...

Edit the config.yml file and complete the values for your system.

Code Block
Abiquo_database:
  host: localhost
  user:
  password:
  port: 3306
  database: kinton
  socket: /var/lib/mysql/mysql.sock
abiquo:
  api_url: 'http://localhost/api'
  version: '6.0'
  user:
  #Basic Auth credentials
  password:
  #OAuth credentials
  access-token:
  access-token-secret:
  consumer-key:
  consumer-secret:

General usage

The tool has two main commands to run on Azure or AWS.

Code Block
java -jar public-cloud-billing-check-tool.jar 
-help Usage: <main class> [-hV] [COMMAND] 
Check public cloud billing information. 
	-h, --help Show this help message and exit. 
	-V, --version Print version information and exit. 
Commands: 
	azure Check for Azure CSP customer costs and subscription mappings. 
	aws Check for AWS organization billing costs and account mappings.

Amazon usage

When running the tool on Amazon, you can use the -h option to print the parameters, as shown here.

...

Both

This tool is now available as part of the Abiquo platform

6.0.2

AWS

Allow billing check tool to check keynode enterprises too in AWS.
New AWS option: -r, --rootEnterpriseId to specify reseller or keynode for pricing credentials. This replaces the previous reseller option

6.0.2

AWS

Billing check tool does not take into account an AWS SPP discount.
New AWS option: -spp, --sppDiscount to include the solution provider program discount.

6.0.2

Both

The seed parameter was removed

6.1.0

Azure

Added logging to display which Azure subscriptions are not mapped for an enterprise and which subscriptions that are present in Abiquo are no longer present in the CSP, enterprises without credentials, and subscriptions that are used by more than one enterprise

Install the tool

You can run this tool on the Abiquo Server.

In Abiquo >= 6.0.1, you can install the package abiquo-billing-public-cloud-check-tool with yum.

The default installation directory is /opt/abiquo-public-cloud-billing-check-tool.

And the tool file name is public-cloud-billing-check-tool.jar

Configuration

To use this tool in AWS, update your billing-api-user for Abiquo to add access to AWS Cost Explorer.

For example, for full access you can use the following AWS IAM policy:

Code Block
languagenone
"Effect": 
	"Allow", 
	"Action": [ "ce:*", ], 
"Resource": "*"

For both providers, add your connection details to the YAML configuration file

  1. Go to /opt/abiquo-public-cloud-billing-check-tool/config/

  2. Edit the config.yml file and complete the values for your system.

    Code Block
    languagenone
    Abiquo_database:
    host: localhost
    user:
    password:
    port: 3306
    database: kinton
    socket: /var/lib/mysql/mysql.sock
    abiquo:
    api_url: 'http://localhost/api'
    version: '6.0'
    user:
    #Basic Auth credentials
    password:
    #OAuth credentials
    access-token:
    access-token-secret:
    consumer-key:
    consumer-secret:

General usage

The tool has two main commands to run on Azure or AWS.

Code Block
languagenone
java -jar public-cloud-billing-check-tool.jar aws
-h
help Usage: <main class> aws [-abhvVhV] [-cfp=<configYAMLPath>] [-d=<resellerDiscount>] [-m=<margin>] [-mt=<month>] -r=<resellerId> [-s=<seed>] [-y=<year>]
Check for AWS organization billing costs and account mappings.

  -a, --accounts             Run the check for accounts inside an organization mapped to abiquo
  -b, --billing              Run check for billing information in Abiquo for the last consolidated billing period
      -cfp, --configPath=<configYAMLPath>
              COMMAND] 
Check public cloud billing information. 
-h, --help      Show this help message and exit.
-V, --version   Print version information and exit.
Commands: 
azure  Check for Azure CSP customer costs and subscription mappings.
aws    Check for AWS organization billing costs and account mappings.

Amazon usage

When running the tool on Amazon, you can use the -h option to print the parameters, as shown here.

Code Block
languagenone
java -jar public-cloud-billing-check-tool.jar aws -h
Usage: <main class> aws [-abhvV] [-spp] [-cfp=<configYAMLPath>] [-d=<resellerDiscount>] [-m=<margin>] [-mt=<month>] -r=<rootEnterpriseId> [-y=<year>]
Check for AWS organization billing costs and account mappings.

-a, --accounts             Run  Specify a different paththe check for theaccounts configinside file.an Defaultorganization pathmapped isto the same where .jar is located
  -dabiquo
-b, --discount=<resellerDiscount>billing              Run check for billing information in Abiquo for the last consolidated billing period
-cfp, --configPath=<configYAMLPath>
    Define the discount necessary to subtract to total cost   -h, --help           Specify a different path for  Show this help message and exit.
  -mthe config file. Default path is the same where .jar is located
-d, --margindiscount=<margin><resellerDiscount>
     Desired margin to compare cost from AWS and Abiquo database. If difference is bigger than margin, it will be considered   Define the discount necessary to subtract to total cost
-h, --help                 Show this help asmessage anand error. Default is 0
      -mtexit.
-m, --monthmargin=<month><margin>   Month of the billingDesired periodmargin to check.compare Defaultcost isfrom lastAWS monthand Abiquo database. -r, --reseller=<resellerId>
      If difference is bigger than margin, it will be considered
                      Enterprise id of the reseller from which to obtainas thean pricingerror. credentialsDefault is 0
-smt, --seedmonth=<seed><month>       Month of the Path to seed file usedbilling period to decryptcheck. accessDefault andis key tokens from database
 previous month
-vr, --verboserootEnterpriseId=<rootEnterpriseId>
             Display more detailed information about the process execution   -V, --version   Enterprise id of the reseller or key node from which obtain Print version information and exit.
  -ythe pricing credentials
-spp, --sppDiscount        If true, include solution provider program discounts in the price
-v, --year=<year>verbose          Year of the billing periodDisplay tomore check.detailed Defaultinformation isabout last year

Only the reseller parameter is required.

An example of execution with all parameters would be:

Code Block
java -jar public-cloud-billing-check-tool.jar aws -a -b -r=1

With the "verbose" option, the tool will display a detailed list of all accounts mapped to Abiquo and the respective enterprises that contain public cloud credentials of each account.

...

the process execution
-V, --version              Print version information and exit.
-y, --year=<year>          Year of the billing period to check. Default is the year of the previous month

The -r root enterprise option is required and the other parameters are optional.

An example of execution using all parameters is: java -jar public-cloud-billing-check-tool.jar aws -a -b -r=1.

With the verbose option, the tool will display a detailed list of all accounts mapped to Abiquo and the respective enterprises that contain public cloud credentials of each account.

With the accounts option, the tool will check for accounts that are:

  1. Used in more than one enterprise in Abiquo

  2. Mapped to the reseller enterprise hierarchy but not present in the reseller organization

  3. Present in the reseller organization but not present mapped to Abiquo

If "verbose" is also selected, it will also print all the accounts of the organization.

With the "billing" option, the the tool will check the difference between AWS cost and Abiquo costs for each mapped account. If "verbose" is activated, the script will print the difference for all enterprises, otherwise it will only print entries with a cost difference between AWS and Abiquo.

...

You can use this tool if you have a set of Azure Plans subscriptions mapped to enterprises. The tool has two main functions:

  • Check that all subscriptions from a CSP Azure Plan are mapped correctly to Abiquo enterprises

  • For Azure billing, check the costs of the last month at customer level, not subscription level.

To run the tool for Azure with the help option to discover the parameters, run the following command:

Code Block
java -jar public-cloud-billing-check-tool.jar azure -h

Here is an example of the help parameters output. The "-r" parameter is mandatory.

Code Block
java -azp (--azureplan)      : Run the check for Azure Plan subscriptions in Abiquojar public-cloud-billing-check-tool.jar azure -h
Usage: <main class> azure [-bhvV] [-azp] [-c=<currencyCode>] [-cfp=<configYAMLPath>] [-d=<resellerDiscount>] [-epp=<excludedProductIdsPath>]
                          [-m=<margin>] [-mt=<month>]   with the CSP data
 -b (--billing)    -r=<resellerId> [-y=<year>] [-ep=<excludedPublishers>[,<excludedPublishers>...]]...
Check for Azure CSP customer costs and subscription mappings.
     : Run check for billing information in Abiquo for-azp, --azureplan      Run the check for Azure Plan subscriptions in Abiquo with the CSP data
  -b, --billing              Run check for billing information in Abiquo for the last consolidated billing period
  -cfpc, (--configPath)currencyCode=<currencyCode>
VAL : Specify a different path for the config file.                    Currency code used to retrieve billing line items, TheDefault default pathcode is the same as where the .jar is locatedUSD
  -dcfp, (--discount)configPath=<configYAMLPath>
        : Define the discount to subtract from total cost  -s (--seed)          Specify a different :path Pathfor tothe seedconfig file. usedDefault topath decryptis accessthe andsame keywhere tokens.jar is located
  -d, --discount=<resellerDiscount>
                     from database  -r (--reseller)    Define the discount necessary to :substract Enterpriseto IDtotal ofcost
the reseller from which obtain the-ep, --excludedPublishers=<excludedPublishers>[,<excludedPublishers>...]
                             pricing credentialsSpecify Azure publishers to exclude their products
  -mepp, (--margin) NexcludedProductIdsPath=[<excludedProductIdsPath>]
         : Desired margin to compare cost from CSP and Abiquo           Specify a path to a CSV file of Azure product IDs to exclude
  -h, --help database. If the difference is bigger than margin, it        Show this help message and exit.
  -m, --margin=<margin>      Desired margin to compare cost willfrom beCSP consideredand anAbiquo errordatabase. If Defaultdifference is 0bigger than -oe (--onlyErrors)   margin, it will be considered
  : Configure script to only prompt errors or warnings                     as an error. Default is   in0
logs  -vmt, (--verbose)          : Print more detailed information about the processmonth=<month>       Month of the billing period to check. Default is previous month
  -r, --reseller=<resellerId>
                             Enterprise id of the reseller execution
 --excludedPublishers (see explanation below)

Here is an example of running the tool on Azure using parameters:

Code Block
java -jar public-cloud-billing-check-tool.jar azure -azp -b -cfp "/path/to/config.yml" -s "/path/to/seed/.store" -m 2 -v -r 10

And another example:

Code Block
java -jar /opt/abiquo-public-cloud-billing-check-tool/from which obtain the pricing credentials
  -v, --verbose              Display more detailed information about the process execution
  -V, --version              Print version information and exit.
  -y, --year=<year>          Year of the billing period to check. Default is the year of the previous month

Here is an example of running the tool on Azure using parameters:

Code Block
java -jar public-cloud-billing-check-tool.jar azure -azp -b -m 2 -v -r 10

And another example:

Code Block
java -jar /opt/abiquo-public-cloud-billing-check-tool/public-cloud-billing-check-tool.jar azure --azureplan --billing --configPath /home/ansible/config.yml --margin 0 --verbose --discount '0.15' --reseller 3

Exclude publishers option

To exclude products from specific publishers from Azure billing, you can set and Abiquo property: abiquo.azure.billing.parser.lineitem.publisher.ignore.
This property contains a string of publishers to exclude from billing line items in CSV format, such as Microsoft Office
When you are using this property, for the public-cloud-billing-check-tool for Azure, you can use the --excludedPublishers option.

Exclude product IDs option

To exclude specific products by ID from Azure billing, you can set abiquo.azure.billing.parser.lineitem.productid.ignore.path system property to define a fileystem path to a CSV file containing all the product IDs to ignore.
Effectively, the CSV file will be a list of product IDs to ignore, one per line. When you are using this property, for the public-cloud-billing-check-tool

...

for Azure, you can use the --epp or --excludedProductIdsPath option.

Azure example output

In verbose mode the tool will print a detailed list of all the CSP customers, and the respective enterprises that contain public cloud credentials of the same customer.

...

The number of missing subscriptions could be positive or negative:

  • A positive number means there are more entitlements in the CSP Azure Plan than there are in Abiquo

  • A negative number means there are more subscriptions in Abiquo than in the Microsoft Azure portal. This could be because credentials are not set correctly, or because a subscription was deleted/

    canceled

    cancelled/deactivated in Azure but the subscription still exists in Abiquo.

For the billing check option, there's no verbose option, so the output will be always the same, as in the example shown below. 

...

Code Block
2021-04-21 10:43:58,678 WARN  com.abiquo.azureplans.Main - Customer "X" with identifier XXXX-XXXX-XXXX-XXXX has a summary cost of N USD, and in Abiquo database total for all the enterprises of same customer is N-1 USD.
2021-04-21 10:43:58,678 WARN  com.abiquo.azureplans.Main - There's a difference of 1 for customer "X" with identifier XXXX-XXXX-XXXX-XXXX
2021-04-21 10:43:58,678 WARN  com.abiquo.azureplans.Main - Detailed cost for every enterprise belonging to customer "X" with identifier XXXX-XXXX-XXXX-XXXX
2021-04-21 10:43:58,679 WARN  com.abiquo.azureplans.Main - 	-> Cost for enterprise "X Ent 1" with id 45 is X-XXXX-XXXX
2021-04-21 10:43:58,679 WARN  com.abiquo.azureplans.Main - 	-> Cost for enterprise "X Ent 21" with id 56 is X

Azure example errors

The tool tries to log all error messages without stopping. Most of those errors would be errors returned from the Azure CSP API.

A customer in Abiquo was not found in the Azure CSP. You should delete these credentials from Abiquo.

Code Block
45 is X
2021-04-21 10:3943:5058,956679 WARN ERROR com.abiquo.azureplans.Main - 	- Customer> Cost for enterprise "X Ent 2" with id identifier XXXX-XXXX-XXXX-XXXX could not be found in Azure CSP. This could be due that the customer was deleted

...

56 is X

Azure example errors

The tool tries to log all error messages without stopping. Most of those errors would be errors returned from the Azure CSP API.

A customer in Abiquo was not found in the Azure CSP. You should delete these credentials from Abiquo.

Code Block
2021-04-21 10:4339:5150,220956 ERROR com.abiquo.azureplans.Main - Customer "X" with identifier XXXX-XXXX-XXXX-XXXX doescould not havebe found anyin summaryAzure costCSP. This could be due tothat the creationcustomer date of the customer. Execution will continue

Exclude publishers option

...

was deleted

A recently created customer won't have any costs for the last month, so the CSP API returns an error. The tool controls this condition, and logs an error.

Code Block
2021-04-21 10:43:51,220 ERROR com.abiquo.azureplans.Main - Customer "X" with identifier XXXX-XXXX-XXXX-XXXX does not have any summary cost. This could be due to the creation date of the customer. Execution will continue