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

Returner Influxdb 404 page not found #31504

Closed
valentin2105 opened this issue Feb 26, 2016 · 16 comments
Closed

Returner Influxdb 404 page not found #31504

valentin2105 opened this issue Feb 26, 2016 · 16 comments
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps Returners severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@valentin2105
Copy link

Hi !

Expected Behavior

Want to return some Salt output on InfluxDB

Actual Behavior

When I try :
salt-call influxdb.db_list No problem, It give me the list of databases
But When I try :
salt-call test.ping return= influxdb I got :

[INFO ] Starting new HTTP connection (1): localhost
[DEBUG ] "POST /db/salt/series?p=salt&time_precision=s&u=salt HTTP/1.1" 404 19
[CRITICAL] Failed to store return with InfluxDB returner: 404: 404 page not found

Steps to Reproduce Issue

Try so send output to InfluxDB ?

Versions Report

Salt Version:
Salt: 2015.8.7

Dependency Versions:
Jinja2: 2.7.3
M2Crypto: 0.21.1
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
Python: 2.7.9 (default, Mar 1 2015, 12:57:24)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
cffi: 0.8.6
cherrypy: Not Installed
dateutil: 2.4.2
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: 0.1.3
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: 2.10
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: Not Installed
timelib: Not Installed

System Versions:
dist: debian 8.3
machine: x86_64
release: 3.16.0-4-amd64
system: debian 8.3

I Try with Influx 0.9.x et 0.10.x (the new one).

Relevant Logs, Configs, or States

The minion.d/influxdb.conf is simple, localhost:8066 (it work because influxdb.db_list work)
I find something : When I curl localhost:8086, I got logs in influxdb.log but when I salt return, not any logs...

Thanks =)

@jfindlay jfindlay added the info-needed waiting for more info label Feb 26, 2016
@jfindlay jfindlay added this to the Blocked milestone Feb 26, 2016
@jfindlay
Copy link
Contributor

@valentin2105, thanks for reporting. Is it possible for you to post your actual minion configs including the configs relevant for setting up influxdb as a salt returner? Thanks.

@valentin2105
Copy link
Author

The minion.d/influxdb.conf file :

influxdb.db: 'salt'
influxdb.user: 'salt'
influxdb.password: 'salt'
influxdb.host: 'localhost'
influxdb.port: 8086

The database & the user exists.

The /etc/salt/minion file contain only the master directive.

@jfindlay jfindlay modified the milestones: Approved, Blocked Feb 29, 2016
@jfindlay jfindlay added Returners Platform Relates to OS, containers, platform-based utilities like FS, system based apps Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P3 Priority 3 and removed info-needed waiting for more info labels Feb 29, 2016
@cachedout
Copy link
Contributor

Did you create the InfluxDB database first?

@valentin2105
Copy link
Author

Yes, the database exist and the user 'salt' grant all permissions.

root@snipe:~# >> salt-call influxdb.db_list
[INFO    ] Starting new HTTP connection (1): localhost
local:
    |_
      ----------
      name:
          _internal
    |_
      ----------
      name:
          salt

@cachedout
Copy link
Contributor

Odd. Have you tried the curl command that's in the debug log you posted above? Do the Influx logs provide any clue?

@valentin2105
Copy link
Author

Humm, I don't know how to make the Curl like the Salt Request made it.

@valentin2105
Copy link
Author

My command that I try to return to InfluxDB :
salt-call status.loadavg --return=influxdb
The output :

local:
    ----------
    1-min:
        0.02
    15-min:
        0.05
    5-min:
        0.04

This curl command work on InfluxDB 0.9.x :

curl -i -XPOST 'http://localhost:8086/write?db=salt' --data-binary 
'cpu_load,host=local,load=1min value=0.67
cpu_load,host=local,load=5min value=0.68                                  
cpu_load,host=local,load=15min value=0.69'

@emosher
Copy link
Contributor

emosher commented Mar 11, 2016

Hey Salt crew, I wanted to chime in here. I was messing with this today having this exact problem. Database exists but I still get a 404 when using the returner. I did some digging and here's what I found out...

Short version - the Salt returner code for InfluxDB is using the 0.8 version of the InfluxDB client, which is incompatible with InfluxDB 0.9 and 0.10. The 0.8 endpoints use the /db/database/series format, while the 0.9+ use /write as @valentin2105 alluded to above. It looks to be a matter of changing this line to be from influxdb import InfluxDBClient.

Longer version - See the InfluxDB docs page on 0.8 vs 0.9 for more on the endpoint issue. Basically, 0.8 uses /db/database and 0.9+ uses /write. It turns out the Python client has support for both, but as I linked above the returner is using the 0.8 version. Anyway, looks like a pretty easy fix, assuming you are OK with dropping support for InfluxDB 0.8.

Hope that helps.

@rallytime
Copy link
Contributor

Some recent work has been done on the influxdb module for users to work with 0.8 and 0.9 versions in #31770 and #31787, but I don't think that solves this issue here.

@anlutro You might be interested in taking a swing at this one.

@anlutro
Copy link
Contributor

anlutro commented Mar 11, 2016

Probably better if someone who actually plans to use the influxdb returner does the actual implementation :)

If you want to keep compatibility with 0.8, I guess this is a bit trickier than doing hasattr calls. You'd probably have to add a new minion config flag for whether to use 0.8 or 0.9+.

Personally I don't think keeping 0.8 support is worth it.

@valentin2105
Copy link
Author

I tried to change this line with from influxdb import InfluxDBClient. Salt could not load the influxDB Returner.

@markuslang79
Copy link
Contributor

I've made a small change in #32125 to influxdb_return.py to allow storing the data in an InfluxDB 0.9+ version without using any tags. I've tested those changes against an InfluxDB 0.11.0 instance.

@jfindlay jfindlay added the fixed-pls-verify fix is linked, bug author to confirm fix label Mar 24, 2016
@valentin2105
Copy link
Author

@pret79
Hi !

I have try your modification on influxdb_return.py on Salt 2015.8.8 and this doesn't work for me with InfluxDB 0.11

It's work for you ?

@markuslang79
Copy link
Contributor

@valentin2105
Hi, I'm successfully running my changes on influxdb_return.py with a Salt 2015.8.8 installation against an v0.11.0 InfluxDB. Just applied some additional changes to #32125 regarding keeping compatibility with InfluxDB 0.8.x and avoiding storing duplicate data - so you might want to check those changes out.

What problem did you run into? Any interesting output on the console or the Salt logs?

I've attached some screenshots of InfluxDB Admin UI with some sample data stored in the Salt measurements:

influxdb01
influxdb02
influxdb03

@valentin2105
Copy link
Author

@pret79 It's work for me with your last changes.

Thanks a lot, I use your .py file for waiting your pull request's approve.

I have a small problem for have a visual in Grafana, are you able to show output of "status.load_avg" in Grafana for example ?

Good work =)

@cachedout
Copy link
Contributor

Looks like this is all fixed so I'm going to go ahead and close this. Thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps Returners severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

7 participants