Open blondviper opened 2 years ago
This is expected, you shouldn't launch the script without args, you can test it working by doing:
root@aubergine:~# /etc/zabbix/scripts/k8s-stats.py discovery pods
{"data": [{"{#NAMESPACE}": "kube-system", "{#NAME}": "metrics-server-86cbb8457f-2ltz6"}, {"{#NAMESPACE}": "kube-system", "{#NAME}": "local-path-provisioner-5ff76fc89d-b5wvt"}, {"{#NAMESPACE}": "kube-system", "{#NAME}": "coredns-7448499f4d-mdgkx"}, {"{#NAMESPACE}": "traefik", "{#NAME}": "svclb-traefik-n59td"}, {"{#NAMESPACE}": "kubernetes-dashboard", "{#NAME}": "dashboard-metrics-scraper-856586f554-bp66h"}, {"{#NAMESPACE}": "kubernetes-dashboard", "{#NAME}": "kubernetes-dashboard-67484c44f6-bvl8k"}, {"{#NAMESPACE}": "default", "{#NAME}": "awx-operator-545497f7d5-g2jqr"}, {"{#NAMESPACE}": "awx", "{#NAME}": "awx-85446fc8f4-9rtsf"}, {"{#NAMESPACE}": "kresus", "{#NAME}": "kresus-84bb497584-dwc2d"}, {"{#NAMESPACE}": "traefik", "{#NAME}": "traefik-dfddb74d5-rph4g"}]}
root@aubergine:~# /etc/zabbix/scripts/k8s-stats.py discovery nodes
{"data": [{"{#NAME}": "aubergine"}]}
Instead of pods
or nodes
you can see the list in script:
targets = ['pods','nodes','containers','deployments','apiservices','componentstatuses']
Ill have to admit, I am so much a noob here. :) But I am not getting any info at all in zabbix, and if I try to use the script from cli I get the following error. :
/usr/lib/zabbix/externalscripts# ./k8s-stats.py discovery pods
Traceback (most recent call last):
File "./k8s-stats.py", line 65, in
Running k8s-stats.py from terminal says:
Traceback (most recent call last): File "./k8s-stats.py", line 20, in <module> target = 'pods' if 'containers' == sys.argv[2] else sys.argv[2] IndexError: list index out of range
I would appreciate any help. Thanks.