Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
220242b
fix monitor-user rights, jenkinsfile
blodone Nov 22, 2021
0c4d6ad
refactor
blodone Nov 23, 2021
c5a6c2f
refactor start_data_threads
blodone Nov 23, 2021
cba9d6c
fix dockerfile
blodone Nov 24, 2021
c30872d
fix build.sh
blodone Nov 24, 2021
716ff9c
config_default fix
blodone Nov 25, 2021
e0716ac
.dockerignore config fix
blodone Nov 25, 2021
b37c7ae
readme.md
Dec 1, 2021
b279df3
run shfmt -i 4 -w
Nov 24, 2022
89824f2
merge from zabbix-tooling
blodone Apr 12, 2023
a8af412
Merge pull request #1 from zabbix-tooling/master
blodone Apr 21, 2023
b5f0f21
remove .idea
blodone Apr 21, 2023
5e18cc3
Falsch-Positive Zählungen raus
Apr 27, 2023
e39dad1
Falsch-Positive Zählungen raus
Apr 27, 2023
60d482b
Falsch-Positive Zählungen raus
Apr 27, 2023
f70e022
alle Änderungen raus, die nicht wichtig
Apr 27, 2023
46dfc7a
dangling Spaces, bare Except
May 2, 2023
bdb4124
nonexistent hash throws TypeError
May 3, 2023
6a6ccae
parentheses
May 3, 2023
156209a
isort, re
May 3, 2023
8a8536f
kind dict prüfen
May 11, 2023
39ca576
uninitialized kind
May 11, 2023
84cfe87
isort uber alles
May 12, 2023
f4c9ab7
isort uber alles
May 12, 2023
d8eb4f7
import ordering
blodone May 15, 2023
7511a42
base -l 120, broken isort reverted
May 15, 2023
0eebc9b
ignore local test config
May 15, 2023
d26a0a0
py3.11
May 19, 2023
ce93c03
sent/send
May 22, 2023
d050160
pods/containers faster
May 22, 2023
4b8fbf7
Noch volles Logging, status waiting maskiert
May 22, 2023
c84b71a
better, shorter logic
May 22, 2023
1a8ff66
even simpler logic
May 22, 2023
abdb7eb
Bulk logging raus, nur noch Errorstate loggen.
May 22, 2023
29dcc21
5 Pod Phases, 3 Container States
May 23, 2023
62ca872
Logging auch deployment
May 23, 2023
55eedcc
dangling lines
May 23, 2023
8955764
ignore
May 23, 2023
e19e412
ini file in Docker
May 26, 2023
05f1765
changes
May 31, 2023
73c4fe7
Merge SRE-720 -> main
May 31, 2023
33d3e61
get_zabbix_metrics for pods
May 31, 2023
bd4c846
worky
Jun 1, 2023
38b5790
fix logging
Jun 1, 2023
9345146
logger fixed, pods fixed
Jun 1, 2023
feaa54f
pod monitoring
Jun 1, 2023
9155e6f
fix pod
Jun 1, 2023
ef1f105
config_default.ini
blodone Jun 2, 2023
06f4faf
fix build
blodone Jun 5, 2023
6d26384
set zabbix_dry_run default to False
Jun 6, 2023
6bc2b9a
fix pod resource_data json
Jun 6, 2023
f2f78e2
progress containers
blodone Jun 15, 2023
f745fdb
container reimplement
Jun 15, 2023
eea7f82
debug containers
Jun 15, 2023
1d2b8ce
fix report_global containers
blodone Jun 16, 2023
2eb3525
Dockerfile
blodone Jun 16, 2023
0e1a4ab
template update
Jun 20, 2023
531bf5c
remove template_group
Jun 20, 2023
8389d2d
update versions, fix node values
blodone Jun 26, 2023
0ca04ac
excepthook
blodone Jun 26, 2023
9d6c314
add resource_obj.added datetime comparison with discovery_sent
Jun 29, 2023
ee09337
fix resend added discovery_sent
Jun 29, 2023
9f93886
fix resend discovery check
Jun 29, 2023
4de6ff6
longer wait on discovery first run
blodone Jun 29, 2023
c6114fb
fix first run timedthread
blodone Jun 29, 2023
01e8fd0
log sending of data
Jul 4, 2023
f78258f
update recovery expressions
Jul 6, 2023
c31f0e7
speed up deployment resource data, better error log
Jul 7, 2023
9fe678c
fix terminated and imagepullbackoff
blodone Aug 28, 2023
8bdaa1a
refactor if for pod
blodone Aug 29, 2023
50cd37c
prepare re-check discovery items still there
blodone Mar 12, 2024
77d74fe
uid refresh check enable
Mar 12, 2024
ab1c102
obj_uid typo
blodone Mar 14, 2024
73e280b
fix real_name pod, del_obj orphan
Mar 14, 2024
c441971
del obj by string
Mar 14, 2024
9898f3c
del obj by string fix
Mar 14, 2024
51216c6
add data_refreshed timestamp
Mar 14, 2024
17e419b
copy resource.objects to delete
blodone Jun 11, 2024
cd9950c
secret for monitoring user
Nov 6, 2024
9f77eeb
refresh data with discovery after some time
blodone May 21, 2025
e2392fd
merge zabbix-tooling
blodone May 22, 2025
d98af23
fix pod, remove idea/workspace.xml
blodone May 22, 2025
7261354
remove duplicate .idea in .gitignore
blodone May 22, 2025
7b9d4d3
check before division by zero in pvc
blodone May 22, 2025
3ff0aae
fix discovery data
blodone May 22, 2025
9e06cf8
hotfix nodes name_space check
blodone May 22, 2025
6223d4b
prepare for zabbix-tooling merge
blodone May 22, 2025
9c10f67
fix components
blodone May 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ build.sh
.gitignore
kubernetes/*
venv/*
config_*
configd_*
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ venv/*
*.log
/config*.py
/config*.ini
.idea
357 changes: 0 additions & 357 deletions .idea/workspace.xml

This file was deleted.

28 changes: 14 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM python:3.11.0a3
LABEL maintainer="[email protected]"
FROM python:3.11
LABEL maintainer="[email protected]"
Comment on lines +1 to +2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove the maintainer reference.
Probably updating to python 3.13 is something we can do in this step (but not mandatory from review perspective)

LABEL Description="zabbix-kubernetes - efficent kubernetes monitoring for zabbix"

MAINTAINER [email protected]
Expand All @@ -10,23 +10,23 @@ ENV ZABBIX_SERVER "zabbix"
ENV ZABBIX_HOST "k8s"
ENV CRYPTOGRAPHY_DONT_BUILD_RUST "1"

COPY --chown=nobody:users requirements.txt /app/requirements.txt
WORKDIR /app
COPY --chown=nobody:users Pipfile /app/

RUN apt-get update -y && \
apt-get install libffi-dev libffi7 libssl-dev bash screen ncdu -y && \
pip3 install --upgrade pip && \
pip3 install -r /app/requirements.txt && \
apt-get upgrade -y && \
apt-get dist-upgrade -y && \
apt-get remove base libssl-dev libffi-dev gcc -y && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* /root/.cache
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get dist-upgrade -y
RUN apt-get install libffi-dev libffi8 libssl-dev bash screen ncdu -y
RUN pip install --root-user-action=ignore --upgrade pip && pip install --root-user-action=ignore pipenv
RUN PIPENV_USE_SYSTEM=1 pipenv install --skip-lock --system
RUN apt-get remove base libssl-dev libffi-dev gcc -y
RUN apt-get autoremove -y
RUN rm -rf /var/lib/apt/lists/* /root/.cache

COPY --chown=nobody:users base /app/base
COPY --chown=nobody:users k8sobjects /app/k8sobjects
COPY --chown=nobody:users check_kubernetesd /app/check_kubernetesd
COPY --chown=nobody:users config_default.ini /app/config_default.ini

USER nobody
WORKDIR /app

ENTRYPOINT [ "/app/check_kubernetesd" ]
7 changes: 4 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pipeline {
agent any
parameters {
booleanParam(defaultValue: false, description: 'Create release', name: 'RELEASE')
string(name: 'REPO', defaultValue: '-', description: 'Repo for docker')
}

triggers {
Expand All @@ -24,15 +25,15 @@ pipeline {
steps {
ansiColor('xterm') {
sh 'git fetch --tags'
sh './build.sh cleanup'
sh "./build.sh cleanup ${params.TARGET}"
}
}
}
stage('Build and Test') {
steps {
ansiColor('xterm') {
sh 'git fetch --tags'
sh "./build.sh default vicoconsulting"
sh "./build.sh default ${params.TARGET}"
}
}
}
Expand All @@ -42,7 +43,7 @@ pipeline {
}
steps {
ansiColor('xterm') {
sh './build.sh publish_image vicoconsulting'
sh "./build.sh publish_image ${params.TARGET}"
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
kubernetes = "==21.7.0"
cryptography = "==36.0.1"
types-cryptography = "==3.3.10"
py-zabbix = "==1.1.7"
sentry-sdk = "==1.5.1"
adal = "==1.2.7"
urllib3 = "==1.26.7"
pytest = "==6.2.5"
mypy = "==0.930"
flake8 = "==4.0.1"
coloredlogs = "==15.0.1"

[dev-packages]

[requires]
python_version = "3.11"
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The solution currently supervises the following types of Kubernetes entities:

For details or a overview of the monitored kubernetes attributes, have a look at the [documentation](http://htmlpreview.github.io/?https://github.com/zabbix-tooling/k8s-zabbix/blob/master/documentation/template/custom_service_kubernetes.html)

The current docker image is published at https://hub.docker.com/repository/docker/scoopex666/k8s-zabbix/
The current docker image is published at https://hub.docker.com/r/zabbixtooling/k8s-zabbix/

Architecture Details
=====================
Expand Down Expand Up @@ -141,6 +141,20 @@ Production Deployment
* "Monitoring" → "Latest data" → "Add Hosts": i.e. "k8s-prod-001"
* Enable Option "Show items without data" → Button "Apply"

Configuration
=====================
All Configuration Options are available through ENV Variables
for a list of options check *config_default.py*

* K8S_CONFIG_TYPE
* incluster
* use default kubeconfig
* kubeconfig
* load kubeconfig file from current user
* token
* use token auth


Unix Signals
============

Expand Down
9 changes: 8 additions & 1 deletion base/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ClusterAccessConfigType(Enum):
TOKEN = "token"


logger = logging.getLogger(__file__)
logger = logging.getLogger("k8s-zabbix")


@dataclass(order=True)
Expand All @@ -38,6 +38,8 @@ class Configuration:
sentry_enabled: bool = False
sentry_dsn: str = ""

container_crawling: str = "container"

zabbix_server: str = 'example.zabbix-server.com'
zabbix_resources_exclude: list[str] = field(default_factory=lambda: [])
zabbix_host: str = 'k8s-example-host'
Expand All @@ -59,6 +61,11 @@ class Configuration:
discovery_interval_slow: int = 60 * 60 * 2
resend_data_interval_slow: int = 60 * 30

discovery_interval_delay: int = 120
data_resend_interval_delay: int = 180

data_refresh_interval: int = 60 * 60 * 4

def _convert_to_type(self, field_name: str,
value: str | list[str] | bool | int | ClusterAccessConfigType) -> \
str | list[str] | bool | int | ClusterAccessConfigType:
Expand Down
Loading