Code Monkey home page Code Monkey logo

anon1303 / snapshots_data_retrieve Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 47.97 MB

With this program you can effortlessly retrieve detailed information about snapshots from your storage specificaly(ONTAP NETAPP) using its RestAPI. Provide the necessary credentials and specify the volume, the program will handle the rest. It retrieves snapshot data, including creation time and reclaimable space, and saves it to JSON and CSV files

Python 98.47% Shell 1.53%
api api-rest dateutil-python docopt json netapp ontap pandas python python3

snapshots_data_retrieve's Introduction

snapshot.py

Description

snapshot.py is a Python script designed to retrieve information about snapshots from a storage system using its API. It authenticates with the API using provided credentials, retrieves information about snapshots for a specified volume, and saves the snapshot data to JSON and CSV files.

Usage

python snapshot.py <storage> <svm> <volume>

Arguments

  • <storage>: Name of the storage system.
  • <svm>: Name of the Storage Virtual Machine (SVM).
  • <volume>: Name of the volume.

Dependencies

  • base64
  • requests
  • json
  • pandas
  • dateutil.parser
  • docopt
  • Functionality
  • conv_time(time):

Functionality

  1. conv_time(time):

    • Converts the snapshot creation time from ISO 8601 format to a formatted string.
  2. get_headers(username, password):

    • Generates authentication headers for API requests.
  3. get_snapshots(storage, svm, volume, headers):

    • Retrieves information about snapshots for a specified volume.
  4. get_snapshot_data(storage, uuid, headers):

    • Retrieves detailed information about each snapshot, including reclaimable space.
  5. get_volume_uuid(storage, svm, volume, headers):

    • Retrieves the UUID of a volume.
  6. save_to_json(data, filename):

    • Saves JSON data to a file.
  7. save_to_csv(data, filename):

    • Saves JSON data to a CSV file.
  8. main(args):

    • Main function to execute the program. Parses command-line arguments, retrieves snapshot data, and saves it to JSON and CSV files.

Usage Example

python prog.py storage1 svm1 volume1

This command retrieves snapshot data for the volume "volume1" in the SVM "svm1" of the storage system "storage1", and saves the data to JSON and CSV files.

Note: Ensure to replace "storage1", "svm1", and "volume1" with the actual names of your storage system, SVM, and volume, respectively.

Author

anon0313

snapshots_data_retrieve's People

Contributors

anon1303 avatar

Watchers

 avatar  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.