-
Notifications
You must be signed in to change notification settings - Fork 86
Upload Plan
To learn how to upload and update your metering plan, watch the available videos:
- A demo video showing how to update your metering plan in the dashboard.
- A demo video showing how to create and update your metering service instance plan definition via the command line.
Example applications:
- Java project on how to send usage data to Abacus and how to get report back.
- Node.js example application that can re-send metering data
Run the following commands:
# List all the services available to your organization and space
cf marketplace
# Create three sample empty plans
cf create-service metering standard <metering-service>
# Bind the metering service to your application
cf bind-service <myapp> <metering-service>
# Update app environment to access the metering service instance
cf restart <myapp>
Execute cf update-service <myservice> -c <metering plan configuration>
1
🚨 To use the service dashboard, first bind an application to your Abacus service instance. 🚨
Get the dashboard URL:
cf service <metering-service>
Showing info of service <metering-service> in org <org> / space <space> as <user> ...
name: <metering-service>
service: metering
bound apps: <myapp>
tags:
plan: standard
description: Resource consumption service based on cf-abacus
documentation:
dashboard: <url>
Log on using the dashboard URL above.
The dashboard shows the metering plan for the resource provider application that is bound to the service instance. The metering plan has a sample Measure and a sample Metric. It allows you to:
- Navigate to metering plan - maintain the Measures and Metrics of the metering plan
- Measures tab - add/edit/delete the Measures for the metering plan
- Metrics tab - add/edit/delete the Metrics for the metering plan
- Navigate to a metric - maintain the details of the metric and its relevant functions - meter, accumulate, aggregate, and summarize.
Note: The abacus wiki provides sample plans.
Metering plan configuration can be provided inline command line, or in a file on your local file system. Only one metering plan is supported.
You can use the configuration in create-service
and update-service
commands. For example:
cf create-service metering standard <myservice> -c <metering plan configuration>
1
The default plan schema can be embedded in plan config:
{
"plans": [
{
"plan": {
"plan_id": "standard-object-storage",
"measures": [
{
"name": "storage",
"unit": "BYTE"
}
],
"metrics": [
{
"name": "storage",
"unit": "GIGABYTE",
"type": "discrete",
"meter": "(m) => new BigNumber(m.storage || 0).div(1073741824).toNumber()",
"accumulate": "(a, qty, start, end, from, to, twCell) => end < from || end >= to ? null : Math.max(a, qty)"
}
]
},
"resource_provider": {
"service_name": "<name_of_your_service>",
"service_plan_name": "<name_of_your_service_plan>"
}
}
]
}
<< Create a Plan | Submit Usage >> |
---|
ABOUT | RESOURCE PROVIDER | ABACUS INTEGRATOR
*Abacus icon made by Freepik from www.flaticon.com