Metered Billing
This document describes how Puppet Managed Services report data to Odoo for service billing based on the measured usage.
More information regarding the metered billing at VSHN can be found at docs.central.vshn.ch.
Summary
The metered usage is leveraging the existing PuppetDB to determine billed services and components. Puppet profiles instantiate a defined resource type Billing which defines what unit and Odoo product ID should be used and to which sales order the usage of a specifc service should be reported.
The Puppet-Odoo metered billing reporting will periodically query the PuppetDB for all Billing
resources and submit them to VSHN central’s usage data ingestion endpoint
Enable metered billing in a Puppet profile
To enable metered billing for a Puppet profile, that profile needs to define a billing resource:
profile_example (
...,
Billing::Options $billing_custom_options = {},
Optional[Boolean] $billing_reporting = undef,
Optional[String] $billing_sales_order_id = undef,
...,
){
# in the profile, only suppress reporting if it is set to false explicitly,
# otherwise rely on the the global reporting configuration evaluated in the
# billing define type
if $billing_reporting or $billing_reporting =~ Undef {
billing { "${trusted['certname']}-${title}":
product_id => 'managed-service-...',
reporting => $billing_reporting,
sales_order_id => $billing_sales_order_id,
* => $billing_custom_options,
}
}
}
|
Product bundles
Some Puppet profiles may bundle multiple profiles, meaning a puppet profile may replace other profiles from a billing point of view.
Such profiles may be passed to bundled_products
of the billing type:
billing { "${trusted['certname']}-${title}":
product_id => 'managed-service-graylog',
bundled_products => [
'managed-service-elasticsearch',
'managed-service-mongodb',
'managed-service-nginx',
],
...
}
|
Set billing information in Hiera
For a resource to be processed in the metered billing, it needs to know to what sales order it should be reported. The sales_order_id
needs to be configured in hiera:
billing::sales_order_id: 'Sxxxxx'
Alternatively, if different profiles should report to different sales orders, the sales_order_id
may be overridden on a per-profile basis:
billing::sales_order_id: 'Syyyyy'
profile_specialservice::billing_sales_order_id: 'Szzzzz'
Check with Sales & Account Management for the correct sales order to use for a specific project/service |
Deployment
The reporting is deployed using the billing::reporting profile, multiple instances (f.e. one per Odoo environment) can be deployed in parallel.
Currently the billing reporting is deployed on management2.corp.vshn.net
.