Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #67 from aeciopires/issue-65
Browse files Browse the repository at this point in the history
Issue 65
  • Loading branch information
aeciopires authored Jul 26, 2022
2 parents 1e2df14 + 73a3846 commit c4fd444
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 46 deletions.
4 changes: 2 additions & 2 deletions Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
apiVersion: v2
name: zabbix
version: 3.0.1
appVersion: 6.0.6
version: 3.1.0
appVersion: 6.2.0
description: Zabbix is a mature and effortless enterprise-class open source monitoring solution for network monitoring and application monitoring of millions of metrics.
keywords:
- zabbix
Expand Down
114 changes: 92 additions & 22 deletions README.md

Large diffs are not rendered by default.

101 changes: 81 additions & 20 deletions README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ possible is possible, while still obtaining a good level of security.

> **Break change 1.0.0**
* Will be used Postgresql 14.x and Zabbix 6.x.
* The installation of any component of chart is optional for easy integration with the official chart: https://git.zabbix.com/projects/ZT/repos/kubernetes-helm/
* The installation of any component of chart is optional for easy integration with the official
chart: https://git.zabbix.com/projects/ZT/repos/kubernetes-helm/
* More info: https://github.com/cetic/helm-zabbix/issues/42

# Prerequisites
Expand All @@ -50,59 +51,111 @@ possible is possible, while still obtaining a good level of security.
- Kubectl
- PV provisioner support in the underlying infrastructure (optional).

Install requirement ``kubectl`` and ``helm`` following the instructions this [tutorial](docs/requirements.md).
Install requirement ``kubectl`` and ``helm`` following the instructions this
[tutorial](docs/requirements.md).

# Zabbix components

## Zabbix Server

**Zabbix server** is the central process of Zabbix software.

