objectiveit / zabbix-kubernetes

GNU General Public License v3.0
19 stars 4 forks source link

k8s_collect.pl returned no Data #6

Open keyless-tracer opened 4 years ago

keyless-tracer commented 4 years ago

Hi,

when I test the script, there is no real error message, except three zeros

/usr/lib/zabbix/externalscripts# ./k8s_collect.pl 127.0.0.1 /etc/zabbix/hostconfigs/config test
sent: 0; skipped: 0; total: 0

zabbix server 4.4 other monitors working fine.

What I have done

1: Installed the dependencies:

LWP::UserAgent
JSON
ZABBIX_SENDER

2: Copied scripts to zabbix external scripts path

ExternalScripts=/usr/lib/zabbix/externalscripts

3: Imported Zabbix template

4: Configured zabbix macros in template with correct path to kubernetes config file

{$K8SCONFIG} /etc/zabbix/hostconfigs/config
{$NAMESPACE} mytk-ml

config file seems to be Ok

/etc/zabbix/hostconfigs# kubectl --kubeconfig=/etc/zabbix/hostconfigs/config get deployments -n kube-system                           
NAME                   READY   UP-TO-DATE   AVAILABLE   AGE
coredns                2/2     2            2           150d
coredns-autoscaler     1/1     1            1           150d
kubernetes-dashboard   1/1     1            1           150d
metrics-server         1/1     1            1           150d
omsagent-rs            1/1     1            1           150d
tiller-deploy          1/1     1            1           143d
tunnelfront            1/1     1            1           150d

5: Create Zabbix API user and assign appropriate permissions. User has "Admin Role"

6: Then created a host with the template.

7: But i don't get any Data back.

/usr/lib/zabbix/externalscripts# ./k8s_collect.pl 127.0.0.1 /etc/zabbix/hostconfigs/config test
sent: 0; skipped: 0; total: 0

I'm not really sure, how to debug this Error.

Thanks in Advanced

Frintrop commented 4 years ago

You can call perl in debug mode ….

Von: keyless-tracer notifications@github.com Antworten an: objectiveit/zabbix-kubernetes reply@reply.github.com Datum: Donnerstag, 13. Februar 2020 um 15:15 An: objectiveit/zabbix-kubernetes zabbix-kubernetes@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Betreff: [objectiveit/zabbix-kubernetes] k8s_collect.pl returned no Data (#6)

Hi,

when I test the script, there is no real error message, except three zeros

/usr/lib/zabbix/externalscripts# ./k8s_collect.pl 127.0.0.1 /etc/zabbix/hostconfigs/config test

sent: 0; skipped: 0; total: 0

zabbix server 4.4 other monitors working fine.

What I have done

1: Installed the dependencies:

LWP::UserAgent

JSON

ZABBIX_SENDER

2: Copied scripts to zabbix external scripts path

ExternalScripts=/usr/lib/zabbix/externalscripts

3: Imported Zabbix template

4: Configured zabbix macros in template with correct path to kubernetes config file

{$K8SCONFIG} /etc/zabbix/hostconfigs/config

{$NAMESPACE} mytk-ml

config file seems to be Ok

/etc/zabbix/hostconfigs# kubectl --kubeconfig=/etc/zabbix/hostconfigs/config get deployments -n kube-system

NAME READY UP-TO-DATE AVAILABLE AGE

coredns 2/2 2 2 150d

coredns-autoscaler 1/1 1 1 150d

kubernetes-dashboard 1/1 1 1 150d

metrics-server 1/1 1 1 150d

omsagent-rs 1/1 1 1 150d

tiller-deploy 1/1 1 1 143d

tunnelfront 1/1 1 1 150d

5: Create Zabbix API user and assign appropriate permissions. User has "Admin Role"

6: Then created a host with the template.

7: But i don't get any Data back.

/usr/lib/zabbix/externalscripts# ./k8s_collect.pl 127.0.0.1 /etc/zabbix/hostconfigs/config test

sent: 0; skipped: 0; total: 0

I'm not really sure, how to debug this Error.

Thanks in Advanced

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/objectiveit/zabbix-kubernetes/issues/6?email_source=notifications&email_token=ABP63MUJ5C3UCAYM77WB6JTRCVICBA5CNFSM4KUTLY6KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4INIYIZA, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABP63MSJVCU2CSP65UO4QJ3RCVICBANCNFSM4KUTLY6A.

keyless-tracer commented 4 years ago

Hi Frintrop. thanks for fast response.

By debugging i get the Message:

perl -d k8s_collect.pl 127.0.0.1 /etc/zabbix/hostconfigs/config -test

Loading DB routines from perl5db.pl version 1.51
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main::(k8s_collect.pl:9):       my $APIURL = 'http://127.0.0.1/zabbix/api_jsonrpc.php';

What i also checked:

Authentication is working fine:

./auth.pl 
Authentication successful. Auth ID: 6da1ed795b2f407945ad72b345364945
curl -i -X POST -H 'Content-type:application/json' -d '{"jsonrpc":"2.0","method":"user.login","params":{ "user":"zabbixapi","password":"zabbixapipass"},"auth":null,"id":0}' http://127.0.0.1/zabbix/api_jsonrpc.php
HTTP/1.1 200 OK
Date: Fri, 14 Feb 2020 10:14:53 GMT
Server: Apache
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Methods: POST
Access-Control-Max-Age: 1000
Content-Length: 68
Content-Type: application/json

{"jsonrpc":"2.0","result":"2b8d589255574949480993387819836b","id":0}