github.com/galamsiva2020/kubernetes-heapster-monitoring@v0.0.0-20210823134957-3c1baa7c1e70/docs/sink-configuration.md (about) 1 Configuring sinks 2 ================= 3 4 Heapster can store data into different backends (sinks). These are specified on the command line 5 via the `--sink` flag. The flag takes an argument of the form `PREFIX:CONFIG[?OPTIONS]`. 6 Options (optional!) are specified as URL query parameters, separated by `&` as normal. 7 This allows each source to have custom configuration passed to it without needing to 8 continually add new flags to Heapster as new sinks are added. Heapster can 9 store data into multiple sinks at once if multiple `--sink` flags are specified. 10 11 ## Current sinks 12 13 ### Log 14 15 This sink writes all data to the standard output which is particularly useful for debugging. 16 17 --sink=log 18 19 ### InfluxDB 20 This sink supports both monitoring metrics and events. 21 *This sink supports InfluxDB versions v0.9 and above*. 22 To use the InfluxDB sink add the following flag: 23 24 --sink=influxdb:<INFLUXDB_URL>[?<INFLUXDB_OPTIONS>] 25 26 If you're running Heapster in a Kubernetes cluster with the default InfluxDB + Grafana setup you can use the following flag: 27 28 --sink=influxdb:http://monitoring-influxdb:80/ 29 30 The following options are available: 31 * `user` - InfluxDB username (default: `root`) 32 * `pw` - InfluxDB password (default: `root`) 33 * `db` - InfluxDB Database name (default: `k8s`) 34 * `retention` - Duration of the default InfluxDB retention policy, e.g. `4h` or `7d` (default: `0` meaning infinite) 35 * `secure` - Connect securely to InfluxDB (default: `false`) 36 * `insecuressl` - Ignore SSL certificate validity (default: `false`) 37 * `withfields` - Use [InfluxDB fields](storage-schema.md#using-fields) (default: `false`) 38 * `cluster_name` - Cluster name for different Kubernetes clusters. (default: `default`) 39 * `disable_counter_metrics` - Disable sink counter metrics to InfluxDB. (default: `false`) 40 * `concurrency` - concurrency for sinking to InfluxDB. (default: `1`) 41 42 ### Stackdriver 43 44 This sink supports monitoring metrics only. 45 To use the Stackdriver sink add following flag: 46 47 --sink=stackdriver[:?<STACKDRIVER_OPTIONS>] 48 49 The following options are available: 50 * `workers` - The number of workers. (default: `1`) 51 * `cluster_name` - Cluster name for different Kubernetes clusters. (default: ``) 52 53 ### Google Cloud Monitoring 54 This sink supports monitoring metrics only. 55 To use the GCM sink add the following flag: 56 57 --sink=gcm 58 59 *Note: This sink works only on a Google Compute Engine VM as of now* 60 61 GCM has one option - `metrics` that can be set to: 62 * all - the sink exports all metrics 63 * autoscaling - the sink exports only autoscaling-related metrics 64 65 ### Google Cloud Logging 66 This sink supports events only. 67 To use the GCL sink add the following flag: 68 69 --sink=gcl 70 71 *Notes:* 72 * This sink works only on a Google Compute Engine VM as of now 73 * GCE instance must have “https://www.googleapis.com/auth/logging.write” auth scope 74 * GCE instance must have Logging API enabled for the project in Google Developer Console 75 * GCL Logs are accessible via: 76 * `https://console.developers.google.com/project/<project_ID>/logs?service=custom.googleapis.com` 77 * Where `project_ID` is the project ID of the Google Cloud Platform project. 78 * Select `kubernetes.io/events` from the `All logs` drop down menu. 79 80 ### StatsD 81 This sink supports monitoring metrics only. 82 To use the StatsD sink add the following flag: 83 ``` 84 --sink=statsd:udp://<HOST>:<PORT>[?<OPTIONS>] 85 ``` 86 87 The following options are available: 88 89 * `prefix` - Adds specified prefix to all metrics, default is empty 90 * `protocolType` - Protocol type specifies the message format, it can be either etsystatsd or influxstatsd, default is etsystatsd 91 * `numMetricsPerMsg` - number of metrics to be packed in an UDP message, default is 5 92 * `renameLabels` - renames labels, old and new label separated by ':' and pairs of old and new labels separated by ',' 93 * `allowedLabels` - comma-separated labels that are allowed, default is empty ie all labels are allowed 94 * `labelStyle` - convert labels from default snake case to other styles, default is no conversion. Styles supported are `lowerCamelCase` and `upperCamelCase` 95 96 For example. 97 ``` 98 --sink=statsd:udp://127.0.0.1:4125?prefix=kubernetes.example.&protocolType=influxstatsd&numMetricsPerMsg=10&renameLabels=type:k8s_type,host_name:k8s_host_name&allowedLabels=container_name,namespace_name,type,host_name&labelStyle=lowerCamelCase 99 ``` 100 101 #### etsystatsd metrics format 102 103 | Metric Set Type | Metrics Format | 104 |:----------------|:--------------------------------------------------------------------------------------| 105 | Cluster | `<PREFIX>.<SUFFIX>` | 106 | Node | `<PREFIX>.node.<NODE>.<SUFFIX>` | 107 | Namespace | `<PREFIX>.namespace.<NAMESPACE>.<SUFFIX>` | 108 | Pod | `<PREFIX>.node.<NODE>.namespace.<NAMESPACE>.pod.<POD>.<SUFFIX>` | 109 | PodContainer | `<PREFIX>.node.<NODE>.namespace.<NAMESPACE>.pod.<POD>.container.<CONTAINER>.<SUFFIX>` | 110 | SystemContainer | `<PREFIX>.node.<NODE>.sys-container.<SYS-CONTAINER>.<SUFFIX>` | 111 112 * `PREFIX` - configured prefix 113 * `SUFFIX` - `[.<USER_LABELS>].<METRIC>[.<RESOURCE_ID>]` 114 * `USER_LABELS` - user provided labels `[.<KEY1>.<VAL1>][.<KEY2>.<VAL2>] ...` 115 * `METRIC` - metric name, eg: filesystem/usage 116 * `RESOURCE_ID` - An unique identifier used to differentiate multiple metrics of the same type. eg: FS partitions under filesystem/usage 117 118 #### influxstatsd metrics format 119 Influx StatsD is very similar to Etsy StatsD. Tags are supported by adding a comma-separated list of tags in key=value format. 120 121 ``` 122 <METRIC>[,<KEY1=VAL1>,<KEY2=VAL2>...]:<METRIC_VALUE>|<METRIC_TYPE> 123 ``` 124 125 ### Hawkular-Metrics 126 This sink supports monitoring metrics only. 127 To use the Hawkular-Metrics sink add the following flag: 128 129 --sink=hawkular:<HAWKULAR_SERVER_URL>[?<OPTIONS>] 130 131 If `HAWKULAR_SERVER_URL` includes any path, the default `hawkular/metrics` is overridden. To use SSL, the `HAWKULAR_SERVER_URL` has to start with `https` 132 133 The following options are available: 134 135 * `tenant` - Hawkular-Metrics tenantId (default: `heapster`) 136 * `labelToTenant` - Hawkular-Metrics uses given label's value as tenant value when storing data 137 * `useServiceAccount` - Sink will use the service account token to authorize to Hawkular-Metrics (requires OpenShift) 138 * `insecure` - SSL connection will not verify the certificates 139 * `caCert` - A path to the CA Certificate file that will be used in the connection 140 * `auth` - Kubernetes authentication file that will be used for constructing the TLSConfig 141 * `user` - Username to connect to the Hawkular-Metrics server 142 * `pass` - Password to connect to the Hawkular-Metrics server 143 * `filter` - Allows bypassing the store of matching metrics, any number of `filter` parameters can be given with a syntax of `filter=operation(param)`. Supported operations and their params: 144 * `label` - The syntax is `label(labelName:regexp)` where `labelName` is 1:1 match and `regexp` to use for matching is given after `:` delimiter 145 * `name` - The syntax is `name(regexp)` where MetricName is matched (such as `cpu/usage`) with a `regexp` filter 146 * `batchSize`- How many metrics are sent in each request to Hawkular-Metrics (default is 1000) 147 * `concurrencyLimit`- How many concurrent requests are used to send data to the Hawkular-Metrics (default is 5) 148 * `labelTagPrefix` - A prefix to be placed in front of each label when stored as a tag for the metric (default is `labels.`) 149 * `disablePreCache` - Disable cache initialization by fetching metric definitions from Hawkular-Metrics 150 151 A combination of `insecure` / `caCert` / `auth` is not supported, only a single of these parameters is allowed at once. Also, combination of `useServiceAccount` and `user` + `pass` is not supported. To increase the performance of Hawkular sink in case of multiple instances of Hawkular-Metrics (such as scaled scenario in OpenShift) modify the parameters of batchSize and concurrencyLimit to balance the load on Hawkular-Metrics instances. 152 153 154 ### Wavefront 155 The Wavefront sink supports monitoring metrics only. 156 To use the Wavefront sink add the following flag: 157 158 --sink=wavefront:<WAVEFRONT_PROXY_URL:PORT>[?<OPTIONS>] 159 160 The following options are available: 161 162 * `clusterName` - The name of the Kubernetes cluster being monitored. This will be added as a tag called `cluster` to metrics in Wavefront (default: `k8s-cluster`) 163 * `prefix` - The prefix to be added to all metrics that Heapster collects (default: `heapster.`) 164 * `includeLabels` - If set to true, any K8s labels will be applied to metrics as tags (default: `false`) 165 * `includeContainers` - If set to true, all container metrics will be sent to Wavefront. When set to false, container level metrics are skipped (pod level and above are still sent to Wavefront) (default: `true`) 166 167 168 ### OpenTSDB 169 This sink supports both monitoring metrics and events. 170 To use the OpenTSDB sink add the following flag: 171 172 --sink=opentsdb:<OPENTSDB_SERVER_URL>[?<OPTIONS>] 173 174 Currently, accessing OpenTSDB via its rest apis doesn't need any authentication, so you 175 can enable OpenTSDB sink like this: 176 177 --sink=opentsdb:http://192.168.1.8:4242?cluster=k8s-cluster 178 179 The following options are available: 180 181 * `cluster` - The name of the Kubernetes cluster being monitored. This will be added as a tag called `cluster` to metrics in OpenTSDB (default: `k8s-cluster`) 182 183 ### Kafka 184 This sink supports monitoring metrics only. 185 To use the kafka sink add the following flag: 186 187 --sink="kafka:<?<OPTIONS>>" 188 189 Normally, kafka server has multi brokers, so brokers' list need be configured for producer. 190 So, we provide kafka brokers' list and topics about timeseries & topic in url's query string. 191 Options can be set in query string, like this: 192 193 * `brokers` - Kafka's brokers' list. 194 * `timeseriestopic` - Kafka's topic for timeseries. Default value : `heapster-metrics`. 195 * `eventstopic` - Kafka's topic for events. Default value : `heapster-events`. 196 * `compression` - Kafka's compression for both topics. Must be `gzip` or `none` or `snappy` or `lz4`. Default value : none. 197 * `user` - Kafka's SASL PLAIN username. Must be set with `password` option. 198 * `password` - Kafka's SASL PLAIN password. Must be set with `user` option. 199 * `cacert` - Kafka's SSL Certificate Authority file path. 200 * `cert` - Kafka's SSL Client Certificate file path (In case of Two-way SSL). Must be set with `key` option. 201 * `key` - Kafka's SSL Client Private Key file path (In case of Two-way SSL). Must be set with `cert` option. 202 * `insecuressl` - Kafka's Ignore SSL certificate validity. Default value : `false`. 203 204 For example, 205 206 --sink="kafka:?brokers=localhost:9092&brokers=localhost:9093×eriestopic=testseries" 207 or 208 --sink="kafka:?brokers=localhost:9092&brokers=localhost:9093&eventstopic=testtopic" 209 210 ### Riemann 211 This sink supports monitoring metrics and events. 212 To use the Riemann sink add the following flag: 213 214 --sink="riemann:<RIEMANN_SERVER_URL>[?<OPTIONS>]" 215 216 The following options are available: 217 218 * `ttl` - TTL for writing to Riemann. Default: `60 seconds` 219 * `state` - The event state. Default: `""` 220 * `tags` - Default. `heapster` 221 * `batchsize` - The Riemann sink sends batch of events. The default size is `1000` 222 223 For example, 224 225 --sink=riemann:http://localhost:5555?ttl=120&state=ok&tags=foobar&batchsize=150 226 227 ### Elasticsearch 228 This sink supports monitoring metrics and events. To use the Elasticsearch 229 sink add the following flag: 230 ``` 231 --sink=elasticsearch:<ES_SERVER_URL>[?<OPTIONS>] 232 ``` 233 Normally an Elasticsearch cluster has multiple nodes or a proxy, so these need 234 to be configured for the Elasticsearch sink. To do this, you can set 235 `ES_SERVER_URL` to a dummy value, and use the `?nodes=` query value for each 236 additional node in the cluster. For example: 237 ``` 238 --sink=elasticsearch:?nodes=http://foo.com:9200&nodes=http://bar.com:9200 239 ``` 240 (*) Notice that using the `?nodes` notation will override the `ES_SERVER_URL` 241 242 If you run your ElasticSearch cluster behind a loadbalancer (or otherwise do 243 not want to specify multiple nodes) then you can do the following: 244 ``` 245 --sink=elasticsearch:http://elasticsearch.example.com:9200?sniff=false 246 ``` 247 248 Besides this, the following options can be set in query string: 249 250 (*) Note that the keys are case sensitive 251 252 * `index` - the index for metrics and events. The default is `heapster` 253 * `esUserName` - the username if authentication is enabled 254 * `esUserSecret` - the password if authentication is enabled 255 * `maxRetries` - the number of retries that the Elastic client will perform 256 for a single request after before giving up and return an error. It is `0` 257 by default, so retry is disabled by default. 258 * `healthCheck` - specifies if healthchecks are enabled by default. It is enabled 259 by default. To disable, provide a negative boolean value like `0` or `false`. 260 * `sniff` - specifies if the sniffer is enabled by default. It is enabled 261 by default. To disable, provide a negative boolean value like `0` or `false`. 262 * `startupHealthcheckTimeout` - the time in seconds the healthcheck waits for 263 a response from Elasticsearch on startup, i.e. when creating a client. The 264 default value is `1`. 265 * `ver` - ElasticSearch cluster version, can be either `2` or `5`. The default is `5` 266 * `bulkWorkers` - number of workers for bulk processing. Default value is `5`. 267 * `cluster_name` - cluster name for different Kubernetes clusters. Default value is `default`. 268 * `pipeline` - (optional; >ES5) Ingest Pipeline to process the documents. The default is disabled(empty value) 269 270 #### AWS Integration 271 In order to use AWS Managed Elastic we need to use one of the following methods: 272 273 1. Making sure the public IPs of the Heapster are allowed on the Elasticsearch's Access Policy 274 275 -OR- 276 277 2. Configuring an Access Policy with IAM 278 1. Configure the Elasticsearch cluster policy with IAM User 279 2. Create a secret that stores the IAM credentials 280 3. Expose the credentials to the environment variables: `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` 281 282 ``` 283 env: 284 - name: AWS_ACCESS_KEY_ID 285 valueFrom: 286 secretKeyRef: 287 name: aws-heapster 288 key: aws.id 289 - name: AWS_SECRET_ACCESS_KEY 290 valueFrom: 291 secretKeyRef: 292 name: aws-heapster 293 key: aws.secret 294 ``` 295 296 ### Graphite/Carbon 297 This sink supports monitoring metrics only. 298 To use the graphite sink add the following flag: 299 300 --sink="graphite:<PROTOCOL>://<HOST>[:<PORT>][<?<OPTIONS>>]" 301 302 PROTOCOL must be `tcp` or `udp`, PORT is 2003 by default. 303 304 These options are available: 305 * `prefix` - Adds specified prefix to all metric paths 306 307 For example, 308 309 --sink="graphite:tcp://metrics.example.com:2003?prefix=kubernetes.example" 310 311 Metrics are sent to Graphite with this hierarchy: 312 * `PREFIX` 313 * `cluster` 314 * `namespaces` 315 * `NAMESPACE` 316 * `nodes` 317 * `NODE` 318 * `pods` 319 * `NAMESPACE` 320 * `POD` 321 * `containers` 322 * `CONTAINER` 323 * `sys-containers` 324 * `SYS-CONTAINER` 325 326 ### Librato 327 328 This sink supports monitoring metrics only. 329 330 To use the librato sink add the following flag: 331 332 --sink=librato:<?<OPTIONS>> 333 334 Options can be set in query string, like this: 335 336 * `username` - Librato user email address (https://www.librato.com/docs/api/#authentication). 337 * `token` - Librato API token 338 * `prefix` - Prefix for all measurement names 339 * `tags` - By default provided tags (comma separated list) 340 * `tag_{name}` - Value for the tag `name` 341 342 For example, 343 344 --sink=librato:?username=xyz&token=secret&prefix=k8s&tags=cluster&tag_cluster=staging 345 346 The librato sink currently only works with accounts, which support [tagged metrics](https://www.librato.com/docs/kb/faq/account_questions/tags_or_sources/). 347 348 ### Honeycomb 349 350 This sink supports both monitoring metrics and events. 351 352 To use the Honeycomb sink add the following flag: 353 354 --sink="honeycomb:<?<OPTIONS>>" 355 356 Options can be set in query string, like this: 357 358 * `dataset` - Honeycomb Dataset to which to publish metrics/events 359 * `writekey` - Honeycomb Write Key for your account 360 * `apihost` - Option to send metrics to a different host (default: https://api.honeycomb.com) (optional) 361 362 For example, 363 364 --sink="honeycomb:?dataset=mydataset&writekey=secretwritekey" 365 366 ## Using multiple sinks 367 368 Heapster can be configured to send k8s metrics and events to multiple sinks by specifying the`--sink=...` flag multiple times. 369 370 For example, to send data to both gcm and influxdb at the same time, you can use the following: 371 372 ```shell 373 --sink=gcm --sink=influxdb:http://monitoring-influxdb:80/ 374 ```