Forum Discussion
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.jvmI can add variables to support authentication, but that would be a lot of hand edits :)/emoticons/smile@2x.png 2x" title=":)" width="20" />
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
Related Content
- 3 months ago
- 11 months ago