HariSekhon / Nagios-Plugins

450+ AWS, Hadoop, Cloud, Kafka, Docker, Elasticsearch, RabbitMQ, Redis, HBase, Solr, Cassandra, ZooKeeper, HDFS, Yarn, Hive, Presto, Drill, Impala, Consul, Spark, Jenkins, Travis CI, Git, MySQL, Linux, DNS, Whois, SSL Certs, Yum Security Updates, Kubernetes, Cloudera etc...
https://www.linkedin.com/in/HariSekhon
Other
1.14k stars 506 forks source link

check_datastax_opscenter_cassandra_* scripts with opscenter 5.1.3 - auth issue: 401 Unauthorized #87

Open donnymgarcia opened 8 years ago

donnymgarcia commented 8 years ago

Hi,

Trying to use check_datastax_opscentercassandra* scripts with opscenter 5.1.3, but receiving auth error "401 Unauthorized". I've confirmed the username/password are correct with curl:

# curl -X POST -d '{"username":"#####","password":"#############"}' 'http://x.x.x.x:8888/login' {"sessionid": "3052f0a4e13c22673f9b7f68e7124517"}

`# ./check_datastax_opscenter_cassandra_bestpractice.pl --host x.x.x.x --user '#####' --password '#############' --list-clusters -vvv verbose mode on

check_datastax_opscenter_cassandra_bestpractice.pl version 0.2 => Hari Sekhon Utils version 1.17.9

host: x.x.x.x port: 8888 user: ##### password: run now: false

setting timeout to 10 secs

setting http per request timeout to 9.00 secs

querying DataStax OpsCenter HTTP GET http://x.x.x.x:8888/cluster-configs (basic authentication) returned HTML:

{"message": "You must be logged in for this operation", "type": "Unauthorized"}

http status code: 401 http status message: Unauthorized

CRITICAL: 401 Unauthorized. Message: You must be logged in for this operation`

Any idea?

Thanks in advance.

donnymgarcia commented 8 years ago

We upgraded to the latest opscenter 5.2.4 and still see the above issue.

HariSekhon commented 8 years ago

Hi @donnymgarcia

Thanks for raising this.

That plugin does the equivalent of a curl -u rather than a curl -d which implicitly does a POST instead of a GET.

Does curl -u user:password... work?

HariSekhon commented 8 years ago

Ok so I see the problem, opscenter authentication isn't normally enabled and it requires a post login to get a session id token first.

This will require significant changes so it's going to take a while as I'm working on other things and am not currently focusing on Cassandra (although I will return it to before too long).

donnymgarcia commented 8 years ago

Thanks @HariSekhon for responding! Looking forward to when the enhancement is in place. I've been using the checkcassandra* plugins with great result. Would love to put in place the check_datastax_opscentercassandra* plugins for more visibility.

donnymgarcia commented 8 years ago

Any chance you'll get to this soon?

HariSekhon commented 8 years ago

Schedule is full but I should be able to look at this again within 3 weeks