The server performs the polling and trapping of data, it calculates triggers, sends notifications to users. It is the central component to which Zabbix agents and proxies report data on availability and integrity of systems. The server can itself remotely check networked services (such as web servers and mail servers) using simple service checks. Zabbix Server can be operated in a High Availability mode since version 6.0 which is automatically enabled by this Helm chart when setting the Zabbix server component to run more than 1 replica. In this HA mode, all Zabbix server instances periodically send a heartbeat to the Database server (just updating a timestamp in a table) as well as which of the nodes is the "active" one. In case the active node does not send a heartbeat within a certain time, any of the remaining ones automatically take over. It is everytime possible to join new nodes to the HA cluster by just raising the amount of replicas of the Zabbix server.
The server performs the polling and trapping of data, it calculates triggers, sends notifications
to users. It is the central component to which Zabbix agents and proxies report data on availability
and integrity of systems. The server can itself remotely check networked services (such as web servers
and mail servers) using simple service checks
[Official documentation](https://www.zabbix.com/documentation/current/en/manual/concepts/server).

Zabbix Server can be operated in a High Availability mode since version 6.0 which is automatically
enabled by this Helm chart when setting the Zabbix server component to run more than 1 replica.
In this HA mode, all Zabbix server instances periodically send a heartbeat to the Database server
(just updating a timestamp in a table) as well as which of the nodes is the "active" one. In case
the active node does not send a heartbeat within a certain time, any of the remaining ones
automatically take over. It is everytime possible to join new nodes to the HA cluster by just
raising the amount of replicas of the Zabbix server.


## Zabbix Agent

> **zabbix-agent2** is supported in this helm chart.

**Zabbix agent** is deployed on a monitoring target to actively monitor local resources and applications (hard drives, memory, processor statistics etc).
**Zabbix agent** is deployed on a monitoring target to actively monitor local resources and
applications (hard drives, memory, processor statistics etc)
[Official documentation](https://www.zabbix.com/documentation/current/en/manual/concepts/agent).


## Zabbix Web (frontend)

**Zabbix web** interface is a part of Zabbix software. It is used to manage resources under monitoring and view monitoring statistics.
**Zabbix web** interface is a part of Zabbix software. It is used to manage resources under
monitoring and view monitoring statistics
[Official documentation](https://www.zabbix.com/documentation/current/en/manual/web_interface).

## Zabbix Web Service

**Zabbix web service** is a process that is used for communication with external web services
[Official documentation](https://www.zabbix.com/documentation/current/en/manual/concepts/web_service).

## Zabbix Proxy

> This helm chart installs Zabbix proxy with SQLite3 support

**Zabbix proxy** is a process that may collect monitoring data from one or more monitored devices and send the information to the Zabbix server, essentially working on behalf of the server. All collected data is buffered locally and then transferred to the **Zabbix server** the proxy belongs to.
**Zabbix proxy** is a process that may collect monitoring data from one or more monitored devices
and send the information to the Zabbix server, essentially working on behalf of the server.
All collected data is buffered locally and then transferred to the **Zabbix server** the
proxy belongs to
[Official documentation](https://www.zabbix.com/documentation/current/en/manual/concepts/proxy).

## PostgreSQL

A database is required for zabbix to work, in this helm chart we're using Postgresql 14.x.

> We use plain postgresql database by default WITHOUT persistence. If you want persistence or would like to use TimescaleDB instead, check the comments in the ``values.yaml`` file.
> We use plain postgresql database by default WITHOUT persistence. If you want persistence or
would like to use TimescaleDB instead, check the comments in the ``values.yaml`` file.


## Configure the chart

The items of section [Configuration](#Configuration) can be set via ``--set`` flag during installation or change the values according to the need of the environment in ``helm-zabbix/values.yaml`` file.
The items of section [Configuration](#Configuration) can be set via ``--set`` flag during
installation or change the values according to the need of the environment in
``helm-zabbix/values.yaml`` file.

### Configure central database access related settings

All settings referring to how the different components that this Chart installs access the Zabbix Database (either an external, already existing database or one deployed within this Helm chart) are being configured centrally under the ``db_access`` section of the ``values.yaml`` file.
All settings referring to how the different components that this Chart installs access the
Zabbix Database (either an external, already existing database or one deployed within
this Helm chart) are being configured centrally under the ``db_access`` section of the
``values.yaml`` file.

By default, this Chart will deploy it's own very simple PostgreSQL database. All settings relevant to how to access this database will be held in one central unified secret with the name configured with the ``db_access.unified_secret_name`` setting.
By default, this Chart will deploy it's own very simple PostgreSQL database. All settings
relevant to how to access this database will be held in one central unified secret with the
name configured with the ``db_access.unified_secret_name`` setting.

Instead of letting the Chart automatically generate such a secret with a random password (which will NOT be recreated on upgrade/redeploy), you can supply such a secret yourself. Use ``db_access.unified_secret_autocreate=false`` in such a case and read the comments in ``values.yaml`` for how the values inside the secret should be set.
Instead of letting the Chart automatically generate such a secret with a random password
(which will NOT be recreated on upgrade/redeploy), you can supply such a secret yourself.
Use ``db_access.unified_secret_autocreate=false`` in such a case and read the comments
in ``values.yaml`` for how the values inside the secret should be set.

If you want to connect your Zabbix installation to a Postgres database deployed using the [CrunchyData PGO Operator](https://access.crunchydata.com/documentation/postgres-operator/latest/), you can use the secret that PGO generates for your DB automatically directly to connect Zabbix to it, by just referring to its name with the ``db_access.unified_secret_name`` setting to it.
If you want to connect your Zabbix installation to a Postgres database deployed using the
[CrunchyData PGO Operator](https://access.crunchydata.com/documentation/postgres-operator/latest/),
you can use the secret that PGO generates for your DB automatically directly to connect Zabbix to it,
by just referring to its name with the ``db_access.unified_secret_name`` setting to it.

There is also the possibility to set all DB relevant settings directly inside the ``db_access`` section of the ``values.yaml`` file by using the settings noted there (``db_server_host``, ``postgres_user``, etc). If doing so, you still can use one single secret to told just and only the database password. If you want to do so, supply the ``db_access.postgres_password_secret`` and ``db_access.postgres_password_secret_key`` settings, accordingly.
There is also the possibility to set all DB relevant settings directly inside the ``db_access``
section of the ``values.yaml`` file by using the settings noted there
(``db_server_host``, ``postgres_user``, etc). If doing so, you still can use one single secret
to told just and only the database password. If you want to do so, supply the
``db_access.postgres_password_secret`` and ``db_access.postgres_password_secret_key``
settings, accordingly.

## Configure Postgresql database to match with your performance expectations

While the default database configuration shipped with this Chart is fine for most (very small, for testing only) Zabbix installations, you will want to set some specific settings to better match your setup. First of all, you should consider enabling Postgresql database persistence (``postgresql.persistence.enabled``), as otherwise all your changes and historical data will be gone as soon as you remove the installation of Zabbix. Additionally, you might want to tune Postgresql by supplying extra postgresql runtime parameters using the ``postgresql.extraRuntimeParameters`` dictionary:
While the default database configuration shipped with this Chart is fine for most (very small,
for testing only) Zabbix installations, you will want to set some specific settings to better
match your setup. First of all, you should consider enabling Postgresql database persistence
(``postgresql.persistence.enabled``), as otherwise all your changes and historical data will
be gone as soon as you remove the installation of Zabbix. Additionally, you might want to tune
Postgresql by supplying extra postgresql runtime parameters using the
``postgresql.extraRuntimeParameters`` dictionary:

```yaml
postgresql:
Expand All @@ -121,7 +174,9 @@ postgresql:
min_wal_size: 80MB
```

Alternatively, you can add your own configuration file for postgresql (using a ConfigMap and the ``postgresql.extraVolumes`` setting) to mount it into the postgresql container and referring to this config file with the ``postgresql.extraRuntimeParameters`` set to:
Alternatively, you can add your own configuration file for postgresql (using a ConfigMap and
the ``postgresql.extraVolumes`` setting) to mount it into the postgresql container and referring
to this config file with the ``postgresql.extraRuntimeParameters`` set to:

```yaml
postgresql:
Expand All @@ -132,10 +187,14 @@ postgresql:
### Configure the way how to expose Zabbix service:

- **Ingress**: The ingress controller must be installed in the Kubernetes cluster.
- **IngressRoute**: The custom resource definition if you use the [Traefik](https://traefik.io/traefik/) ingress controller.
- **IngressRoute**: The custom resource definition if you use the
[Traefik](https://traefik.io/traefik/) ingress controller.
- **Route**: The ingress controller used by Red Hat Openshift, based on HAProxy
- **ClusterIP**: Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster.
- **NodePort**: Exposes the service on each Node’s IP at a static port (the NodePort). You’ll be able to contact the NodePort service, from outside the cluster, by requesting ``NodeIP:NodePort``.
- **ClusterIP**: Exposes the service on a cluster-internal IP. Choosing this value makes the
service only reachable from within the cluster.
- **NodePort**: Exposes the service on each Node’s IP at a static port (the NodePort).
You’ll be able to contact the NodePort service, from outside the cluster, by requesting
``NodeIP:NodePort``.
- **LoadBalancer**: Exposes the service externally using a cloud provider’s load balancer.

# Installation
Expand All @@ -148,7 +207,8 @@ Add Helm repo:
helm repo add cetic https://cetic.github.io/helm-charts
```

Update the list helm chart available for installation (like ``apt-get update``). This is recommend before install/upgrade a helm chart:
Update the list helm chart available for installation (like ``apt-get update``). This is recommend
before install/upgrade a helm chart:

```bash
helm repo update
Expand Down Expand Up @@ -190,7 +250,8 @@ kubectl get pods -n monitoring

# How to access Zabbix

After deploying the chart in your cluster, you can use the following command to access the zabbix frontend service:
After deploying the chart in your cluster, you can use the following command to access the zabbix
frontend service:

View informations of ``zabbix`` services.

Expand Down
2 changes: 1 addition & 1 deletion docs/example/kind/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Custom values for zabbix.

zabbix_image_tag: alpine-6.0.6
zabbix_image_tag: alpine-6.2.0

db_access:
# central place for all database related parameters (db name, host, user, password) in one secret
Expand Down
4 changes: 4 additions & 0 deletions templates/cronjob-hanodes-autoclean.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{{- if .Values.zabbixserver.ha_nodes_autoclean.enabled }}
{{- if .Capabilities.APIVersions.Has "batch/v1/CronJob" }}
apiVersion: batch/v1
{{- else }}
apiVersion: batch/v1beta1
{{- end }}
kind: CronJob
metadata:
name: {{ template "zabbix.fullname" . }}-nodesclean
Expand Down
6 changes: 6 additions & 0 deletions templates/deployment-zabbix-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}-zabbix-server
app.kubernetes.io/managed-by: {{ .Release.Service }}-zabbix-server
spec:
{{- with .Values.zabbixserver.extraPodSpecs }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -160,6 +163,9 @@ spec:
{{- with .Values.zabbixserver.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.zabbixserver.extraInitContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
imagePullSecrets:
{{- range .Values.zabbixserver.image.pullSecrets }}
- name: {{ . | quote }}
Expand Down
6 changes: 6 additions & 0 deletions templates/deployment-zabbix-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}-zabbix-web
app.kubernetes.io/managed-by: {{ .Release.Service }}-zabbix-web
spec:
{{- with .Values.zabbixweb.extraPodSpecs }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -96,6 +99,9 @@ spec:
{{- with .Values.zabbixweb.extraContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.zabbixweb.extraInitContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
imagePullSecrets:
{{- range .Values.zabbixweb.image.pullSecrets }}
- name: {{ . | quote }}
Expand Down
6 changes: 6 additions & 0 deletions templates/deployment-zabbix-webservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}-zabbix-webservice
app.kubernetes.io/managed-by: {{ .Release.Service }}-zabbix-webservice
spec:
{{- with .Values.zabbixwebservice.extraPodSpecs }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -79,6 +82,9 @@ spec:
{{- with .Values.zabbixwebservice.extraContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.zabbixwebservice.extraInitContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
imagePullSecrets:
{{- range .Values.zabbixweb.image.pullSecrets }}
- name: {{ . | quote }}
Expand Down
6 changes: 6 additions & 0 deletions templates/statefulset-postgresql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}-postgresql
app.kubernetes.io/managed-by: {{ .Release.Service }}-postgresql
spec:
{{- with .Values.postgresql.extraPodSpecs }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -95,6 +98,9 @@ spec:
{{- with .Values.postgresql.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.postgresql.extraInitContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if .Values.postgresql.persistence.enabled }}
{{- if .Values.postgresql.persistence.existing_claim_name }}
Expand Down
6 changes: 6 additions & 0 deletions templates/statefulset-zabbix-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}-zabbix-proxy
app.kubernetes.io/managed-by: {{ .Release.Service }}-zabbix-proxy
spec:
{{- with .Values.zabbixproxy.extraPodSpecs }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -129,6 +132,9 @@ spec:
{{- with .Values.zabbixproxy.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.zabbixproxy.extraInitContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
imagePullSecrets:
{{- range .Values.zabbixagent.image.pullSecrets }}
- name: {{ . | quote }}
Expand Down
Loading

0 comments on commit c4fd444

Please sign in to comment.