AICoE / prometheus-anomaly-detector

A newer more updated version of the prometheus anomaly detector (https://github.com/AICoE/prometheus-anomaly-detector-legacy)
GNU General Public License v3.0
597 stars 151 forks source link

ConfigQuestion "cannot import name 'Metric' from 'prometheus_api_client'" #75

Closed DirkFries closed 5 years ago

DirkFries commented 5 years ago

Hi @all,

while testing this tool I ran into an Syntax Error in a very early stage of testing.

The environment variables were set:

host:~/prometheus-anomaly-detector-master # echo $FLT_RETRAINING_INTERVAL_MINUTES ; echo $FLT_ROLLING_TRAINING_WINDOW_SIZE ; echo $FLT_METRICS_LIST; echo $FLT_PROM_URL 5 1d up{vsphere_disk_maxtotallatency_latest{host=esx20b}}; http://promhost.domain.de:9090

But if I start the app I get this error:

host:~/prometheus-anomaly-detector-master # /usr/local/bin/python3.7 app.py Traceback (most recent call last): File "app.py", line 11, in from prometheus_api_client import PrometheusConnect, Metric ImportError: cannot import name 'Metric' from 'prometheus_api_client' (/usr/local/lib/python3.7/site-packages/prometheus_api_client/init.py)

With tcpdump I could not see packets between my host and promhost.domain.de. With w3m I can connect to http://promhost.domain.de:9090 without problems.

Can anyone give me a hint how I can troubleshoot this issue ?

Bye, Dirk

4n4nd commented 5 years ago

I think that means the version of prometheus-api-client installed is not the newest. This might be an issue on our side, we need to update our Pipfile.

Until then, can you just install the library directly from source by running: pip install https://github.com/AICoE/prometheus-api-client-python/zipball/v0.0.2

I think this should fix the issue.

4n4nd commented 5 years ago

@DirkFries The dependencies for this should be updated now, I will close this issue. If you still have any problems please feel free to reopen it. Thanks