GithubHelp home page GithubHelp logo

mauriciodeliz / oci-costs-csv-json Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 33 KB

Script used to collect DATA (FOCUS - OCI)

License: GNU General Public License v3.0

Python 100.00%
cloud costs oci python

oci-costs-csv-json's Introduction

  • OCI Costs from FOCUS Report - LastDay (Example: Running today, get data from yesterday)

๐Ÿ“Š FOCUS Reports Backup Script This script is designed to download and process OCI (Oracle Cloud Infrastructure) FOCUS reports. It retrieves daily report files, decompresses them, processes the data, and outputs relevant information in JSON format. The script also calculates and formats the total billed cost.

๐Ÿ› ๏ธ Dependencies Python 3.x OCI library (oci) - Setup de default configuration ~/.oci/config Standard Python libraries: os, csv, json, glob, gzip, datetime, locale

๐Ÿ“ Script Overview Locale Setup

Sets the locale to pt_BR.UTF-8 for formatting numbers and currency in Brazilian Portuguese. Directory Setup

Creates the /tmp/oci directory if it doesn't exist to store downloaded files temporarily. OCI Configuration

Loads OCI configuration from the default configuration file and profile. Date Configuration

Sets the date prefix for the previous day's reports. Object Storage Client Initialization

Initializes the OCI Object Storage client. Report Download

Lists and downloads report files from the OCI bucket for the previous day. Saves downloaded files to the destination path. CSV Processing

Decompresses .gz files. Reads CSV files and filters relevant data fields. Calculates the total billed cost. JSON Output

Converts filtered data to JSON format and prints it. Prints the total billed cost in Brazilian Reais (R$).

โš ๏ธ Error Handling The script includes basic error handling for OCI service errors during the report download phase. It will print the error message if any issues occur while retrieving object metadata.

  • Process running

focus-download

  • Result

image

oci-costs-csv-json's People

Contributors

mauriciodeliz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.