Skip to content

Cloud Efficiency to show utilization for various VPs and Product Lines

License

Notifications You must be signed in to change notification settings

Symantec/cloudefficiency

Repository files navigation

Cloud Efficiency Report

Screenshot

To run the report

  1. install minikube https://kubernetes.io/docs/tasks/tools/install-minikube/

  2. To run:

eval $(minikube docker-env)
docker build -t cloudefficiency .
kubectl create secret generic cloudefficiency-config --from-file=./report/config.json --from-file=./frontend/src/config.js
kubectl create secret generic cloudefficiency-aws-credentials --from-file=~/.aws
export BUCKET=mybucket
export DATA_BUCKET=mydatabucket
export AWS_PROFILE=myprofile
envsubst < cronjob.yaml | kubectl create -f -
kubectl create job --from=cronjob/cloudefficiency-cronjob cloudefficiency-job

or

docker build . -t cloudefficiency
docker run -it \
  -v `pwd`'/frontend/src/config.js:/app/frontend/src/config.js' \
  -v `pwd`'/report/config.json:/app/report/config.json' \
  -v "$HOME/.aws/:/root/.aws/" \
  -e "BUCKET=$BUCKET" \
  -e "DATA_BUCKET=$DATA_BUCKET" \
  -e "AWS_PROFILE=$AWS_PROFILE" \
  cloudefficiency

EC2 c-type instance cost/waste interactive reports by team and manager.

Three stages to produce EC2 c-type instance cost/waste interactive reports. ldap data + instance data -> user hierarchy and instance data -> static html/js isomorphic React pages.

First two stages in python

python3 -m report.allocate_efficiency

preparing raw data

  1. gets ldap data for user hierarchy, and dl lists.
  2. gets rightsizing recommendations for instances from cloudability.

caches data to:

  • ldap_entries.pickle
  • dl_owners.pickle
  • rightsizing_cache.json

attributing ownership

  1. assigns cost and waste to each individual
  2. aggregate costs and wastes up reporting chain

outputs:

  • allInstances.js jsonp file
  • allUsers.js jsonp file

mv all*.js to frontend/src/

generating reports

node ./dist/generate_files.js

cwd has ./output/*.html ./public/index.css has styling ./public/bundle.js has js and user/instance data

Testing

Frontend

Frontend code is tested with Jest and Enzyme. To run tests: npm test

Debugging

Frontend

either insert console.log statements, or you can debug using jest: node --inspect-brk node_modules/.bin/jest --runInBand and open chrome://inspect in chrome [more details](https://jestjs.io/docs/en/troubleshooting_

Configuration files

logo.svg in frontend/public/logo.svg config.js in frontend/src/config.js

const awsmobile = {
    'aws_app_analytics': 'enable',
    'aws_mobile_analytics_app_id': <string>,
    'aws_mobile_analytics_app_region': <string>,
    'aws_project_id': <string>,
    'aws_project_name': <string>,
    'aws_project_region': <string>,
    'aws_resource_name_prefix': <string>
}
const VPLIST = [<string>...]
const HELP_LINK = 'https://slack.com/app_redirect?channel=cloudefficiency';
const HELP_TEXT = 'slack channel';

export { awsmobile, VPLIST, HELP_TEXT, HELP_LINK };

config.json in report/config.json

{
  "ldap_url": <string>,
  "ldap_port": <number>,
  "ldap_basedn": <string>,
  "ldap_binddn": <string>,
  "ldap_bindpw": <string>,
  "ldab_dl_basedn": <string>,
  "ldap_dl_search_filter_template": <string>,
  "ldap_search_filter": <string>,
  "ldap_searchreq_attrlist": [<string>...],
  "ldap_users_cache_file": <filename>,
  "ldap_cache_time": <number>,
  "cloudability_api_key": <string>,
  "VP_LIST": [<string>...]
}

Analytics Events

Root Render (document.referrer, page) { name: 'appRender' });

Analytics.updateEndpoint({ page: ..., referrer: ..., })

click CPE logo { name: 'click', attributes: { target: 'logo' }, });

click issues { name: 'click', attributes: { target: 'issues' }, });

click help { name: 'click', attributes: { target: 'help' }, });

click teammember { name: 'click', attributes: { target: 'teammember', targetUser: 'name' }, });

click manager { name: 'click', attributes: { target: 'manager', targetUser: 'name' }, });

click owner { name: 'click', attributes: { target: 'instanceOwner', targetUser: 'name', targetInstance: 'id' }, });

click ownerVp { name: 'click', attributes: { target: 'pwmerVP', targetUser: 'name', targetInstance: 'id' }, });

hover tooltip { name: 'tooltip', attributes: { target: 'leadership' | 'user' | 'id' | 'type' | 'suggest' | 'waste' | 'cost' | 'owner' | 'vpOwner' | 'attribution', 'moneyExplanation, }, }); { name: 'tooltip', attributes: { target: 'attribution', targetUser: 'name' }, });

About

Cloud Efficiency to show utilization for various VPs and Product Lines

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published