安装jmxtrans:
wget https://github.com/downloads/jmxtrans/jmxtrans/jmxtrans-20121016.145842.6a28c97fbb-0.noarch.rpm
rpm -ivh jmxtrans-20121016.145842.6a28c97fbb-0.noarch.rpm
添加配置:
vim /var/lib/jmxtrans/solr.json
{
"servers" : [
{
"host" : "192.168.36.84",
"alias" : "solr23",
"port" : "3000",
"queries" : [
{
"obj" : "java.lang:type=Memory",
"resultAlias": "solr23.heap",
"attr" : [ "HeapMemoryUsage", "NonHeapMemoryUsage" ],
"outputWriters" : [
{
"@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
"settings" : {
"groupName" : "Solr-JVM",
"host" : "239.2.11.71",
"port" : "8649"
}
}]
},
{
"obj" : "java.lang:name=CMS Old Gen,type=MemoryPool",
"resultAlias": "solr23.cmsoldgen",
"attr" : [ "Usage" ],
"outputWriters" : [
{
"@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
"settings" : {
"groupName" : "Solr-JVM",
"host" : "239.2.11.71",
"port" : "8649"
}
}]
},
{
"obj" : "java.lang:type=GarbageCollector,name=*",
"resultAlias": "solr23.gc",
"attr" : [ "CollectionCount", "CollectionTime" ],
"outputWriters" : [
{
"@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
"settings" : {
"groupName" : "Solr-JVM",
"host" : "239.2.11.71",
"port" : "8649"
}
}]
},
{
"obj" : "java.lang:type=Threading",
"resultAlias": "solr23.threads",
"attr" : [ "DaemonThreadCount", "PeakThreadCount", "ThreadCount", "TotalStartedThreadCount" ],
"outputWriters" : [
{
"@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
"settings" : {
"groupName" : "Solr-JVM",
"host" : "239.2.11.71",
"port" : "8649"
}
}]
},
{
"obj" : "solr/techproducts:type=queryResultCache,id=org.apache.solr.search.LRUCache",
"resultAlias": "solr23.queryCache",
"attr" : [ "warmupTime","size","lookups","evictions","hits","hitratio","inserts","cumulative_lookups","cumulative_hits","cumulative_hits","cumulative_hitratio","cumulative_inserts","cumulative_evictions" ],
"outputWriters" : [
{
"@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
"settings" : {
"groupName" : "Solr-JVM",
"host" : "239.2.11.71",
"port" : "8649"
}
}]
},
{
"obj" : "solr/techproducts:type=searcher,id=org.apache.solr.search.SolrIndexSearcher",
"resultAlias": "solr23.searcher",
"attr" : [ "maxDoc","numDocs","warmupTime" ],
"outputWriters" : [
{
"@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
"settings" : {
"groupName" : "Solr-JVM",
"host" : "239.2.11.71",
"port" : "8649"
}
}]
}]
}]
}
启动solr
bin/solr start -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.36.84
启动jmx
service jmxtrans start
启动gmond