Skip to content
On this page

Java

Create Service

To experience the full power of GreptimeCloud, you need to create a service which contains a database with authentication. Open the GreptimeCloud console, signup and login. Then click the New Service button and config the following:

  • Service Name: The name you want to describe your service.
  • Description: More information about your service.
  • Region: Select the region where the database is located.
  • Plan: Select the pricing plan you want to use.

Now create the service and we are ready to write some metrics to it.

Write Data

Use the following command to collect JVM runtime metrics, such as CPU and memory usage, and send them to GreptimeCloud. Once the metrics have been sent successfully, they can be viewed on the GreptimeCloud dashboard.

shell
curl -L https://github.com/GreptimeCloudStarters/quick-start-java/releases/download/v0.1.2/quick-start-java-0.1.2-SNAPSHOT-all.jar --output quick-start.jar && java -jar quick-start.jar -h <host> -db <dbname> -u <username> -p <password>

This demo is based on OpenTelemetry OTLP/http. The source code is available on GitHub.

Visualize Data

After successfully writing data to the service, you can view the data on the GreptimeCloud dashboard. The dashboard provides a variety of visualizations to help you understand, monitor and analyze the data.

Here, we create a panel that displays the 95% CPU usage as an example. To do this, click the Add Panel button, select a table that contains the CPU usage data, and then choose the 95% aggregation method. Finally, click the Save button to save the panel. You can now see the new panel and set up an alert rule for it.