Aptible can deliver your metrics to any InfluxDB Database. In particular, this might be useful if you are leveraging InfluxData's hosted InfluxDB offering.

📘

Tip

If you are hosting an InfluxDB Database on Aptible, use an InfluxDB Database Metric Drain for easier configuration.

InfluxDB Metrics Structure

Aptible InfluxDB Metric Drains publish metrics in a series named metrics.

The following values are published (approximately every 30 seconds):

  • running: a boolean indicating whether the Container was running when this point was sampled.
  • milli_cpu_usage: the Container's average CPU usage (in milli CPUs) over the reporting period.
  • memory_total_mb: the Container's total memory usage.
  • memory_rss_mb: the Container's RSS memory usage. This memory is typically not reclaimable. If this exceeds the memory_limit_mb, the container will be restarted.
  • memory_limit_mb: the Container's Memory Limit.
  • disk_read_kbps: the Container's average disk read bandwidth over the reporting period.
  • disk_write_kbps: the Container's average disk write bandwidth over the reporting period.
  • disk_read_iops: the Container's average disk read IOPS over the reporting period.
  • disk_write_iops: the Container's average disk write IOPS over the reporting period.
  • disk_usage_mb: the Database's Disk usage (Database metrics only).
  • disk_limit_mb: the Database's Disk size (Database metrics only).
  • pids_current: the current number of tasks in the Container (see Other Limits).
  • pids_limit: the maximum number of tasks for the Container (see Other Limits).

📘

Tip

Review Understanding Memory Utilization for more information on the meaning of the memory_total_mb and memory_rss_mb values.

📘

Tip

Review I/O Performance for more information on the meaning of the disk_read_iops and disk_write_iops values.

All points are enriched with the following tags:

  • environment: Environment handle
  • app: App handle (App metrics only)
  • database: Database handle (Database metrics only)
  • service: Service name
  • host: Container Hostname (Short Container ID)
  • container: full Container ID

Accessing Metrics in InfluxDB

Deploy Grafana

The best approach to accessing metrics from InfluxDB is to deploy Grafana. Grafana is easy to deploy on Aptible. To do so, follow this tutorial Deploying Grafana on Aptible.

Make sure to review suggested queries below after you deployed Grafana.

Suggested Queries

Here are a few suggested queries to get started with an InfluxDB Metric Drain. These queries are designed with Grafana in mind. To copy those queries into Grafana, use the Raw text editor mode in Grafana.

📘

Tip

In the queries below, $__interval and $timeFilter will automatically be interpolated by Grafana. Leave those parameters as-is.

RSS Memory Utilization across all resources

SELECT MAX("memory_rss_mb") AS rss_mb
FROM "metrics"
WHERE $timeFilter
GROUP BY
        time($__interval),
        "app", "database", "service", "host"
        fill(null)

CPU Utilization for a single App

In the example below, replace ENVIRONMENT with the handle for your Environment and HANDLE with the handle for your App

SELECT MEAN("milli_cpu_usage") / 1000 AS cpu
FROM "metrics"
WHERE
        environment = 'ENVIRONMENT' AND
        app = 'HANDLE' AND
        $timeFilter
GROUP BY
        time($__interval),
        "service", "host"
        fill(null)

Disk Utilization across all Databases

SELECT LAST(disk_usage_mb) / LAST(disk_limit_mb) AS utilization
FROM "metrics"
WHERE
        "database" <> '' AND
        $timeFilter
GROUP BY
        time($__interval),
        "database", "service", "host"
        fill(null)