2016-04-25 17 views
6

Ich versuche, die Influxdb-Python-Lib, die ich gefunden here. Aber ich kann nicht einmal das Tutorial-Programm funktionieren.influxdb Python: 404 Seite nicht gefunden

Wenn ich den folgenden Beispielcode auszuführen:

$ python 

>>> from influxdb import InfluxDBClient 

>>> json_body = [ 
    { 
     "measurement": "cpu_load_short", 
     "tags": { 
      "host": "server01", 
      "region": "us-west" 
     }, 
     "time": "2009-11-10T23:00:00Z", 
     "fields": { 
      "value": 0.64 
     } 
    } 
] 

>>> client = InfluxDBClient('localhost', 8086, 'root', 'root', 'example') 

>>> client.create_database('example') 

Ich erhalte diese Fehlermeldung mit der letzten Zeile:

>>> client.create_database('example') 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 318, in create_database 
    status_code=201 
    File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 124, in request 
    raise InfluxDBClientError(response.content, response.status_code) 
influxdb.client.InfluxDBClientError: 404: 404 page not found 

Meine installierte Version:

[email protected]:~ $ influx 
Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring. 
Connected to http://localhost:8086 version 0.9.6.1 
InfluxDB shell 0.9.6.1 

Es wäre wirklich schön, wenn jemand mich hier auf mein Problem hinweisen kann.

UPDATE

Vielleicht ist das hilfreich. Ich bin auf einem Raspberry Pi 3 mit Jessie und mit diesem tuturial link

UPDATE 2

installiert influxdb wenn ich curl http://localhost:8086 laufen bekomme ich auch 404 Seite nicht gefunden. Auf dem Port 8083 bekomme ich eine Antwort.

Antwort

1

Ich habe Influxdb auf einem Himbeer-Pi2 läuft.

InfluxDB shell 0.12.1 ist die Version, die ich habe. Sie führen 0.9.6.1 aus, das veraltet sein könnte, aber dennoch das neueste in dem von Ihnen verwendeten Repo ist.

Ihre Ports scheinen richtig, eine schnelle netstat zeigt:

tcp6  0  0 :::8083     :::*     LISTEN  17740/influxd 
tcp6  0  0 :::8086     :::*     LISTEN  17740/influxd 
tcp6  0  0 :::8088     :::*     LISTEN  17740/influxd 

es zu testen, ich das gleiche Beispiel Skript verwendet, wie Sie mit einer geringfügigen Änderung tat,:

#!/usr/bin/python 

import random 
from datetime import datetime 

from influxdb import InfluxDBClient 


query = 'select value from wetter;' 
client = InfluxDBClient(host='127.0.0.1', database='wetter') 
print(client) 

current_time = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') 
json_body = [ 
    { 
     "measurement": "temperature", 
     "tags": { 
      "host": "192.168.0.82", 
      "location": "room" 
     }, 
     "time": current_time, 
     "fields": { 
      "value": random.random() 
     } 
    } 
] 
print(json_body) 

client.write_points(json_body) 

Ich fange dann das Skript mit while true; do ./influxdb-test.py; sleep 2; done, das alle 2 Sekunden einen neuen Eintrag einfügt.

> select * from temperature 

1462865736000000000 192.168.0.82 room 0.116745414817 
1462866059000000000 192.168.0.82 room 0.576278097718 
1462866062000000000 192.168.0.82 room 0.731955354635 
1462866065000000000 192.168.0.82 room 0.536106447983 
1462866068000000000 192.168.0.82 room 0.965246396917 
1462866070000000000 192.168.0.82 room 0.785592521739 
3

Ich konnte keinen Kommentar posten, da ich nicht den Ruf habe.

Ich fand das gleiche Problem mit einem Himbeer PI und v0.12.2. Wenn Sie https://docs.influxdata.com/influxdb/v0.12/guides/writing_data/ gehen gibt es diesen Befehl

curl -G http://localhost:8086/query --data-urlencode "q = CREATE DATABASE mydb"

Es ist für mich gearbeitet.

UPDATE 1

Ich glaube, Sie nicht korrekt den Python InfluxDB Treiber installiert haben. Befolgen Sie die Schritte auf der Seite InfluxDB-Python. Achten Sie besonders darauf, die folgenden Befehle als sudo auszuführen.

pip installieren influxdb

--upgrade influxdb installieren pip

+0

danke, ich schon diese Abhilfe verwenden, aber ich bin für eine Antwort für mein Problem mit dem influxdb-Python lib – IIIIIIIIIIIIIIIIIIIIII

+0

Testen der Anleitung mit dem Download 0.12.2 tar.gz (https suchen: // dl. influxdata.com/influxdb/releases/influxdb-0.12.2-1_linux_armhf.tar.gz) arbeitete an einer 64-Bit-Linux-VM, aber nicht an der Himbeer-PI. – sdbol

+0

Hat die Interaktion mit InfluxDB auf einem Rasberry Pi über die [InfluxDB CLI] (https://docs.influxdata.com/influxdb/v0.12/tools/shell) auch ähnliche Probleme? Ich frage mich, ob dies ein allgemeines ARM InfluxDB-Problem oder speziell der Python-Client ist. –