ike-dai / zabbix_anomaly

Anomaly detection score monitoring plugin for Zabbix
Apache License 2.0
36 stars 8 forks source link

Getting error when running program #1

Closed banzayats closed 8 years ago

banzayats commented 8 years ago

I'm getting the following error when running program from command line:

# ./zabbix_anomaly-linux-amd64 -i 34813 -user zabbix -pass zabbix -interval 60

panic: interface conversion: interface is nil, not []interface {}

goroutine 1 [running]:
panic(0x792540, 0xc82006cc00)
        /usr/local/go/src/runtime/panic.go:481 +0x3e6
main.main()
        /root/go_work/src/github.com/zabbix_anomaly/zabbix_anomaly.go:97 +0xbff
ike-dai commented 8 years ago

Thank you for reporting! It seems that this error is occured not to get item data from itemid(34813) through Zabbix API.

Please check the following information.

Best regards

banzayats commented 8 years ago

My Zabbix is using another url, so I've passed it to the script: # /zabbix_anomaly-linux-amd64 -h localhost -u http://localhost/api_jsonrpc.php -u Admin -pass zabbix -i 34813 But the error still here:

panic: interface conversion: interface is nil, not []interface {}

goroutine 1 [running]:
panic(0x792540, 0xc82000e900)
        /usr/local/go/src/runtime/panic.go:481 +0x3e6
main.main()
        /root/go_work/src/github.com/zabbix_anomaly/zabbix_anomaly.go:97 +0xbff
ike-dai commented 8 years ago

Can you connect to http://localhost/api_jsonrpc.php from your Zabbix server?

for example,

# curl  -H "Content-Type: application/json-rpc" -d '{"jsonrpc": "2.0","method": "user.login","params": {"user": "Admin","password": "zabbix"},"id": 1}' http://localhost/api_jsonrpc.php

Can you get auth token?

banzayats commented 8 years ago

Yes: {"jsonrpc":"2.0","result":"b12789c4c8b7a79963285735ff06df92","id":1}

ike-dai commented 8 years ago

thanks trying. itemid 34813 is right?

banzayats commented 8 years ago

I've tried different item ids but always got the same error.

ike-dai commented 8 years ago

ok. Please wait a momemt. I will change the code for debbuging(output error message).

and, please tell me your Zabbix version.

banzayats commented 8 years ago

Zabbix 3.0.3

ike-dai commented 8 years ago

I have released new pre-release version adding error handling. https://github.com/ike-dai/zabbix_anomaly/releases/tag/0.0.2

Please try this version. And please send me the cli output result.

banzayats commented 8 years ago

Hello. I've got the following error: [ERROR]: zabbix api login error: Post Admin: unsupported protocol scheme ""

ike-dai commented 8 years ago

Thank you for trying. I think that this error occurred the wrong url. Please check -u option. At this option, some space might be included.

banzayats commented 8 years ago

Thank you for your response. The problem was the duplicated parameters:

zabbix_anomaly-linux-amd64 -h localhost -u http://localhost/api_jsonrpc.php -u Admin -pass zabbix -i 34813