Commit graph

63 commits

Author SHA1 Message Date
Stephen Soltesz 3f29324e04 Fix kubernetes host:port relabel regex.
This change corrects a bug introduced by PR
https://github.com/prometheus/prometheus/pull/2427

The regex uses three groups: the hostname, an optional port, and the
prefered port from a kubernetes annotation.

Previously, the second group should have been ignored if a :port was not
present in the input. However, making the port group optional with the
"?" had the unintended side-effect of allowing the hostname regex "(.+)"
to match greedily, which included the ":port" patterns up to the ";"
separating the hostname from the kubernetes port annotation.

This change updates the regex for the hostname to match any non-":"
characters. This forces the regex to stop if a ":port" is present and
allow the second group to match the optional port.
2017-02-16 14:46:04 -05:00
Stephen Soltesz 0b1790ee44 Match addresses with or without declared ports.
This change updates port relabeling for pod and service discovery so the
relabeling regex matches addresses with or without declared ports. As
well, this change uses a consistent style in the replacement pattern
for the two expressions.

Previously, for both services or pods that did not have declared ports, the
relabel config regex would fail to match:

    __meta_kubernetes_service_annotation_prometheus_io_port
    regex: (.+)(?::\d+);(\d+)

    __meta_kubernetes_pod_annotation_prometheus_io_port
    regex: (.+):(?:\d+);(\d+)

Both regexes expected a <host>:<port> pattern.

The new regex matches addresses with or without declared ports by making
the :<port> pattern optional.

    __meta_kubernetes_service_annotation_prometheus_io_port
    __meta_kubernetes_pod_annotation_prometheus_io_port
    regex: (.+)(?::\d+)?;(\d+)
2017-02-14 20:12:38 -05:00
Julius Volz beb3c4b389 Remove legacy remote storage implementations
This removes legacy support for specific remote storage systems in favor
of only offering the generic remote write protocol. An example bridge
application that translates from the generic protocol to each of those
legacy backends is still provided at:

documentation/examples/remote_storage/remote_storage_bridge

See also https://github.com/prometheus/prometheus/issues/10

The next step in the plan is to re-add support for multiple remote
storages.
2017-02-14 17:52:05 +01:00
Svend Sorensen 3a96d0e267 Kubernetes SD: Fix namespace meta label
Replace one more instance of `__meta_kubernetes_service_namespace` with
`__meta_kubernetes_namespace`.
2017-02-06 13:28:12 -08:00
Julius Volz b16371595d Add standalone remote storage bridge example
In preparation for removing specific remote storage implementations,
this offers an example of how to achieve the same in a separate process.
Rather than having three separate bridges for OpenTSDB, InfluxDB, and
Graphite, I decided to support all in one binary.

