-
Notifications
You must be signed in to change notification settings - Fork 79
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
401 returned when using plugin - even though standard Basic Auth curls work using creds #32
Comments
Hmm. Is there anything in the RabbitMQ logs to indicate an authorization error when calling the API? |
I hit the same issue on CentOS 7, with SELinux set to enforcing.
A quick check via setenforce 0 shows, it works correctly (after figuring out, I had to enable rabbitmq_management plugin.
|
@Pashbee It has been a while since you posted this issue. Have you tried @mrunge suggestion ? |
The following worked for me: #50 |
Still hitting same problem; using latest release, collectd-rabbitmq:1.17.0 (installed via pip) Error messages:
Config:
|
I just booted the vagrant image with this repo and changed the password that I was using in the config. got a different error than you did.
and on the rabbitmq side a series of
What does your rabbitmq log look like ? |
Same -- it was lacking access for one of the API calls for the user used to draw the graphs, which was fatal for the plugin to start. Either way -- I bumped up the plugin to latest 1.18.0, fixed the permissions for the user and now all is working as expected! 👍 |
May be check that your user have access to "/" virtualhost to iterate virtual-hosts |
I encountered this issue as well on Debian Jessie. Fixed by skipping the / vhost in CollectdPlugin.read(). Submitted pull request, but may not address underlying issue. |
I may have fixed this with PR #74 . |
If you have this problem, check your RabbitMQ logs. I had the same error when using a normal RabbitMQ user, and the logs said :
I solved it by giving the monitoring rights to the user with this command :
Then I ran into other errors, but that's for another issue. |
I am using Python 2.7.3
Collectd config looks like this:-
TypesDB "/usr/share/collectd/types.db" LoadPlugin python <Plugin python> LogTraces true Interactive false Import "collectd_rabbitmq.collectd_plugin" <Module "collectd_rabbitmq.collectd_plugin"> Username "<username>" Password "<password>" Realm "RabbitMQ Management" Host "localhost" Port "15672" </Module> </Plugin>
My Error's look like this in the collectd log:-
[2016-04-25 15:09:10] HTTP Error: HTTP Error 401: Unauthorized [2016-04-25 15:09:10] Unhandled python exception in read callback: TypeError: 'NoneType' object is not iterable [2016-04-25 15:09:10] Traceback (most recent call last): [2016-04-25 15:09:10] File "/usr/local/lib/python2.7/dist-packages/collectd_rabbitmq/collectd_plugin.py", line 89, in read PLUGIN.read() [2016-04-25 15:09:10] File "/usr/local/lib/python2.7/dist-packages/collectd_rabbitmq/collectd_plugin.py", line 114, in read self.dispatch_exchanges(vhost_name) [2016-04-25 15:09:10] File "/usr/local/lib/python2.7/dist-packages/collectd_rabbitmq/collectd_plugin.py", line 182, in dispatch_exchanges stats = self.rabbit.get_exchange_stats(vhost_name=vhost_name) [2016-04-25 15:09:10] File "/usr/local/lib/python2.7/dist-packages/collectd_rabbitmq/rabbit.py", line 135, in get_exchange_stats return self.get_stats('exchange', exchange_name, vhost_name) [2016-04-25 15:09:10] File "/usr/local/lib/python2.7/dist-packages/collectd_rabbitmq/rabbit.py", line 180, in get_stats names = stat_name_func(vhost) [2016-04-25 15:09:10] File "/usr/local/lib/python2.7/dist-packages/collectd_rabbitmq/rabbit.py", line 126, in get_exchange_names return self.get_names(all_exchanges) [2016-04-25 15:09:10] File "/usr/local/lib/python2.7/dist-packages/collectd_rabbitmq/rabbit.py", line 43, in get_names for item in items: [2016-04-25 15:09:10] TypeError: 'NoneType' object is not iterable [2016-04-25 15:09:10] read-function of plugin
python.collectd_rabbitmq.collectd_plugin' failed. Will suspend it for 160.000 seconds.`If I use similar urllib2 code as a test my api call works fine:-
import urllib2 SERVER = 'localhost:15672' authinfo = urllib2.HTTPPasswordMgrWithDefaultRealm() authinfo.add_password('RabbitMQ Management', SERVER, '', '') page = 'HTTP://'+SERVER+'/api/vhosts' handler = urllib2.HTTPBasicAuthHandler(authinfo) myopener = urllib2.build_opener(handler) opened = urllib2.install_opener(myopener) output = urllib2.urlopen(page) print output.read()
Whats strange about the exceptions is that even though they happen, I eventually have data in my graphite installation but can be delayed significantly.
The text was updated successfully, but these errors were encountered: