fix export to statsd

This commit is contained in:
ducoterra
2020-06-22 12:12:24 -04:00
parent 5caa4ede71
commit 74db07bd92
8 changed files with 85 additions and 88 deletions

View File

@@ -1,5 +1,8 @@
FROM python:latest
RUN apt update && apt install -y lm-sensors watch stress
RUN pip install glances bottle statsd pysnmp
CMD sleep infinity
COPY glances.conf /etc/glances/glances.conf
CMD glances -w

View File

@@ -16,4 +16,4 @@ kubectl exec -it $(kubectl get pod --selector=app=temp --output=jsonpath={.items
```bash
kubectl exec -it $(kubectl get pod --selector=app=temp --output=jsonpath={.items..metadata.name}) -- stress -c 24
```
```

View File

@@ -1,6 +1,15 @@
version: '3'
services:
temp:
build: .
image: hub.ducoterra.net/ducoterra/temp:0.0.2
web:
image: hub.ducoterra.net/ducoterra/temp:0.0.7
ports:
- 61208:61208
command: glances -w
exporter:
image: hub.ducoterra.net/ducoterra/temp:0.0.7
command: glances --export statsd
graphite-statsd:
image: hub.ducoterra.net/ducoterra/graphite:0.0.1
ports:
- 8080:80

4
glances.conf Normal file
View File

@@ -0,0 +1,4 @@
[statsd]
host=graphite-statsd
port=8125
prefix=mainframe

View File

@@ -13,12 +13,22 @@ spec:
app: {{ .Release.Name }}
spec:
containers:
- name: {{ .Release.Name }}
image: hub.ducoterra.net/ducoterra/temp:0.0.2
- name: {{ .Release.Name }}-web
image: {{ .Values.image }}
resources:
requests:
memory: 1Mi
cpu: 1m
limits:
memory: 1Gi
cpu: '48'
memory: 256Mi
cpu: "24"
- name: {{ .Release.Name }}-exporter
image: {{ .Values.image }}
command: ["glances", "-q", "--export", "statsd"]
resources:
requests:
memory: 1Mi
cpu: 1m
limits:
memory: 256Mi
cpu: 250m

View File

@@ -0,0 +1,39 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: {{ .Release.Name }}-internal-tls
annotations:
kubernetes.io/ingress.class: traefik-internal
spec:
entryPoints:
- websecure
tls:
certResolver: myresolver
domains:
- main: "*.ducoterra.net"
routes:
- match: Host(`{{ .Release.Name }}.ducoterra.net`)
kind: Rule
services:
- name: {{ .Release.Name }}
port: 61208
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: {{ .Release.Name }}-internal-web
annotations:
kubernetes.io/ingress.class: traefik-internal
spec:
entryPoints:
- web
routes:
- match: Host(`{{ .Release.Name }}.ducoterra.net`)
kind: Rule
services:
- name: {{ .Release.Name }}
port: 61208
middlewares:
- name: httpsredirect

View File

@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
spec:
selector:
app: {{ .Release.Name }}
ports:
- port: 61208
targetPort: 61208

View File

@@ -1,79 +1 @@
# Default values for helm.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: nginx
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 80
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}
image: hub.ducoterra.net/ducoterra/temp:0.0.7