Forum Discussion
- Anonymous
At one point i had a datasource called RabbitMQ Queue_connections and one called RabbitMQ_cluster_status_connection. Not sure if that's what you're looking for. Here are the scripts for those endpoints. Maybe they can help you if you find the right endpoints for queues and topics.
The collection script:
import com.santaba.agent.groovyapi.http.* import groovy.json.* def hostName = hostProps.get("system.hostname") def rabbitPort = hostProps.get("rabbitmq.port") def rabbitUser = hostProps.get("rabbitmq.user") def rabbitPass = hostProps.get("rabbitmq.pass") def rabbitAddr = hostProps.get("rabbitmq.apiurl") def urlList = ["${rabbitAddr}", "https://${hostName}:${rabbitPort}", "http://${hostName}:${rabbitPort}"] def getResult(urlList, apiPath, rabbitUser, rabbitPass, rabbitPort){ def response = null urlList.each{url-> if(url != "null" && !response){ try{ def conn = new URL(url + apiPath).openConnection() conn.setReadTimeout(1500) def authString = "${rabbitUser}:${rabbitPass}".getBytes().encodeBase64().toString() conn.setRequestProperty("Authorization", "Basic ${authString}") response = conn.getInputStream().getText() } catch(Exception ex){ // println "Exception: " + ex.message // URL Invalid! } } } return response } def response = getResult(urlList, "/api/connections", rabbitUser, rabbitPass, rabbitPort) if(!response){return 1} def slurper = new JsonSlurper() def json = slurper.parseText(response) json.each{ def connection = "${it.name.replaceAll(" ","").replaceAll(":","-")}" println("${connection}.channels: ${it.channels}") println("${connection}.state: ${(it.state=="running") ? 1 : 0}") println("${connection}.send_pend: ${it.send_pend}") println("${connection}.send_cnt: ${it.send_cnt}") } return 0;
discovery script:
import com.santaba.agent.groovyapi.http.* import groovy.json.* def hostName = hostProps.get("system.hostname") def rabbitPort = hostProps.get("rabbitmq.port") def rabbitUser = hostProps.get("rabbitmq.user") def rabbitPass = hostProps.get("rabbitmq.pass") def rabbitAddr = hostProps.get("rabbitmq.apiurl") def urlList = ["${rabbitAddr}", "https://${hostName}:${rabbitPort}", "http://${hostName}:${rabbitPort}"] def getResult(urlList, apiPath, rabbitUser, rabbitPass, rabbitPort){ def response = null urlList.each{url-> if(url != "null" && !response){ try{ def conn = new URL(url + apiPath).openConnection() conn.setReadTimeout(1500) def authString = "${rabbitUser}:${rabbitPass}".getBytes().encodeBase64().toString() conn.setRequestProperty("Authorization", "Basic ${authString}") response = conn.getInputStream().getText() } catch(Exception ex){ // println "Exception: " + ex.message // URL Invalid! } } } return response } def response = getResult(urlList, "/api/connections", rabbitUser, rabbitPass, rabbitPort) if(!response){return 1} def slurper = new JsonSlurper() def json = slurper.parseText(response) json.each{ println("${it.name.replaceAll(" ","").replaceAll(":","-")}##${it.name.replaceAll(" ","")}######node=${it.node}&protocol=${it.protocol}&type=${it.type}") } return 0
Unfortunately, Its IBM MQ or Webphere MQ without using WIM.
Related Content
- 2 years ago
- 5 months ago
- 2 years ago