site24x7 exporter #2

Supports: kubernetes

Deploy this charm on Kubernetes with the CLI. Find out how by reading the docs.

Description

Given OAUTH credentials, this charm runs a daemon to take data from site24x7 and expose it to prometheus on port 9803.


Site24x7 Exporter

Description

The Site24x7 service monitors your own services from multiple outside networks in multiple regions, and delivers notifications of outages. This charm runs a prometheus "exporter" which polls the Site24x7 database and exposes metrics in a format that prometheus can ingest.

This allows you to graph these events in grafana, and to refine your own prometheus alert queries to determine when to notify your SREs of an outage.

Usage

Generate Credentials

Your zoho account must have two-factor authentication turned on in order to create these credentials.

The process to generate site24x7 creds is a little indirect. You will create a temporary cred on the site that your account is bound to. It doesn't matter where you connect from, but your account will be hosted by either https://api-console.zoho.com, https://api-console.zoho.eu, https://api-console.zoho.in, or perhaps some other site that did not exist at time of writing. Be sure you consistently use that hostname in all future steps.

  1. Set up a Self Client in the web interface (not any of the "Application" ones). This will provide you with the client_id and client_secret configuration settings.
  2. Go to your client's Generate Code tab and create a temporary code with the Scope of Site24x7.Reports.Read and an expiration of 10 minutes. You can put whatever you like in the comment field.
  3. Use this temporary code and the id and secret from the other tab to fill out a file called curl-secrets:
grant_type=authorization_code&
client_id=1000.DEADBEEFDEADBEEFDEADBEEFDEADBE&
client_secret=deadbeefdeadbeefdeadbeefdeadbeefdeadbeefde&
code=1000.deadbeefdeadbeefdeadbeefdeadbeef.deadbeefdeadbeefdeadbeefdeadbeef

Then run curl https://accounts.zoho.com/oauth/v2/token -X POST -d @curl-secrets (adjusting for your particular zoho TLD). You will get a field back called refresh_token which you'll combine with your client id and secret in the final step:

Build Image

By default, this charm will use the image at https://hub.docker.com/r/site24x7exportercharmers/site24x7exporter, but if you want to build your own you can run make docker (or sudo make docker if you are still affected by this snap bug). Once that's done, you can push the image to your k8s image repo, and set the image_path config option to point to it.

Deploy Charm.

Once you have credentials, you can deploy the charm:

juju deploy cs:~prometheus-site24x7-exporter-charmers/site24x7-exporter --config client_id='1000.DEADBEEFDEADBEEFDEADBEEFDEADBE' --config client_secret='deadbeefdeadbeefdeadbeefdeadbeefdeadbeefde' --config refresh_token='1000.c0defacec0defacec0defacec0deface.c0defacec0defacec0defacec0deface'

Or, if you'd like to use a local build of the charm and image:

juju deploy ./site24x7-exporter.charm --config image_path='localhost:32000/site24x7:latest' --config client_id='1000.DEADBEEFDEADBEEFDEADBEEFDEADBE' --config client_secret='deadbeefdeadbeefdeadbeefdeadbeefdeadbeefde' --config refresh_token='1000.c0defacec0defacec0defacec0deface.c0defacec0defacec0defacec0deface'

Verify

Run curl http://10.1.14.19:9803/metrics based on your most recent unit's IP.

Testing

Just run make test.


Configuration

client_id
(string) The OAUTH 2.0 user ID for your ZohoCorp Site24x7 access. This setting is required.
client_secret
(string) The OAUTH 2.0 secret for your ZohoCorp Site24x7 access. This setting is required.
https_proxy
(string) The URL to an outbound HTTPS proxy.
image_password
(string) The password associated with image_username for accessing the registry specified in image_path.
image_path
(string) The location of the image to use, e.g. "registry.example.com/my_gunicorn_app:v1". This setting is required.
site24x7exportercharmers/site24x7exporter:edge
image_username
(string) The username for accessing the registry specified in image_path.
refresh_token
(string) The OAUTH 2.0 refresh token for your ZohoCorp Site24x7 access. This setting is required.