github.com/timstclair/heapster@v0.20.0-alpha1/docs/model.md (about)

     1  # Heapster Metric Model
     2  
     3  The Heapster Model is a structured representation of metrics for Kubernetes clusters, which is exposed through a set of REST API endpoints.
     4  It allows the extraction of up to 1 hour of historical data for any Container, Pod, Node or Namespace in the cluster, as well as the cluster itself.
     5  The model can also export the Average, Max and 95th Percentile for each one of these entities, over a duration of 1 minute, 1 hour or 24 hours.
     6  
     7  
     8  
     9  ## Usage
    10  
    11  The Heapster Model can be enabled by initializing Heapster with the `-use_model=true` flag. The resolution of the model can be configured through
    12  the `-model_resolution` flag, which will cause the model to store historical data at the specified resolution. If the `-model_resolution` flag is not specified, the default
    13  resolution of 1 minute will be used.
    14  
    15  ## API documentation
    16  
    17  A detailed documentation of each API endpoint is listed below. 
    18  
    19  All endpoints ending in `/metrics/{metric-name}/` can accept the optional `start` and `end` query parameters 
    20  that represent the start and end time of the requested timeseries. The result
    21  will be a list of (Timestamp, Value) pairs in the time range [start, end].
    22  `start` and `end` are strings formatted according to RFC3339. If `start` is not
    23  defined, it is assumed as the zero Unix epoch time. If `end` is not defined,
    24  then all data later than `start` will be returned.
    25  
    26  ### Cluster-level Metrics and Stats
    27  `/api/v1/model/`: The root path of the model API, displays all browsable subpaths.
    28  
    29  `/api/v1/model/metrics/`: Returns a list of available cluster-level metrics.
    30  
    31  `/api/v1/model/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 
    32  pairs for the requested cluster-level metric, between the time range specified by `start` and `end`. 
    33  
    34  `/api/v1/model/stats/`: Exposes the average, max and 95th percentile over the
    35  past minute, hour and day for each cluster metric.
    36  
    37  ### Node-level Metrics and Stats
    38  `/api/v1/model/nodes/`: Returns a list of all available nodes, along
    39  with their latest CPU and Memory Usage values.
    40  
    41  `/api/v1/model/nodes/{node-name}/`: Returns all browsable subpaths for a
    42  specific node.
    43  
    44  `/api/v1/model/nodes/{node-name}/pods/`: Returns a list of all available pods
    45  under a given node, along with their latest CPU and Memory Usage values.
    46  
    47  `/api/v1/model/nodes/{node-name}/metrics/`: Returns a list of available
    48  node-level metrics.
    49  
    50  `/api/v1/model/nodes/{node-name}/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 
    51  pairs for the requested node-level metric, within the time range specified by `start` and `end`. 
    52  
    53  `/api/v1/model/nodes/{node-name}/stats/`: Exposes the average, max and 95th
    54  percentile over the past minute, hour and day for each node metric.
    55  
    56  
    57  ### Namespace-level Metrics and Stats
    58  `/api/v1/model/namespaces/`: Returns a list of all available namespaces, along
    59  with their latest CPU and Memory Usage values.
    60  
    61  `/api/v1/model/namespaces/{namespace-name}/`: Returns all browsable subpaths for
    62  a specific namespace.
    63  
    64  `/api/v1/model/namespaces/{namespace-name}/metrics/`: Returns a list of available namespace-level metrics.
    65  
    66  `/api/v1/model/namespaces/{namespace-name}/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 
    67  pairs for the requested namespace-level metric, within the time range specified by `start` and `end`. 
    68  
    69  `/api/v1/model/namespaces/{namespace-name}/stats/`: Exposes the average, max and 95th percentile over the
    70  past minute, hour and day for each namespace metric.
    71  
    72  
    73  ### Pod-level Metrics and Stats
    74  `/api/v1/model/namespaces/{namespace-name}/pods/`: Returns a list of all available pods under a given namespace, along
    75  with their latest CPU and Memory Usage values.
    76  
    77  `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/`: Returns all browsable subpaths for
    78  a specific Pod.
    79  
    80  `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/metrics/`: Returns a list of available pod-level metrics
    81  
    82  `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 
    83  pairs for the requested pod-level metric, within the time range specified by `start` and `end`. 
    84  
    85  `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/stats/`: Exposes the average, max and 95th percentile over the
    86  past minute, hour and day for each pod-level metric.
    87  
    88  
    89  ### Container-level Metrics and Stats
    90  Container metrics and stats are accessible for both containers that belong to
    91  pods, as well as for free containers running in each node.
    92  
    93  `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/containers/`: Returns a list of all available containers under a given pod, along
    94  with their latest CPU and Memory Usage values.
    95  
    96  `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/containers/{container-name}/`: Returns all browsable subpaths for
    97  a specific container.
    98  
    99  `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/containers/{container-name}/metrics/`: Returns a list of available container-level metrics
   100  
   101  `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/containers/{container-name}/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 
   102  pairs for the requested container-level metric, within the time range specified by `start` and `end`. 
   103  
   104  `/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/containers/{container-name}/stats/`: Exposes the average, max and 95th percentile over the
   105  past minute, hour and day for each container metric.
   106  
   107  `/api/v1/model/nodes/{node-name}/freecontainers/`: Returns a list of all available free containers under a given node, along
   108  with their latest CPU and Memory Usage values.
   109  
   110  `/api/v1/model/nodes/{node-name}/freecontainers/{container-name}/`: Returns all browsable subpaths for
   111  a specific free container.
   112  
   113  `/api/v1/model/nodes/{node-name}/freecontainers/{container-name}/metrics/`: Returns a list of available container-level metrics
   114  
   115  `/api/v1/model/nodes/{node-name}/freecontainers/{container-name}/metrics/{metric-name}?start=X&end=Y`: Returns a set of (Timestamp, Value) 
   116  pairs for the requested container-level metric, within the time range specified by `start` and `end`. 
   117  
   118  `/api/v1/model/nodes/{node-name}/freecontainers/{container-name}/stats/`: Exposes the average, max and 95th percentile over the
   119  past minute, hour and day for each container metric.
   120  
   121  ### Metric Types
   122  
   123  * cpu-limit
   124  * cpu-usage
   125  * memory-limit
   126  * memory-usage
   127  * memory-working
   128  * fs-limit-<fs_name>
   129  * fs-usage-<fs_name>
   130  
   131  ### Sample API response
   132  
   133  	curl http://heapster:8082/api/v1/model/stats/
   134  
   135  ```json
   136  {
   137    "uptime": 2543160,
   138    "stats": {
   139     "cpu-limit": {
   140      "minute": {
   141       "average": 1000,
   142       "percentile": 1000,
   143       "max": 1000
   144      },
   145      "hour": {
   146       "average": 1000,
   147       "percentile": 1000,
   148       "max": 1000
   149      },
   150      "day": {
   151       "average": 1000,
   152       "percentile": 1000,
   153       "max": 1000
   154      }
   155     },
   156     "cpu-usage": {
   157      "minute": {
   158       "average": 10,
   159       "percentile": 10,
   160       "max": 10
   161      },
   162      "hour": {
   163       "average": 10,
   164       "percentile": 10,
   165       "max": 10
   166      },
   167      "day": {
   168       "average": 10,
   169       "percentile": 10,
   170       "max": 10
   171      }
   172     },
   173     "fs-limit-dev-disk-by-uuid-dcaa07b0-d2ad-4a32-bd61-6584d0da68c0": {
   174      "minute": {
   175       "average": 21103243264,
   176       "percentile": 21103243264,
   177       "max": 21103243264
   178      },
   179      "hour": {
   180       "average": 21103243300,
   181       "percentile": 21103243300,
   182       "max": 21103243300
   183      },
   184      "day": {
   185       "average": 21103243300,
   186       "percentile": 21103243300,
   187       "max": 21103243300
   188      }
   189     },
   190     "fs-usage-dev-disk-by-uuid-dcaa07b0-d2ad-4a32-bd61-6584d0da68c0": {
   191      "minute": {
   192       "average": 12974346240,
   193       "percentile": 12974346240,
   194       "max": 12974346240
   195      },
   196      "hour": {
   197       "average": 12974346300,
   198       "percentile": 12974346300,
   199       "max": 12974346300
   200      },
   201      "day": {
   202       "average": 12974346300,
   203       "percentile": 12974346300,
   204       "max": 12974346300
   205      }
   206     },
   207     "memory-limit": {
   208      "minute": {
   209       "average": 0,
   210       "percentile": 18446744073709551615,
   211       "max": 18446744073709551615
   212      },
   213      "hour": {
   214       "average": 1366425486941603612,
   215       "percentile": 12297829382474432512,
   216       "max": 18446744073709551615
   217      },
   218      "day": {
   219       "average": 1366425486941603612,
   220       "percentile": 12297829382474432512,
   221       "max": 18446744073709551615
   222      }
   223     },
   224     "memory-usage": {
   225      "minute": {
   226       "average": 1824296960,
   227       "percentile": 1824296960,
   228       "max": 1824296960
   229      },
   230      "hour": {
   231       "average": 1820327936,
   232       "percentile": 1820327936,
   233       "max": 1824296960
   234      },
   235      "day": {
   236       "average": 1820327936,
   237       "percentile": 1820327936,
   238       "max": 1824296960
   239      }
   240     },
   241     "memory-working": {
   242      "minute": {
   243       "average": 447021056,
   244       "percentile": 447021056,
   245       "max": 447021056
   246      },
   247      "hour": {
   248       "average": 444596224,
   249       "percentile": 444596224,
   250       "max": 447021056
   251      },
   252      "day": {
   253       "average": 444596224,
   254       "percentile": 444596224,
   255       "max": 447021056
   256      }
   257     }
   258    }
   259   }
   260  
   261  ```