For now, this is in the example documenation directory, but perhaps we
will want to make a first-class project / repository out of it.
2017-02-01 13:22:41 +01:00
beorn7 5770d9e545 Kubernetes SD: More fixes to example config
- Avoid mentioning the `in_cluster` option. (It doesn't exist anymore.)
- Replace `__meta_kubernetes_service_namespace` and
  `__meta_kubernetes_pod_namespace` (which don't exist anymore) by
  `__meta_kubernetes_namespace`.
2016-11-29 18:42:35 +01:00
gambrose 52c762e9f1 The defaults stated in the example config where wrong (#2110)
* The stated defaults where wrong

* Update prometheus.yml
2016-11-21 09:53:59 +01:00
Jimmi Dyson 473dd5b89a
Kubernetes SD: Add endpoints role to API servers job to actually discover some API servers 2016-11-10 09:46:36 +00:00
Jimmi Dyson da23543f29
Kubernetes SD: Update example config to use endpoints role for API server discovery 2016-11-02 20:48:01 +00:00
Jimmi Dyson 4d37dca669
Kubernetes SD: Update config for discovery in 1.3 2016-11-02 15:06:20 +00:00
Julius Volz b5163351bf Simplify and fix remote write example
After removing gRPC, this can be simplified again. Also, the
configuration for the remote storage moved from flags to the config
file.
2016-10-05 17:53:01 +02:00
Tom Wilkie d83879210c Switch back to protos over HTTP, instead of GRPC.
My aim is to support the new grpc generic write path in Frankenstein.  On the surface this seems easy - however I've hit a number of problems that make me think it might be better to not use grpc just yet.

The explanation of the problems requires a little background.  At weave, traffic to frankenstein need to go through a couple of services first, for SSL and to be authenticated.  So traffic goes:

    internet -> frontend -> authfe -> frankenstein

- The frontend is Nginx, and adds/removes SSL.  Its done this way for legacy reasons, so the certs can be managed in one place, although eventually we imagine we'll merge it with authfe.  All traffic from frontend is sent to authfe.
- Authfe checks the auth tokens / cookie etc and then picks the service to forward the RPC to.
- Frankenstein accepts the reads and does the right thing with them.

First problem I hit was Nginx won't proxy http2 requests - it can accept them, but all calls downstream are http1 (see https://trac.nginx.org/nginx/ticket/923).  This wasn't such a big deal, so it now looks like:

    internet --(grpc/http2)--> frontend --(grpc/http1)--> authfe --(grpc/http1)--> frankenstein

Next problem was golang grpc server won't accept http1 requests (see https://groups.google.com/forum/#!topic/grpc-io/JnjCYGPMUms).  It is possible to link a grpc server in with a normal go http mux, as long as the mux server is serving over SSL, as the golang http client & server won't do http2 over anything other than an SSL connection.  This would require making all our service to service comms SSL.  So I had a go a writing a grpc http1 server, and got pretty far.  But is was a bit of a mess.

So finally I thought I'd make a separate grpc frontend for this, running in parallel with the frontend/authfe combo on a different port - and first up I'd need a grpc reverse proxy.  Ideally we'd have some nice, generic reverse proxy that only knew about a map from service names -> downstream service, and didn't need to decode & re-encode every request as it went through.  It seems like this can't be done with golang's grpc library - see https://github.com/mwitkow/grpc-proxy/issues/1.

And then I was surprised to find you can't do grpc from browsers! See http://www.grpc.io/faq/ - not important to us, but I'm starting to question why we decided to use grpc in the first place?

It would seem we could have most of the benefits of grpc with protos over HTTP, and this wouldn't preclude moving to grpc when its a bit more mature?  In fact, the grcp FAQ even admits as much:

> Why is gRPC better than any binary blob over HTTP/2?
> This is largely what gRPC is on the wire.
2016-09-15 23:21:54 +01:00
Julius Volz aa3f2b7216 Generic write cleanups and changes.
- fold metric name into labels
- return initialization errors back to main
- add snappy compression
- better context handling
- pre-allocation of labels
- remove generic naming
- other cleanups
2016-08-30 17:24:48 +02:00
Brian Brazil 36d2c4bd0b Add generic write path using grpc.
This uses a new proto format, with scope for multiple samples per
timeseries in future. This will allow users to pump samples out to
whatever they like without having to change the core Prometheus code.

There's also an example receiver to save users figuring out the
boilerplate themselves.
2016-08-30 17:19:18 +02:00
Fabian Reinartz 9a269b5507 Clarify comment on rule evaluation
Fixes #1866
2016-08-03 08:29:51 +02:00
Audun Fauchald Strand 50e044bb00 added path to pods scrape job 2016-07-27 15:13:53 +02:00
William Stewart f97cd29e47
Drop '__meta_kubernetes_role' since we have role in the config 2016-07-21 15:46:14 +02:00
William Stewart 599fafd2aa
Add node job 2016-07-21 15:45:42 +02:00
William Martin Stewart 58a3771e49 Add roles to prometheus kubernetes example
Needed with Prometheus 1.0
2016-07-21 13:16:23 +02:00
Jimmi Dyson 5733de0dfe
Kubernetes SD: Update example config with TLS options 2016-06-27 14:38:51 +01:00
beorn7 44aa7ec46d doc: Update scrape config in example prometheus.yml 2016-06-14 09:57:03 +02:00
Pieter Lange 427b322078 Minor typo 2016-05-24 11:12:42 +02:00
Patrick Bogen ae413704e8 kubernetes pod-level discovery 2016-05-18 17:18:52 -07:00
Julius Volz 657d65d6d6 Remove invalid scrape timeout from example config.
It can't be greater than the scrape interval. Let's just remove it.
2016-02-24 21:06:36 +01:00
Julius Volz e3baa35e9f Fix typo in documentation/examples/kubernetes-rabbitmq/README.md 2016-02-08 02:00:10 +01:00
Tiago Katcipis 73be7f63be Fix typos and moving example to the correct place 2016-01-23 16:38:24 -02:00
Tiago Katcipis b7ae20d3d8 fixing typos 2016-01-17 21:35:51 -02:00
Tiago Katcipis 53fb648849 adding README to explain the example 2016-01-17 15:57:49 -02:00
Tiago Katcipis bb4722d6b5 Adding RabbitMQ example as mentioned on #1312 2016-01-12 20:59:37 -02:00
Jimmi Dyson d3934345e9 Kubernetes Discovery: Ensure metrics path isn't overwritten in example relabeling 2016-01-12 21:06:32 +00:00
Jimmi Dyson c12fb447b8 Kubernetes SD: Use first TCP service port as target port & clean up
example config

Fixes #1256
2015-12-08 10:29:40 +00:00
Jimmi Dyson 042f18b07a Kubernetes SD: Fix metrics path relabeling in example config 2015-11-25 10:27:11 +00:00
Jimmi Dyson 645feba8cf KubernetesSD: Remove redundant defaults from example config 2015-11-18 14:24:30 +00:00
Jimmi Dyson 2cca07381b KubernetesSD: Create targets for services as well as service endpoints 2015-11-18 14:15:39 +00:00
Jimmi Dyson 104803e74e Kubernetes SD: Cleanup example config label regexps 2015-10-24 19:29:58 +01:00
Jimmi Dyson 87940ec213 Kubernetes SD: Rename masters to api_servers in config 2015-10-24 14:41:14 +01:00
Thach MAI 94f4430ff3 Fix example prometheus.yml to use "external_labels" instead of "labels". 2015-10-02 23:00:10 +02:00
Jimmi Dyson 1976dfe634 Add Kubernetes namespace & name labels to example config 2015-09-29 12:55:15 +01:00
Jimmi Dyson 0d61605526 Kubernetes SD example: separate out cluster level components & services 2015-09-29 11:22:18 +01:00
Jimmi Dyson e26fc5e73c Kubernetes SD config tidy & add labelmap action example 2015-09-29 08:59:35 +01:00
Keegan Carruthers-Smith e633b1dc8d Move InCluster auth in kubernetes example config
CA and Bearer Token are config of `kubernetes_sd_configs`, not the
`scrape_config`. Also updated misleading top-level comment and removed
unnecessary global config.
2015-09-29 09:05:21 +02:00
Fabian Reinartz 58c32f84ce Merge pull request #1055 from fabric8io/kubernetes-discovery
Move TLS options to scrape config
2015-09-09 11:24:29 +02:00
Jimmi Dyson a1574aa2b3 Move TLS options to scrape config
Fixes #1013, fixes #989
2015-09-09 09:52:21 +01:00
Fabian Reinartz e298463fd6 Merge pull request #1053 from prometheus/diag
Update architecture diagram
2015-09-07 15:08:14 +02:00
Fabian Reinartz e761f0d664 Update architecture diagram 2015-09-07 14:11:28 +02:00
Jimmi Dyson d7a7fd4589 Kubernetes SD improvements
* Support multiple masters with retries against each master as required.
* Scrape masters' metrics.
* Add role meta label for node/service/master to make it easier for relabeling.
2015-09-04 11:31:20 +01:00
Jimmi Dyson 923f8111d4 Initial Kubernetes discovery
Fixes #904
2015-08-13 10:38:52 +01:00
Fabian Reinartz a703241bf8 Adjust example config to naming changes 2015-05-19 18:12:58 +02:00
Fabian Reinartz 86087120dd Replace example config with new YAML format. 2015-05-11 18:14:07 +02:00
beorn7 33ef2e411b Remove hopelessly outdated tutorial. 2015-03-13 15:50:57 +01:00