Browse Source

First version of Zabbix-agent for Helm 3

master
Fábio Kaiser Rauber 5 years ago
parent
commit
8edbe8cac4
  1. 23
      charts/zabbix-agent/.helmignore
  2. 7
      charts/zabbix-agent/v0.3.0/Chart.yaml
  3. 3
      charts/zabbix-agent/v0.3.0/app-readme.md
  4. 53
      charts/zabbix-agent/v0.3.0/questions.yaml
  5. 1
      charts/zabbix-agent/v0.3.0/templates/NOTES.txt
  6. 63
      charts/zabbix-agent/v0.3.0/templates/_helpers.tpl
  7. 89
      charts/zabbix-agent/v0.3.0/templates/daemonset.yaml
  8. 59
      charts/zabbix-agent/v0.3.0/values.yaml

23
charts/zabbix-agent/.helmignore

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

7
charts/zabbix-agent/v0.3.0/Chart.yaml

@ -0,0 +1,7 @@
apiVersion: v2
name: zabbix-agent
description: Zabbix monitoring agent for cluster-wide deployment
type: application
version: 0.3.0
appVersion: ubuntu-4.0-latest
icon: https://assets.zabbix.com/img/logo.svg

3
charts/zabbix-agent/v0.3.0/app-readme.md

@ -0,0 +1,3 @@
# Zabbix-agent Rancher chart
For easy deploy of Zabbix-agent in your Kubernetes infrastructure.

53
charts/zabbix-agent/v0.3.0/questions.yaml

@ -0,0 +1,53 @@
labels:
io.cattle.role: project
categories:
- Monitoring
questions:
- variable: zabbix.serverHost
default: ""
description: "IP Address of your Zabbix Server"
label: Server IP
type: string
required: true
group: Essential
- variable: zabbix.enableRemoteCommands
default: "0"
description: "Whether to allow remote commands from the Zabbix Server to the agent."
type: enum
options:
- "0"
- "1"
required: false
group: Essential
- variable: zabbix.debugLevel
default: 3
label: Agent Debug Level
description: "0-basic info, 1-critical info, 2-error info, 3-warnings, 4-debug, 5-extended debug"
type: int
min: 0
max: 5
group: Advanced
- variable: zabbix.refreshActiveChecks
default: 120
label: Refresh Active Checks
description: "Interval to refresh list of active checks (in seconds)."
type: int
min: 60
max: 3600
group: Advanced
- variable: zabbix.startAgents
default: 10
label: Start Agents
description: "Number of pre-allocated instances of zabbix_agentd for passive checks."
type: int
min: 0
max: 99
group: Advanced
- variable: zabbix.timeout
default: 30
label: "Timeout"
description: "Timeout when fetching values (in seconds). The agent will not abort user parameters execution when reaching this limit!"
type: int
min: 1
max: 255
group: Advanced

1
charts/zabbix-agent/v0.3.0/templates/NOTES.txt

@ -0,0 +1 @@
If you have auto registration configured correctly, your Zabbix monitored hosts will appear automatically in your Zabbix Server installation.

63
charts/zabbix-agent/v0.3.0/templates/_helpers.tpl

@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "zabbix-agent.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "zabbix-agent.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "zabbix-agent.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "zabbix-agent.labels" -}}
helm.sh/chart: {{ include "zabbix-agent.chart" . }}
{{ include "zabbix-agent.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "zabbix-agent.selectorLabels" -}}
app.kubernetes.io/name: {{ include "zabbix-agent.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "zabbix-agent.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "zabbix-agent.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

89
charts/zabbix-agent/v0.3.0/templates/daemonset.yaml

@ -0,0 +1,89 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "zabbix-agent.fullname" . }}
labels:
{{- include "zabbix-agent.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "zabbix-agent.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "zabbix-agent.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
hostPID: true
hostIPC: true
hostNetwork: true
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 10050
env:
- name: ZBX_DEBUGLEVEL
value: "{{ .Values.zabbix.debugLevel }}"
- name: ZBX_ENABLEREMOTECOMMANDS
value: "{{ .Values.zabbix.enableRemoteCommands }}"
- name: ZBX_METADATAITEM
value: "{{ .Values.zabbix.metadataItem }}"
- name: ZBX_HOSTNAMEITEM
value: "{{ .Values.zabbix.hostnameItem }}"
- name: ZBX_REFRESHACTIVECHECKS
value: "{{ .Values.zabbix.refreshActiveChecks }}"
- name: ZBX_SERVER_HOST
value: "{{ .Values.zabbix.serverHost }}"
- name: ZBX_STARTAGENTS
value: "{{ .Values.zabbix.startAgents }}"
- name: ZBX_TIMEOUT
value: "{{ .Values.zabbix.timeout }}"
volumeMounts:
- name: proc
mountPath: /data/proc
- name: sys
mountPath: /sys
- name: dev
mountPath: /data/dev
- name: dockersock
mountPath: /var/run/docker.sock
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: proc
hostPath:
path: /proc
- name: sys
hostPath:
path: /sys
- name: dev
hostPath:
path: /dev
- name: dockersock
hostPath:
path: /var/run/docker.sock

59
charts/zabbix-agent/v0.3.0/values.yaml

@ -0,0 +1,59 @@
# Default values for zabbix-agent.
image:
repository: zabbix/zabbix-agent
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
zabbix:
debugLevel: 3
enableRemoteCommands: 0
metadataItem: system.uname
hostnameItem: system.hostname
refreshActiveChecks: 120
startAgents: 10
timeout: 30
serverHost: localhost
podAnnotations: {}
securityContext:
privileged: true
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources:
limits:
cpu: 200m
memory: 100Mi
requests:
cpu: 50m
memory: 54Mi
nodeSelector: {}
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/controlplane
value: "true"
- effect: NoExecute
key: node-role.kubernetes.io/etcd
value: "true"
- effect: NoSchedule
key: node-role.kubernetes.io/lb
operator: Equal
value: "true"
- effect: NoExecute
key: node-role.kubernetes.io/lb
operator: Equal
value: "true"
affinity: {}
Loading…
Cancel
Save