String[] parts = myname.split(delims);
if( parts.length > 0 ) {
String p1 = parts[0];
if( (jmxtrans_metric_groupID != null) && (p1.equals("jmxtrans")) ) {
QueryResult new_result = new QueryResult(myname, pidHost, myval, epochInMillis);
jmxtrans_counters.add(new_result);
} else if( p1.equals("jvm") ) {
if( parts[1].equals("os")) {
if (parts[2].equals("OpenFileDescriptorCount")) {
QueryResult new_result = new QueryResult(myname, pidHost, myval, epochInMillis);
jvm_os_counters.add(new_result);
} else if (parts[2].equals("CommittedVirtualMemorySize")){
float fval = Float.parseFloat(valstr);
try {
fval = fval/(1024.0f*1024.0f);
} catch (Exception e) {
exceptionCounter.incrementAndGet();
logger.info("Exception doing Float: ", e);
}
QueryResult new_result = new QueryResult(myname, pidHost, fval, epochInMillis);
jvm_os_counters.add(new_result);
} else if (parts[2].equals("ProcessCpuTime")) {
float fval = Float.parseFloat(valstr);
try {
fval = fval/(1000.0f*1000.0f*1000.0f);
} catch (Exception e) {
exceptionCounter.incrementAndGet();
logger.warn("Exception doing Float: ", e);
}
QueryResult new_result = new QueryResult(myname, pidHost, fval, epochInMillis);
jvm_os_counters.add(new_result);
}
} else if( (parts[1].equals("runtime")) && (parts[2].equals("Uptime")) ) {
float fval = Float.parseFloat(valstr);
try {
fval = fval/(1000.0f*60.0f);
} catch (Exception e) {
exceptionCounter.incrementAndGet();
logger.warn("Exception doing Float: ", e);
}
QueryResult new_result = new QueryResult(myname, pidHost, fval, epochInMillis);
jvm_runtime_counters.add(new_result);
} else if( (parts[1].equals("loadedClasses")) && (parts[2].equals("LoadedClassCount")) ) {
// jvm.loadedClasses.LoadedClassCount 5099 1374549969
QueryResult new_result = new QueryResult(myname, pidHost, myval, epochInMillis);
jvm_class_counters.add(new_result);
} else if( (parts[1].equals("thread")) && (parts[2].equals("ThreadCount")) ){
// jvm.thread.ThreadCount 13 1374549940
QueryResult new_result = new QueryResult(myname, pidHost, myval, epochInMillis);
jvm_thread_counters.add(new_result);
} else if( (parts[1].equals("gc")) &&
( (parts[2].equals("Copy")) || (parts[2].equals("MarkSweepCompact")) ) &&
( (parts[3].equals("CollectionCount")) || (parts[3].equals("CollectionTime")) ) ) {
// jvm.gc.Copy.CollectionCount 68 1374549940
QueryResult new_result = new QueryResult(myname, pidHost, myval, epochInMillis);
jvm_gc_counters.add(new_result);
} else if( parts[1].equals("memorypool") ){
if( ( (parts[2].equals("Perm_Gen")) || (parts[2].equals("Code_Cache")) ) &&
( (parts[4].equals("committed")) || (parts[4].equals("used")) ) ) {
myname = "jvmNonHeapMemoryUsage";
String fullID = pidHost + "." + parts[2] + "." + parts[4];
float fval = Float.parseFloat(valstr);
try {
fval = fval/(1024.0f*1024.0f);
} catch (Exception e) {
exceptionCounter.incrementAndGet();
logger.warn("Exception doing Float: ", e);
}
QueryResult new_result = new QueryResult(myname, fullID, fval, epochInMillis);
nonheap_counters.add(new_result);
} else if( ( (parts[2].equals("Eden_Space")) ||
(parts[2].equals("Survivor_Space")) ||
(parts[2].equals("Tenured_Gen"))
) && ( (parts[4].equals("committed")) || (parts[4].equals("used")) ) ) {
myname = "jvmHeapMemoryUsage";
String fullID = pidHost + "." + parts[2] + "." + parts[4];
float fval = Float.parseFloat(valstr);
try {
fval = fval/(1024.0f*1024.0f);
} catch (Exception e) {
exceptionCounter.incrementAndGet();
logger.warn("Exception doingFloat: ", e);
}
QueryResult new_result = new QueryResult(myname, fullID, fval, epochInMillis);
heap_counters.add(new_result);
}
}
} else if( p1.equals("tomcat") ) {
if( (parts[1].equals("thread-pool")) &&
( (parts[3].equals("currentThreadsBusy")) || (parts[3].equals("currentThreadCount")) ) ){
// tomcat.thread_pool.http-bio-8080.currentThreadCount 0 1374549955
String connector = parts[2];
myname = parts[0] + "." + parts[1] + "." + parts[3];
String fullID = pidHost + "." + connector;
QueryResult new_result = new QueryResult(myname, fullID, myval, epochInMillis);
tomcat_thread_pool_counters.add(new_result);
} else if( (parts[1].equals("global-request-processor")) ) {
// tomcat.global-request-processor.http-bio-8080.bytesSent
String connector = parts[2];
myname = parts[0] + "." + parts[1] + "." + parts[3];
String fullID = pidHost + "." + connector;
if( parts[3].equals("processingTime")) {
float fval = Float.parseFloat(valstr);
try {
fval = fval/(1024.0f);
} catch (Exception e) {
exceptionCounter.incrementAndGet();
logger.warn("Exception doingFloat: ", e);
}
QueryResult new_result = new QueryResult(myname, fullID, fval, epochInMillis);
tomcat_grp_counters.add(new_result);
} else {
QueryResult new_result = new QueryResult(myname, fullID, myval, epochInMillis);
tomcat_grp_counters.add(new_result);
}
} else if( (parts[1].equals("manager")) && (parts[4].equals("activeSessions")) ){
// tomcat.manager.localhost._docs.activeSessions 0 1374549955
String myhost = parts[2];
String mycontext = parts[3];
myname = parts[0] + "." + parts[1] + "." + parts[4];
String fullID = pidHost + "." + myhost + "." + mycontext;
QueryResult new_result = new QueryResult(myname, fullID, myval, epochInMillis);
tomcat_manager_counters.add(new_result);
} else if( (parts[1].equals("servlet")) &&
( (parts[4].equals("processingTime")) ||
(parts[4].equals("errorCount")) ||
(parts[4].equals("requestCount")) ) ){
// tomcat.servlet.__localhost_cocktail-app-1_0_9-SNAPSHOT.spring-mvc.processingTime
String myWebmodule = parts[2];
String myServletname = parts[3];
myname = parts[0] + "." + parts[1] + "." + parts[4];
String fullID = pidHost + "." + myWebmodule + "." + myServletname;
QueryResult new_result = new QueryResult(myname, fullID, myval, epochInMillis);
tomcat_servlet_counters.add(new_result);
} else if( (tomcat_db_groupID != null) && (parts[1].equals("data-source")) ) {
String myhost = parts[2];
String mycontext = parts[3];
String mydbname = parts[4];
myname = parts[0] + "." + parts[1] + "." + parts[5];
String fullID = pidHost + "." + myhost + "." + mycontext + "." + mydbname;
QueryResult new_result = new QueryResult(myname, fullID, myval, epochInMillis);
tomcat_db_counters.add(new_result);
}
} else if( (app_groupID != null) && (p1.equals("cocktail")) ) {
if( !(parts[1].equals("CreatedCocktailCount")) && !(parts[1].equals("UpdatedCocktailCount")) ) {
QueryResult new_result = new QueryResult(myname, pidHost, myval, epochInMillis);
app_counters.add(new_result);
}
} else if( ( (app_sales_groupID != null) && (p1.equals("sales")) ) &&
( (parts[1].equals("ordersCounter")) ||
(parts[1].equals("itemsCounter")) ||
(parts[1].equals("revenueInCentsCounter")) ) ){
QueryResult new_result = new QueryResult(myname, pidHost, myval, epochInMillis);
app_sales_counters.add(new_result);
}
} else {
logger.warn("parts return NULL!!!");
}