Export Bluemix Usage - ibm-cloud

We are using Bluemix Cloud Foundry applications and need to capture billing information for reporting purposes. Is anyone aware of how you can export the billing usage from Bluemix into a .csv or any other format?
Thanks.

I haven't it used that much, but you could use the bluemix / bx command with the billing option to retrieve usage and billing information per account or org. You can export it as JSON file.
The following would retrieve the usage for the org "user1#example.com" for the month of April 2017 in JSON format:
bx billing org-usage user1#example.com -d 2017-04 --json

Related

AWS Billing Service not included in Golang AWS SDK

I see that the AWS Billing service was not included into the Golang SDK
We need to make a Lambda to connect with this service and collect the monthly billing to make a dashboard.
How can we do that ?
Regards
The go sdk's cost explorer package gives access to the aws cost explorer api:
You can use the Cost Explorer API to programmatically query your cost and usage data

Is there an IBM Cloud API call to retreive the account name?

The account settings page (Manage > Account > Account Settings) lists an account ID and an account name under the "Account" heading. The account ID is easy enough to retrieve using the API, but I've not found a way to get the account name. Is this possible to get using the API?
I've been looking at the IBM Cloud API Docs and at the Softlayer API docs but haven't been able to find something which returns the account name.
The ibmcloud CLI returns the info, but I'd rather not have to use the CLI since this will be used from within a Python app.
You can always use IBMCLOUD_TRACE=true on the CLI to find out what the ibmcloud command is doing. What you see as "account name" is the ID resolved by going to the user management API.

Couldn't target the organization using CF CLI

I am learning to use Bluemix and was trying to access my application using the Cloud Foundry command-line interface. But after logging in using my Bluemix ID at the CF CLI, I am not able to target the organization. On the Bluemix dashboard in my browser, the organization is visible. Is there a bug?
After running cf login some organisation should have been set as the target.
Run cf target to get the current target information
Run cf orgs to get the available organisations
Run cf spaces to get the available spaces in the organisation
Run cf target -o organisation_name -s space_name to target the correct organisation and space
Each organisation can have multiple spaces. Each space can have multiple applications. With the correct organisation and space set as targets the currently deployed applications can be listed with cf apps.
Organisations can span regions but may not. Check if the organisation is present in other regions by changing the API endpoint.
US South https://api.ng.bluemix.net
UK https://api.eu-gb.bluemix.net
Sydney https://api.au-syd.bluemix.net
change the region API endpoint to the region that appears in your account

Accessing Bluemix Account Usage via Platform API

Is there a way to programmatically (via REST api) access the usage of service within a public bluemix account?
Does Public Bluemix exposes API to access the usage history of bluemix account
Updated answer:
You can use the following Bluemix CLI command to retrieve the monthly usage and costs of your account:
bluemix bss account-usage [-d YYYY-MM] [--json]
Prerequisites: Endpoint, Login
Command options:
-d MONTH_DATE (optional)
Display data for month and date specifying by using the YYYY-MM format. If not specified, usage of the current month is shown.
--json (optional)
Display the usage result in JSON format.
Here's an example that show an account usage and cost report in 2016-06:
bluemix bss account-usage -d 2016-06
If you run the command with "export BLUEMIX_TRACE=true”, you can see the API endpoints that are being used.
There are other commands and more information available at the following URL:
https://console.ng.bluemix.net/docs/cli/reference/bluemix_cli/index.html#bluemix_bss_account_usage

is it possible to retrieve the app/service usage information ( the fee/the money) via api?

Is it possible to retrieve the app/service usage information ( the fee/the money) via api?
I noticed that my current cf command 's version is 2.40.0
API endpoint: https://api.ng.bluemix.net (API version: 2.40.0)
I checked the api list and cannot find any useful information about my request.
Billing information for Bluemix services and application usage is not available through an API; it is only available through the Bluemix console. However, feel free to submit the request on the IBM Bluemix Ideas site for future consideration. Bluemix Project Management reviews the ideas regularly.
Using CF CLI you could use:
cf curl /v2/organizations/ORG_GUID/summary
to retrieve the org guid you can use
cf org <orgName> --guid
This provides you information about the number of services and applications, and the memory usage.