influxdata/influxdb-client-java

Can I monitor influxdb through API, or the monitoring interface exposed to the outside world?

ZY945 opened this issue · 1 comments

I want to get some monitoring indicators of the influxdb database

Hi @ZY945,

Thank you for utilizing our client for your InfluxDB interactions.

To check the status of your InfluxDB instance, you can leverage the ping method provided by the client. This method will allow you to programmatically assess the health and availability of the InfluxDB service.

Here's a quick example of how you can use this method:

try (InfluxDBClient client = InfluxDBClientFactory.create("http://localhost:8086", "my-token".toCharArray())) {
            Boolean isReachable = client.ping();
            System.out.println("InfluxDB isReachable: " + isReachable);
}

This will give you a straightforward indication of the InfluxDB's current state, which can be particularly useful for monitoring and operational checks.

If you have any further questions or need additional assistance, please don't hesitate to reach out.

Best Regards.