github.com/jonaz/heapster@v1.3.0-beta.0.0.20170208112634-cd3c15ca3d29/docs/storage-schema.md (about)

     1  ## Metrics
     2  
     3  Heapster exports the following metrics to its backends.
     4  
     5  | Metric Name | Description |
     6  |------------|-------------|
     7  | cpu/limit | CPU hard limit in millicores. |
     8  | cpu/node_capacity | Cpu capacity of a node. |
     9  | cpu/node_allocatable | Cpu allocatable of a node. |
    10  | cpu/node_reservation | Share of cpu that is reserved on the node allocatable. |
    11  | cpu/node_utilization | CPU utilization as a share of node allocatable. |
    12  | cpu/request | CPU request (the guaranteed amount of resources) in millicores. |
    13  | cpu/usage | Cumulative CPU usage on all cores. |
    14  | cpu/usage_rate | CPU usage on all cores in millicores. |
    15  | filesystem/usage | Total number of bytes consumed on a filesystem. |
    16  | filesystem/limit | The total size of filesystem in bytes. |
    17  | filesystem/available | The number of available bytes remaining in a the filesystem |
    18  | memory/limit | Memory hard limit in bytes. |
    19  | memory/major_page_faults | Number of major page faults. |
    20  | memory/major_page_faults_rate | Number of major page faults per second. |
    21  | memory/node_capacity | Memory capacity of a node. |
    22  | memory/node_allocatable | Memory allocatable of a node. |
    23  | memory/node_reservation | Share of memory that is reserved on the node allocatable. |
    24  | memory/node_utilization | Memory utilization as a share of memory allocatable. |
    25  | memory/page_faults | Number of page faults. |
    26  | memory/page_faults_rate | Number of page faults per second. |
    27  | memory/request | Memory request (the guaranteed amount of resources) in bytes. |
    28  | memory/usage | Total memory usage. |
    29  | memory/working_set | Total working set usage. Working set is the memory being used and not easily dropped by the kernel. |
    30  | network/rx | Cumulative number of bytes received over the network. |
    31  | network/rx_errors | Cumulative number of errors while receiving over the network. |
    32  | network/rx_errors_rate | Number of errors while receiving over the network per second. |
    33  | network/rx_rate | Number of bytes received over the network per second. |
    34  | network/tx | Cumulative number of bytes sent over the network |
    35  | network/tx_errors | Cumulative number of errors while sending over the network |
    36  | network/tx_errors_rate | Number of errors while sending over the network |
    37  | network/tx_rate | Number of bytes sent over the network per second. |
    38  | uptime  | Number of milliseconds since the container was started. |
    39  
    40  All custom (aka application) metrics are prefixed with 'custom/'.
    41  
    42  ## Labels
    43  
    44  Heapster tags each metric with the following labels.
    45  
    46  | Label Name     | Description                                                                   |
    47  |----------------|-------------------------------------------------------------------------------|
    48  | pod_id         | Unique ID of a Pod                                                            |
    49  | pod_name       | User-provided name of a Pod                                                   |
    50  | pod_namespace  | The namespace of a Pod                                                        |
    51  | container_base_image | Base image for the container |  
    52  | container_name | User-provided name of the container or full cgroup name for system containers |
    53  | host_id        | Cloud-provider specified or user specified Identifier of a node               |
    54  | hostname       | Hostname where the container ran                                              |
    55  | labels         | Comma-separated(Default) list of user-provided labels. Format is 'key:value'  |
    56  | namespace_id   | UID of the namespace of a Pod                                                 |
    57  | resource_id    | A unique identifier used to differentiate multiple metrics of the same type. e.x. Fs partitions under filesystem/usage | 
    58  
    59  **Note**
    60    * Label separator can be configured with Heapster `--label-seperator`. Comma-seperated label pairs is fine until we use [Bosun](http://bosun.org) as alert system and use `group by labels` to search for labels.
    61      [Bosun(0.5.0) uses comma to split queried tag key and tag value](https://github.com/bosun-monitor/bosun/blob/0.5.0/opentsdb/tsdb.go#L566-L575). For example if the expression used for query InfluxDB from Bosun is like this:
    62  ```
    63  $limit = avg(influx("k8s", '''SELECT mean(value) as value FROM "memory/limit" WHERE type = 'node' GROUP BY nodename, labels''', "${INTERVAL}s", "", ""))
    64  ```
    65  With a comma-separated labels:
    66  ```
    67  nodename=127.0.0.1,labels=beta.kubernetes.io/arch:amd64,beta.kubernetes.io/os:linux,kubernetes.io/hostname:127.0.0.1
    68  ```
    69  When split by a comma, something wrong happened. Bosun split it wrongly to:
    70  ```
    71  nodename=127.0.0.1
    72  labels=labels:beta.kubernetes.io/arch:amd64
    73  beta.kubernetes.io/os.linux
    74  kubernetes.io/hostname:127.0.0.1
    75  ```
    76  Last two tag key-value pairs is wrong. They should not exist and be squashed to `labels`:
    77  ```
    78  nodename=127.0.0.1
    79  labels=labels:beta.kubernetes.io/arch:amd64,beta.kubernetes.io/os.linux,kubernetes.io/hostname:127.0.0.1
    80  ```
    81  This will make bosun confused and panic with something like "panic: opentsdb: bad tag: beta.kubernetes.io/os:linux".
    82  
    83  ## Aggregates
    84  
    85  The metrics are initially collected for nodes and containers and later aggregated for pods, namespaces and clusters.
    86  Disk and network metrics are not available at container level (only at pod and node level).
    87  
    88  ## Storage Schema
    89  
    90  ### InfluxDB
    91  
    92  ##### Default
    93  
    94  Each metric translates to a separate 'series' in InfluxDB. Labels are stored as tags.
    95  The metric name is not modified.
    96  
    97  ##### Using fields
    98  
    99  If you want to use InfluxDB fields, you have to add `withfields=true` as parameter in InfluxDB sink URL.
   100  (More information here: https://docs.influxdata.com/influxdb/v0.9/concepts/key_concepts/)
   101  
   102  In that case, each metric translates to a separate in 'series' in InfluxDB. This means that some metrics are grouped in the same 'measurement'.
   103  For example, we have the measurement 'cpu' with fields 'node_reservation', 'node_utilization', 'request', 'usage', 'usage_rate'.
   104  Also, all labels are stored as tags.
   105  Here the measurement list: cpu, filesystem, memory, network, uptime
   106  
   107  Also, standard Grafana dashboard are not working with this new schema, you have to use [new dashboards](/grafana/dashboards/influxdb_withfields)
   108  
   109  ### Google Cloud Monitoring
   110  
   111  Metrics mentioned above are stored along with corresponding labels as [custom metrics](https://cloud.google.com/monitoring/custom-metrics/) in Google Cloud Monitoring.
   112  
   113  * Metrics are collected every 2 minutes by default and pushed with a 1 minute precision.
   114  * Each metric has a custom metric prefix - `custom.cloudmonitoring.googleapis.com`
   115  * Each metric is pushed with an additional namespace prefix - `kubernetes.io`.
   116  * GCM does not support visualizing cumulative metrics yet. To work around that, heapster exports an equivalent gauge metric for all cumulative metrics mentioned above.
   117  
   118    The gauge metrics use their parent cumulative metric name as the prefix, followed by a "_rate" suffix.
   119     E.x.: "cpu/usage", which is cumulative, will have a corresponding gauge metric "cpu/usage_rate"
   120     NOTE: The gauge metrics will be deprecated as soon as GCM supports visualizing cumulative metrics.
   121  
   122  TODO: Add a snapshot of all the metrics stored in GCM.
   123  
   124  ### Hawkular
   125  
   126  Each metric is stored as separate timeseries (metric) in Hawkular-Metrics with tags being inherited from common ancestor type. The metric name is created with the following format: `containerName/podId/metricName` (`/` is separator). Each definition stores the labels as tags with following addons:
   127  
   128  * All the Label descriptions are stored as label_description
   129  * The ancestor metric name (such as cpu/usage) is stored under the tag `descriptor_name`
   130  * To ease search, a tag with `group_id` stores the key `containerName/metricName` so each podId can be linked under a single timeseries if necessary.
   131  * Units are stored under `units` tag
   132  * If labelToTenant parameter is given, any metric with the label will use this label's value as the target tenant. If the metric doesn't have the label defined, default tenant is used.
   133  
   134  At the start, all the definitions are fetched from the Hawkular-Metrics tenant and filtered to cache only the Heapster metrics. It is recommended to use a separate tenant for Heapster information if you have lots of metrics from other systems, but not required.
   135  
   136  The Hawkular-Metrics instance can be a standalone installation of Hawkular-Metrics or the full installation of Hawkular.