/netstorage-report

Python script to create an Akamai NetStorage usage report

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Akamai NetStorage Report

Python script to create a space usage report of directories of an Akamai NetStorage account and send it via email.

This script is most useful for resellers when they have access to a single storage group and have a sub-directory inside of it for each one of its customers.

Prerequisites

Usage

  1. Configure your Akamai API credentials on .netstoragekit.json:
{
    "key_name": "kay_name",
    "key": "api_key",
    "host": "NS hostame",
    "cpcode": "Akamai cpcode"
}
  1. Clone this repo and set the following environment variables:
  • REMOTEPATH: Path inside the NetStorage account from where to start calculating the space usage. Default is /.
  • SMTP_FROM= Email address to send the report from.
  • SMTP_TO= Email address where to send the report.
  1. Run the script:
$ python ./netstorage_report.py

Sample Output

--------- ------ --------
NetStorage Report Program
--------- ------ --------


Sending report to: foo@bar.com

companyA          : 18.87 GB            
companyB          : 0 B                 
companyC          : 1.98 GB             
companyD          : 240.84 GB           
companyE          : 1.68 MB             
companyF          : 310.63 MB           

Total             : 262.01 GB

Docker image

There is available a docker image that can be used to schedule the report using cron. Check out the docker-compose.yml file to use it. To set the time for the report you can use the environment variable CRONJOB_TIME in cron format.