Obtains Google Analytics RealTime metrics, and presents them to prometheus for scraping.
100K+
Obtains Google Analytics RealTime metrics, and presents them to prometheus for scraping.
Ensure Dep is installed.
Copy your Google creds json file to ./config/ga_creds.json. The email from the json must be added to the GA project permissions, more on that bellow.
Create yaml configuration file (./config/config.yaml):.
promport: 9100
interval: 60
viewid: ga:123456789
metrics:
- rt:pageviews
- rt:activeUsers
Install dependencies, compile and run.
dep init
go build ganalytics.go
./ganalytics
or
dep init
go run ganalytics.go
From your Google Analytics Web UI: Admin (Low left) ==> View Settings (far right tab, named VIEW)'
View ID should be among Basic Settings. Prefix ga: must be added to the ID, e.g. ga:1234556 while adding it to the config.
Google API manager allows to create OAuth 2.0 credentials for Google APIs. Use Service account key credentials type, upon creation a json creds file will be provided. Project RO permissions should be sufficient.
The email from GA API creds must be added to analytics project metrics will be obtained from.>
brew install go --with-cc-commoncreds.json and config.yaml expected to be in ./config/CGO_ENABLED=0 GOOS=linux go build -ldflags "-s" -a -installsuffix cgo ganalytics.go
docker build -t ganalytics .
docker run -it -p 9100:9100 -v $(pwd)/config:/ga/config ganalytics
Pavel Snagovsky, [email protected] Yuri Adams, [email protected]
Licensed under the terms of MIT license, see LICENSE file
Content type
Image
Digest
Size
264.6 MB
Last updated
over 8 years ago
docker pull palp/googleanalytics_exporter