Report Historical Usage Data
Overview⚓︎
The Report Usage Tool is used to upload historical Usagemeter data to a Hydrolix cluster's stream ingest endpoint. This data can be gathered from any cluster and sent to any other cluster, but the primary use-case is to gather data from a customer's cluster and send their usage data to Argus. The time range is configurable, as are the project, table, and transform to which data can be sent. The Report Usage Tool itself must be run on the cluster for which usage data is being reported.
Setup⚓︎
Prerequisites⚓︎
- You should have already deployed a Tooling pod by following the steps on the tooling pod page.
- You should have access to the Hydrolix
DevAccessAWS account. - You will need an AWS IAM Security Credential (Access Key ID, Secret Access Key) with the following policies: AdministratorAccess, AmazonS3FullAccess
Instructions⚓︎
Determine the Latest build:intake Job URL (Automatic, Recommended)⚓︎
Security and Shell History
This method of determining the URL of the latest build:intake job requires running a shell command that assigns a Gitlab personal access token to an environment variable, which risks saving your personal accces token in your shell history. Some simple ways to avoid this are, for example:
Bash
- Create a Gitlab Personal Access Token with permission scope:
read_api. -
In your local shell, execute the following (retaining the preceding space if you've run one of the commands above to avoid saving the command within your shell history):
-
Create a file named
get-latest-build-intake-job.shwith the following contents: -
Now execute the script with
./get-latest-build-intake-job.sh. You should receive output containing the build job URL, for example:
Permissions
When you run ./get-latest-build-intake-job.sh, if the output is similar to
The value for GITLAB_PROJECT_ID is the project ID of Turbine which contains the job that builds the artifact we will be using.
If these steps did not work, follow the steps catalogued under Determine the Build Artifact URL (Manual)
Determine the Latest build:intake Job URL (Manual)⚓︎
Construct the URL to the latest binary generated from the build:intake job.
- Navigate to the Turbine Jobs UI
- Run cmd+f (Mac) or ctrl+f (Windows/Linux) for "build:intake" to locate the latest completed
build:intakejob and select the job. - This should take you to a URL that is similar to
https://gitlab.com/hydrolix/turbine/-/jobs/9055185069.
Determine S3 Location of Build Artifact⚓︎
- Navigating to the URL you obtained previously, verify the existence a line similar to
UPLOAD_PATH="s3://gitlab-drop/builds/$INTAKE_ID"in the log output. -
Locate the value of the variable
$INTAKE_ID. Using this job output as an example, that value would beturbine-intake-46653f7d.tgz. The full URL of the build artifact containing the Report Usage tool is therefores3://gitlab-drop/builds/turbine-intake-46653f7d.tgz -
Shell into the tooling pod within the cluster whose usage data you want to send. You can do this by connecting to the cluster using K9s then running the command
:pods, navigating to the Tooling pod (for example,tooling-xxxxxxxx-xxxxx), and pressings. Within the pod, execute the following commands: -
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" --output awscliv2.zip unzip awscliv2.zip./aws/installaws configure- Provide the following:
- AWS Access Key Id
- AWS Secret Key
- Region:
us-east-2 - Default output format [None]: {press enter for None}
AWS Credential: Required Permissions
Remember that you need your Access Key ID and Secret Access Key credentials to be linked to a user with the following attached policies:AdministratorAccess, AmazonS3FullAccess
aws s3 cp s3://gitlab-drop/builds/turbine-intake-{build_id}.tgz .
You Can Supply Region as a Flag
You can append --region us-east-2 to the aws s3 cp command to set the region
tar -xvzf turbine-intake-{build_id}.tgzcd bin
Execution⚓︎
Now that you are in the /bin directory, you can run the Report Usage tool with a command similar to the following.
You should at minimum replace values for the following flags:
The remaining flags are optional, they are empty strings by default, and they can be set via their corresponding environment variables:
User Commands⚓︎
Included are the following catalog-related options:
Example Transform⚓︎
If you are sending Usagemeter data to a Hydrolix cluster that doesn't already have a transform compatible with Usagemeter-formatted data, you can use or adapt the following transform:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |