Multitenancy Setup

This section describes how to create new tenants (also called organizations) in the replex software.

The user who can set up another organization/tenant must have a SUPER_ADMIN role.

If you do not yet have your authentication token, you must first log in to receive the token. If you already have the token, you can jump to step 3 and use the token in the authentication header.

  1. Ensure the replex API is accessible.

If you have exposed the API over a public URL, then you can use that. Otherwise, access the API locally by port-forwarding the service with the following command:

kubectl port-forward --namespace replex svc/replex-server 3100

The following steps will assume the replex API is running at http://localhost:3100.

  1. Login with super admin credentials.

Next you'll login to the API to retrieve your authentication token for further requests to the API.

curl --location --request POST 'http://localhost:3100/api/v1/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "<SUPER_ADMIN_EMAIL>",
    "password": "<SUPER_ADMIN_PASSWORD>",
    "tenant": "<UNIQUE_ORGANIZATION_ID>"

The output will be similar to:

  "status": true,
  "data": { "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmdh...." }

The contents of the data.token field is the authentication token we need.

  1. Call the 'create organization' endpoint.

curl --location --request POST 'http://localhost:3100/api/v1/organizations' \
--header 'Authorization: Bearer <TOKEN_FROM_PREVIOUS_STEP>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "<NEW_ORGANIZATION_NAME>",
    "email": "<ORGANIZATION_EMAIL>",
        "firstName": "--",
        "lastName": "--",
        "password": "--"

A user with the user details provided in admin is automatically created for the new tenant. The login details are the values in email and admin.password.

NOTE: The user that creates the new tenant is not automatically a member of the new tenant, but they can login to the tenant because the software allows SUPER_ADMIN users to login to any tenant on an installation.

The output will be similar to:

  "status": true,
  "data": {
    "id": "eafedacd-4fba-4d31-be52-69567262a372",
    "defaultCurrency": "USD",
    "billingStatus": true,
    "name": "New Organization",
    "email": "",
    "tenantID": "neworganization",
    "active": true,
    "updated_at": "2020-10-20T15:54:48.100Z",
    "created_at": "2020-10-20T15:54:48.100Z"

The new organization/tenancy has been successfully created.

Once the software detects that more than one tenant exists, it automatically adds a new 'Tenant ID' field to the login form. The value of this field is the tenant you want to log in to. The email / password combination must exist in the tenant.

  1. Generate Replex token.

For configuring replex agents a Replex token is needed. To generate the token we need the organization ID from the previous step to specify for which organization we want to generate a token. The ID can be found in the response under We'll make use of the authentication token to get the Replex token:

curl --location --request GET 'http://localhost:3100/api/v1/organizations/<ORGANIZATION_ID_FROM_PREVIOUS_STEP>/token' \
--header 'Authorization: Bearer <TOKEN_FROM_STEP_3>'

The response contains a new token which can be used as the replex.token Helm parameter in the agent Helm chart.

Replex filter query language

This section describes cluster stats querying basics and provides examples.

NOTE: Examples below require authentication token, that can be retrieved at 'http://localhost:3100/api/v1/auth/login' An instruction can be found in the section Multitenancy Setup above on the step 2.

Cluster stats endpoints supports different parameters depending on the type of resource. Assume that a labels range stats endpoint is queried. It requires a couple of parameters:

  • start: timestamp that represents the beginning of the period where to start aggregate metrics.

  • end: timestamp that represents the end of the period where to stop aggregating metrics.

  • filters: a query string in Lucene query syntax.

  • clusterID: the unique ID of the cluster to query stats for.

Available lucene keys to filter by are:

  • labels.<LABEL_NAME>:<LABEL_VALUE> - represents resource labels, where key is LABEL_NAME and value is LABEL_VALUE, e.g.

  • namespace:<NAMESPACE_NAME> - represents resources namespace, e.g. namespace:monitoring.

  • key:<LABEL_NAME> - represents label name that must appear in stats, e.g. key:app.

A basic examples of filters parameter to query stats:

Environment Variables

These are the environment variables used by the application:

Last updated