Support Authentication for Apache Solr


Kris Reese
 Share

Recommended Posts

12 hours ago, Michael Baker said:

They do... jmx.user and jmx.pass

Perhaps I'm missing something, but I'm having to make adjustments to the Groovy scripts and test the outcomes of those changes.  For example:

I'm testing with the Apache_Solr_JVM_API data source.  Here's the snippet of that script:

/*******************************************************************************
 * © 2007-2019 - LogicMonitor, Inc. All rights reserved.
 ******************************************************************************/

import groovy.json.JsonSlurper

def host = hostProps.get("system.hostname")
def port = hostProps.get("solr.port") ?: "8983"

def json = new JsonSlurper().parseText("http://${host}:${port}/solr/admin/metrics?group=solr.jvm".toURL().text)

json.metrics.each
    {
        it.value.each
            {
                metric ->

                    if (metric.value.toString().isNumber()) {
                        println metric
                    }
            }
    }

return 0

 

Firstly, we don't allow connections over port 80.  As written, there's no way for me to provide an override.

Secondly, because of point one, I don't need to specify the port.  I could attempt to pass in a blank value, but the json variable would contain a colon which would break.

Thirdly, this particular script does not appear to use the jmx.user and jmx.pass properties.

Making adjustments to the above script by changing http to https, and removing the colon and port variable result in an HTTP 401 response.

The script failed, elapsed time: 0 seconds - Server returned HTTP response code: 401 for URL: https://solr.example.com/solr/admin/metrics?group=solr.jvm
java.io.IOException: Server returned HTTP response code: 401 for URL: https://solr.example.com/solr/admin/metrics?group=solr.jvm

I can add variables to support authentication, but that would be a lot of hand edits :)

If I'm missing something, please let me know!  Thank you for your feedback.

Link to comment
Share on other sites

7 hours ago, Kris Reese said:

Perhaps I'm missing something, but I'm having to make adjustments to the Groovy scripts and test the outcomes of those changes.  For example:

I'm testing with the Apache_Solr_JVM_API data source.  Here's the snippet of that script:

/*******************************************************************************
 * © 2007-2019 - LogicMonitor, Inc. All rights reserved.
 ******************************************************************************/

import groovy.json.JsonSlurper

def host = hostProps.get("system.hostname")
def port = hostProps.get("solr.port") ?: "8983"

def json = new JsonSlurper().parseText("http://${host}:${port}/solr/admin/metrics?group=solr.jvm".toURL().text)

json.metrics.each
    {
        it.value.each
            {
                metric ->

                    if (metric.value.toString().isNumber()) {
                        println metric
                    }
            }
    }

return 0

 

Firstly, we don't allow connections over port 80.  As written, there's no way for me to provide an override.

Secondly, because of point one, I don't need to specify the port.  I could attempt to pass in a blank value, but the json variable would contain a colon which would break.

Thirdly, this particular script does not appear to use the jmx.user and jmx.pass properties.

Making adjustments to the above script by changing http to https, and removing the colon and port variable result in an HTTP 401 response.

The script failed, elapsed time: 0 seconds - Server returned HTTP response code: 401 for URL: https://solr.example.com/solr/admin/metrics?group=solr.jvm
java.io.IOException: Server returned HTTP response code: 401 for URL: https://solr.example.com/solr/admin/metrics?group=solr.jvm

I can add variables to support authentication, but that would be a lot of hand edits :)

If I'm missing something, please let me know!  Thank you for your feedback.

Ah theres 2 kinds of DS's! One uses JMX the other uses API that will be why :( 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share