Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Subscription Usage cost (monthly) #423

Open
kTipSSIoYv opened this issue Aug 22, 2022 · 8 comments
Open

Get Subscription Usage cost (monthly) #423

kTipSSIoYv opened this issue Aug 22, 2022 · 8 comments

Comments

@kTipSSIoYv
Copy link

kTipSSIoYv commented Aug 22, 2022

@Fryguy The Azure::Armrest::Billing::UsageService returns detail billing of each resources. Is there a way to get the total cost of all resources? I mean total cost of subscription for the defined period?

BILLING = Azure::Armrest::Billing::UsageService.new(conf)  
  
options = {:reportedStartTime => '2022-08-01T00:00:00Z', :reportedEndTime => '2022-08-02T00:00:00Z', :aggregationGranularity  => 'Daily', :ShowDetails => 'false'}
@Fryguy
Copy link
Member

Fryguy commented Aug 22, 2022

Not sure - I don't really use the library or the azure API. Perhaps @djberg96 knows?

@djberg96
Copy link
Collaborator

I'm afraid I don't know, sorry.

@kTipSSIoYv
Copy link
Author

kTipSSIoYv commented Aug 23, 2022

@Fryguy @agrare Ruby doc shows that we can use azure_mgmt_consumption.

But I can't install that on the docker container. I get error. Is this already included or is there a way to install these?

I'm not sure why I can't install these. I could install aws-sdk fine on the container without issues.

sh-4.4# gem install azure_mgmt_consumption
Building native extensions. This could take a while...
ERROR:  Error installing azure_mgmt_consumption:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/share/gems/gems/unf_ext-0.0.8.2/ext/unf_ext
/usr/bin/ruby -I /usr/share/rubygems -r ./siteconf20220823-31870-17iu7iu.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/unf_ext-0.0.8.2 for inspection.
Results logged to /usr/local/lib64/gems/ruby/unf_ext-0.0.8.2/gem_make.out


@Fryguy
Copy link
Member

Fryguy commented Aug 23, 2022

Looks like azure_mgmt_consumption is a C extensions, and we don't have the C headers in the docker image (we do that at build time).

@djberg96
Copy link
Collaborator

Weird that it's a C extension. Looks like y'all need to wrap their consumption REST API: https://docs.microsoft.com/en-us/rest/api/consumption/

Though that only works for enterprise accounts I think.

@Fryguy
Copy link
Member

Fryguy commented Aug 31, 2022

I think that's the one that @kTipSSIoYv is suggesting (that article points to https://rubygems.org/gems/azure_mgmt_consumption)

@agrare
Copy link
Member

agrare commented Sep 2, 2022

It is important to note that the azure_mgmt_* gems are deprecated and are not being updated so if we want to use consumption data I think we should hit the rest api directly as @djberg96 mentioned rather than trying to use azure_mgmt_consumption

@miq-bot
Copy link
Member

miq-bot commented Feb 27, 2023

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.

@miq-bot miq-bot added the stale label Feb 27, 2023
@Fryguy Fryguy removed the stale label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants