HewlettPackard / hpecli

Command-line interface for HPE products and services
Apache License 2.0
10 stars 9 forks source link

hpecli analytics using Google Analytics Events #73

Closed Didier-Lalli closed 4 years ago

Didier-Lalli commented 4 years ago

Enable/disable

We would need a way to enable/disable analytics.

I’m thinking

hpecli analytics --on hpecli analytics --off

This should store in our db the desired state. Initial state should be enabled.

User id

We need each instance of a hpecli (client) to have a UUID which we will use when posting events. It should be stored in db. If there is no UUID in db then we should generate one.

Posting events

If analytics is enabled, at the end of a command (need to decide where exactly that is) we need to initiate a call to Google analytics using:

POST https://www.google-analytics.com/collect?v=1&tid=UA-159515478-1&t=event&ea=login&ev=200&an=hpecli&av=0.0.1&ec=oneview&ua=hpecli/0.0.1&cid=555

with: the first params are constants the rest:

ec=first verb (oneview, ilo, version, update, help…) ea=second verb (login, get, logout, context) for verbs like get we can use el=third verb (enclosures, servers) ev=status of command (this is a numeric value like 200, 404, 401…) – This needs a little bit of thinking. What code de we return. cid=UUID of the client

reddypramod85 commented 4 years ago

$./hpe analytics status Anonymous analytics reporting is enabled $ ./hpe analytics on Anonymous analytics reporting has been enabled $ ./hpe analytics off Anonymous analytics reporting has been disabled

Tested analytics for greenlake login command

Analytics should be implemented and tested for other modules also( oneview,ilo, greenlake, etc)