Coder Social home page Coder Social logo

pt-bhavsar / apigeeedge-api-traffic-summarizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dinochiesa/apigeeedge-api-traffic-summarizer

0.0 1.0 0.0 477 KB

A nodejs command-line tool that produces a summary sheet of traffic for an Apigee Edge organization

License: Apache License 2.0

JavaScript 100.00%

apigeeedge-api-traffic-summarizer's Introduction

Apigee Edge Traffic Summarizer

This tool queries the Edge Analytics API to retrieve message_count (traffic volume) statistics for an organization, over a given year.

There are two options for output:

  • emit into a .csv file, which can then be imported into a Spreadsheet for further analysis.
  • automatically generate a Google Sheet containing the data. This also generates charts.

Disclaimer

This example is not an official Google product, nor is it part of an official Google product.

LICENSE

This material is copyright 2018-2020 Google LLC. and is licensed under the Apache 2.0 license. See the LICENSE file.

Usage

$  node ./trafficByApiSummarizer.js
Apigee Edge Analytics Summarizer tool, version: 20180906-2128
Node.js v10.5.0

You must specify an organization
Usage:
  node trafficByApiSummarizer.js [OPTION]

Options:
  -o, --org=ARG        required. name of the Edge organization
  -M, --mgmtserver=ARG the Edge mgmt server endpoint. Defaults to https://api.enterprise.apigee.com .
  -u, --username=ARG   optional. username for authenticating to Edge
  -Z, --ssoZone=ARG    optional. SSO Zone name for authenticating to SAML-enabled Edge
  -n, --netrc          optional. specify in lieu of username to rely on .netrc for credentials.
  -P, --prior          optional. use the prior year or month. Default: the current year/month.
  -m, --bymonth        optional. collect data for the month. Default: collect data for the current year.
  -v, --verbose        optional. verbose output.
  -S, --sheet          optional. create a Google Sheet with the data. Default: emit .csv file.
  -N, --nocache        optional. do not use cached data; retrieve from stats API
  -h, --help           display this help

Example 1

Generate a Google sheets document that summarizes the traffic volume data for the current year, for an organization.

  • option 1: prompt for password
    node ./trafficByApiSummarizer.js -v -u [email protected] -o my-org-name -S
    
  • option 2: using .netrc
    node ./trafficByApiSummarizer.js -v -n -o my-org-name -S
    

In the first case, the script will prompt the user for an administrative password to Apigee in order to query the Admin API. In the second case the script will use the credentials in the .netrc file for api.enterprise.apigee.com.

In both cases, the user will separately be prompted to authenticate to Google, in order to grant consent to the "API Traffic Summarizer" app to generate a spreadsheet. Though the scope allows the tool to create and view sheets, the tool merely creates a new sheet. It does not read any existing sheets stored in Google drive.

The tool will perform several queries to the /stats API for Apigee, then with the resulting data, will create a spreadsheet with 2 sheets and 2 charts; one sheet will list the "per API Proxy" traffic volumes, and one will summarize the traffic by environment. Then 2 charts corresponding to the data in those sheets.

Sheet1

Chart1

This can take a long time to run, if there's lots of data. You may want to use the -v option to see verbose output.

Example 2

Generate a Google sheets document that summarizes the traffic volume data since July 2017, for an organization.

node ./trafficByApiSummarizer.js -n -v -o my-org-name  -S --start 201707

Example 3

Generate a .csv file that summarizes the traffic volume data for the current year, for an Edge organization.

 node ./trafficByApiSummarizer.js -n -o my-org-name

When you invoke the program without the -S option, a .csv file is emitted, and no Google sheets document is created. The .csv file includes the raw "per API proxy" data. It does not include a rollup of "per environment". Again, this can take a long time to run.

Example 4

Generate a .csv file that summarizes the traffic volume data, by month, for the prior year (-P) for an Edge organization.

 node ./trafficByApiSummarizer.js -n -o my-org-name -P

Example 5

Generate a google sheet that summarizes the traffic volume data, by day, for the prior month, for an organization.

 node ./trafficByApiSummarizer.js -n -o my-org-name -d -P -S

Bugs

none?

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.