Get a table of costs

What:
Is there a table of costs for resources accessible by API / JSON ?

There is this page of course: https://www.linode.com/pricing/

But I'd have to web scrape it, which isn't elegant.

Why:
I'm a sysadmin for an organization using linode. I don't have billing access - separation of duties - but I'd like to keep a rough tally of of the monthly cost as resources are spun up, turned off, etc.

I have in mind a script that can fire up daily, use linode-cli to tally my assets, query the table for costs, and store a running tally for the month.

Thanks,

5 Replies

For Linodes:
The api has the hourly cost and the monthly cap for each linode type along with similar values for the backups.

The account view in the api has balance_uninvoiced that shows the current running total (I'm not sure if this one shows to a limited account or not).

If you know the number of Linodes, which plans they’re on, and any extras like block storage, you could pretty much figure out the monthly bill.

Any Linode’s not running, but still on the account still get billed at the monthly rate.

Anything more detailed would probably require billing access.

@millisa Thanks! I'd missed this in the API

"price": {
"hourly": 0.008,
"monthly": 5

@LouWestin

Anything more detailed would probably require billing access.

Thanks for the input. I'm not looking to be super detailed, just have an idea of the cost without bugging the guy who has billing control.

@bdunbar NP. Also forgot to mention Linode backups too.

Hi,
I would like to ask how to get access to fields values into types client. I've done:
types = client.linode.types()

and got a print of the first type doing:
pp.pprint(vars(types[0]))

And the output is:
{'_client': <linode_api4.linode_client.linodeclient 0x0000015aa5516c10="" at="" object="">,
'_last_updated': datetime.datetime(2022, 5, 6, 15, 37, 13, 67033),
'_populated': True,
'_raw_json': {'addons': {'backups': {'price': {'hourly': 0.003,
'monthly': 2.0}}},
'class': 'nanode',
'disk': 25600,
'gpus': 0,
'id': 'g6-nanode-1',
'label': 'Nanode 1GB',
'memory': 1024,
'network_out': 1000,
'price': {'hourly': 0.0075, 'monthly': 5.0},
'successor': None,
'transfer': 1000,
'vcpus': 1},
'addons': Mapping containing dict_keys(['backups']),
'disk': 25600,
'gpus': 0,
'id': 'g6-nanode-1',
'label': 'Nanode 1GB',
'memory': 1024,
'network_out': 1000,
'price': Mapping containing dict_keys(['hourly', 'monthly']),
'transfer': 1000,
'type_class': 'nanode',
'vcpus': 1}</linode_api4.linode_client.linodeclient>

But how do I address each of the fields into this output? It seems a dictio, but I've tried
pp.pprint(vars(types[0]['type_class'])) #and the same with other keys

and I get:
TypeError: 'Type' object is not subscriptable

Thanks in advance.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct