Browse Source

fix Readme

master
Richard Hillmann 9 years ago
parent
commit
82d7434f45
  1. 56
      README.md
  2. 2
      exporter.go
  3. 22
      test.yml

56
README.md

@ -49,33 +49,35 @@ Bonus
Pretty easy with *kubernetes*.
Just run the exporter along the app in a pod with an ReplicationController:
_Note: Config is just an proof of concept, not fully tested:_
```yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: replicatedApp
spec:
replicas: 100
selector:
app: exportedApp
template:
metadata:
name: podApp
annotations:
prometheus.io/scrape: true
prometheus.io/port: 8081
labels:
app: exportedApp
spec:
containers:
- name: challenge
image: beorn7/syseng-challenge
ports:
- containerPort: 8080
- name: exporter
image: exporter
ports:
- containerPort: 8081
apiVersion: v1
kind: ReplicationController
metadata:
name: replicatedapp
spec:
replicas: 100
selector:
app: exportedapp
template:
metadata:
name: podapp
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8081"
labels:
app: exportedapp
spec:
containers:
- name: challenge
image: beorn7/syseng-challenge
ports:
- containerPort: 8080
- name: exporter
image: exporter
ports:
- containerPort: 8081
```
Just use the service discovery in prometheus:
@ -94,7 +96,7 @@ Bonus
target_label: __address__
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: podApp
target_label: pod
```
DNS discovery may be an alternative, for example with coredns.

2
exporter.go

@ -26,7 +26,7 @@ var (
listenAddress = flag.String("listen", ":8080", "The address to listen on for HTTP requests.")
endpointApp = flag.String("endpoint", "http://localhost:8050/stats", "HTTP API address of the application")
timeoutApp = flag.Int("timeout", 500, "Connection timeout in ms")
environment = flag.String("environment", "", "Optional environment which will be added to the exported metrics")
environment = flag.String("environment", "", "Optional value for an label environment which will be added to the exported metrics")
prometheusConstLabel = parseConstLabel()
)

22
test.yml

@ -0,0 +1,22 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: replicatedapp
spec:
replicas: 100
selector:
app: exportedapp
template:
metadata:
name: podapp
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8081"
labels:
app: exportedapp
spec:
containers:
- name: challenge
image: beorn7/syseng-challenge
ports:
- containerPort: 8080
Loading…
Cancel
Save