Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loading credentials error with metric-collector container #66

Open
trif666 opened this issue Mar 10, 2021 · 1 comment
Open

loading credentials error with metric-collector container #66

trif666 opened this issue Mar 10, 2021 · 1 comment

Comments

@trif666
Copy link

trif666 commented Mar 10, 2021

Hello,

First, congrats to you and your job and thanks to share this project with us.

I'm trying to launch the stack but the metric-collector container displays an error when it attempts to check the credentials configuration file :

2021-03-10 09:57:15,534 collector: INFO: Sending Datapoint to: http://telegraf:8186/write
2021-03-10 09:57:15,534 scheduler: INFO: Worker Worker-120sec-1 took 0.0012273788452148438 seconds to run
2021-03-10 09:59:15,572 scheduler: INFO: Worker-120sec-1: Starting collection for 1 hosts
2021-03-10 09:59:15,573 scheduler: INFO: Worker-120sec-1: Collector Thread-1 scheduled with following hosts: ['switch-1']
2021-03-10 09:59:15,573 collector: INFO: Collector starting for: switch-1
2021-03-10 09:59:15,573 netconf_collector: INFO: Connecting to host: switch-1
Exception in thread Thread-8:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/source/lib/metric_collector/collector.py", line 57, in collect
dev.connect()
File "/source/lib/metric_collector/netconf_collector.py", line 75, in connect
if self.__credential['method'] in "key":

TypeError: 'NoneType' object is not subscriptable
2021-03-10 09:59:15,577 collector: INFO: Sending Datapoint to: http://telegraf:8186/write
2021-03-10 09:59:15,577 scheduler: INFO: Worker Worker-120sec-1 took 0.0009467601776123047 seconds to run

For authentication, I use SSH key method
Here is my credentials (lab-0-credentials.yaml) file :

lab_credentials:
username: user
method: key
key_file: keys/private-key
tags: juniper

"private-key" file is stored in quickstart/keys/

Can you confirm it is the right place to store it ?

Because of a proxy, I have to build first the metric-collector container :
$ CREDENTIALS=lab-0-credentials.yaml HOSTS=lab-0-hosts.yaml docker-compose build --build-arg http_proxy=http://proxy1:80/ --build-arg https_proxy=http://proxy1:80/

then I can launch the stack:
$ CREDENTIALS=lab-0-credentials.yaml HOSTS=lab-0-hosts.yaml docker-compose up

Error displays seems to be related to the non-existing method value but hosts information file is well recognized since device hostname is configured for netconf_collector.

Can you tell me if I do something wrong ?

Thanks again !

@eusmark
Copy link

eusmark commented Apr 20, 2021

I too am having the exact same problem on a brand new Ubuntu 20.04 LTS system

  1. i had to update the setup.py file as pip20 broke the initial deployment
ubuntu@py-dash:~/py-metric-collector$ diff setup.py setup.py.orig
15,19c15
< requirements_data = list(requirements_data)
< try:
<     requirements = [str(ir.req) for ir in requirements_data]
< except:
<     requirements = [str(ir.requirement) for ir in requirements_data]
---
> requirements = [str(package.req) for package in requirements_data]
  1. I get the same NoneType error on 'method' key lookup as trif666 above. i'm guessing python 3.8 has changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants