Azure plans check tool

Azure plans check tool

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.


Installation

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

mvn clean install


This will output a .jar script as

target/azure-plans-check-tool.jar


Credentials and configuration files

The script requires the following file, which was used for core billing in previous versions of Abiquo: 

  • config.yml

For details of how to create this file, see: Display Azure billing data in Abiquo 5.1 wiki.

Parameters


The tool uses the following parameters. The "-r" parameter is mandatory.


-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
 -cfp (--configPath) VAL : Specify a different path for the config file.
                           The default path is the same as where the .jar is located
 -d (--discount)         : Define the discount to subtract from total cost
 -s (--seed)             : Path to seed file used to decrypt access and key tokens
                           from database
 -r (--reseller)         : Enterprise ID of the reseller from which obtain the
                           pricing credentials
 -m (--margin) N         : Desired margin to compare cost from CSP and Abiquo
                           database. If the difference is bigger than margin, it
                           will be considered an error. Default is 0
 -oe (--onlyErrors)      : Configure script to only prompt errors or warnings
                           in logs
 -v (--verbose)          : Print more detailed information about the process
                           execution


Run the script


Here is an example of running the tool using parameters:

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

And another example:

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


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.

2021-04-13 12:03:45,267 [main] INFO  com.abiquo.azureplans.Main - Customer "Customer Name" with identifier XXXXX-XXXXXX-XXXXXX-XXXXX
2021-04-13 12:03:45,267 [main] INFO  com.abiquo.azureplans.Main - 	- Enterprise "Abiquo Enterprise Name" with id 241
2021-04-13 12:03:45,267 [main] INFO  com.abiquo.azureplans.Main - 	- Enterprise "Abiquo Other Enterprise Name " with id 244

For the Azure plans check, in verbose mode, the tool will then create output as shown below. Without verbose mode, only warnings will be shown.

2021-04-13 12:05:37,588 [main] INFO  com.abiquo.azureplans.Main - Customer on CSP "Customer X" with identifier XXXX-XXXX-XXXX-XXXX has all the subscriptions of the azure plan Azure plan with identifier XXXX-XXXX-XXXX-XXXX mapped to Abiquo enterprises
2021-04-13 12:05:44,989 [main] WARN  com.abiquo.azureplans.Main - There's 1 subscriptions missing in Abiquo from the Azure Plan of customer "Customer missing subscriptions" with identifier XXXX-XXXX-XXXX-XXXX. Present subscriptions in Abiquo are: 
-> "Subscription 1" with identifier XXXX-XXXX-XXXX-XXXX mapped to enterprise "Enterprise Abiquo 1" with id 502
-> "Subscription 2" with identifier XXXX-XXXX-XXXX-XXXX mapped to enterprise "Abiquo Enterprise 2" with id 508


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/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. 

You can specify a margin for the log levels of differences between the provider and Abiquo. Differences that are less than or equal to the margin will be INFO level, and differences larger than the margin will be WARN level.

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
2021-04-21 10:43:58,679 WARN  com.abiquo.azureplans.Main - 	-> Cost for enterprise "X Ent 2" with id 56 is X


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.

2021-04-21 10:39:50,956 ERROR com.abiquo.azureplans.Main - Customer with identifier XXXX-XXXX-XXXX-XXXX could not be found in Azure CSP. This could be due that the customer 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.

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


Copyright © 2006-2022, Abiquo Holdings SL. All rights reserved