Abiquo Billing Integration User Guide
See Changes to Abiquo Billing Integration
Overview of the Abiquo Billing Integration
The Abiquo Billing Integration (billing integration) can process Abiquo Accounting data and provide it to a third party billing system to generate customer invoices for Abiquo usage.
The billing integration is a separate stand-alone utility. You should install it on a machine independent of other Abiquo software. It comprises the following components.
- Core Billing Utility: Calculates the usage data and manages it on a 'per account' basis
- Billing Connector: Takes the 'usage' data from the core billing utility and provides it to a third-party billing system.
There are two billing connectors
- CSV: generates CSV files with Abiquo usage data
- DBMS: populates a database table in any suitable MySQL database with Abiquo usage data.
After you configure billing, set up separate processes to:
- Run the billing integration on a regular basis, e.g. with a weekly scheduled task
- Maintain the mappings between Abiquo entities and the billing account IDs
Install and Configure the Billing Integration
To install and configure the Abiquo Billing Integration do these steps.
- Select a suitable billing server to install the software
- It must be able to connect to the main Abiquo database
- In a test environment, it may be the Abiquo Server
- Install billing package by running "yum install abiquo-billing"
- In the Abiquo database
Create a user for billing and grant permissions to the user. For example
CREATE USER 'billing'@'%' IDENTIFIED BY 'mypassword';
GRANT SELECT,EXECUTE ON kinton.* TO 'billing'@'%';
GRANT SELECT ON mysql.proc TO 'billing'@'%';
GRANT SELECT ON kinton_accounting.* TO 'billing'@'%';note: if biling service is in the same host as Abiquo database, the user should be created with 'billing'@'localhost', instead of @'%'.
- Define the Abiquo enterprises and VDCs that the billing integration should generate Usage data for. Add a record for each enterprise or VDC to the account mapping table.
For example, to add mappings for all enterprises you would use the following SQL:
INSERT INTO kinton.billing_account_mapping (idAbiquo, idMappingType, billingAttributeName, billingAttributeValue) (SELECT idEnterprise, 1, 'ENTERPRISE', e.name FROM kinton.enterprise e);
For full details, see Populate the account mapping table for billing.
Note: you must set up a separate process to maintain the account mapping table. For example, you can create a cron job which runs before billing cron job (see step "schedule the billing integration to run automatically"):10 0 * * * root mysql --host specifythedbhost --user root --password yourpass --execute "INSERT IGNORE INTO kinton.billing_account_mapping (idAbiquo, idMappingType, billingAttributeName, billingAttributeValue) (SELECT idEnterprise, 1, 'ENTERPRISE', e.name FROM kinton.enterprise e);"
If you are using the DBMS connector, create a target database and MySQL user account for the billing integration. Do not use the Abiquo database. You must also grant permissions, for example.
CREATE DATABASE abiquo_billing CHARACTER SET=utf8;
CREATE USER 'bill'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON abiquo_billing.* TO 'bill'@'%';note: if biling service is in the same host as Abiquo database, the user should be created with 'billing'@'localhost', instead of @'%'.
On the billing server, configure the billing.properties file in the same folder as the billing.sh script.
Set the connector_name property to "CSV" or "DBMS" for your connector. Also change billing init period to "month". And enter the details of the billing user and IP address to access the Abiquo database.
connector_name=CSV init_period=MONTH
For full details, see Configure billing properties
On the billing server, Configure the connector properties file in the same folder as the billing.sh script.
For the CSV connector, edit csv.properties.
Set the provider_mapping_name property.provider_mapping_name=ENTERPRISE
For full details of CSV connector configuration, see CSV Billing Integration
For the DBMS connector, edit dbms.properties.
Set the provider_mapping_name and also add the credentials for the output databaseprovider_mapping_name=ENTERPRISE
dbms_connection_url=jdbc:mysql://<Bill Data IP Address>:3306/abiquo_billing
dbms_user=bill
dbms_password=passwordFor full details of DBMS connector configuration, see DBMS Billing Integration
Run the billing.sh file ('./billing.sh' from the install directory) to generate the usage data.
Check the generated usage data. CSV files are in the 'CSV_files' folder of the installation directory and DBMS data is in the abiquo_billing_data table in your database.
Schedule the billing integration to run automatically
To generate billing data at regular intervals, e.g. once a week, you can schedule billing integration jobs using programs such as cron. If you are using cron, set the script's current working directory correctly in your cron job. For example, if you have installed the Abiquo Billing Integration into the '/opt/BillingIntegration' folder, then your crontab entry command could look like this:
0 1 * * * cd /opt/abiquo-billing; /bin/bash /opt/abiquo-billing/billing.sh 2>&1 | tee --append /var/log/billing.log
Note that the billing integration automatically tracks which data it has processed for each account, so it should not process usage data more than once.
Sample billing.properties file
This is a sample file only, please use the files provided with your billing integration.
Copyright © 2006-2022, Abiquo Holdings SL. All rights reserved