log.debug("skip:"+lines[i]);
i++;
}
while (i < lines.length)
{
DatabaseHelper databaseRecord = null;
if(lines[i].equals("")) {
i++;
headers = parseHeader(lines[i]);
i++;
}
String data[] = parseData(lines[i]);
if(headers[1].equals("IFACE") && headers[2].equals("rxpck/s")) {
log.debug("Matched Sar-Network");
databaseRecord = new DatabaseHelper("system");
} else if(headers[1].equals("IFACE") && headers[2].equals("rxerr/s")) {
log.debug("Matched Sar-Network");
databaseRecord = new DatabaseHelper("system");
} else if(headers[1].equals("kbmemfree")) {
log.debug("Matched Sar-Memory");
databaseRecord = new DatabaseHelper("system");
} else if(headers[1].equals("totsck")) {
log.debug("Matched Sar-NetworkSockets");
databaseRecord = new DatabaseHelper("system");
} else if(headers[1].equals("runq-sz")) {
log.debug("Matched Sar-LoadAverage");
databaseRecord = new DatabaseHelper("system");
} else {
log.debug("No match:"+headers[1]+" "+headers[2]);
}
if(databaseRecord!=null) {
int j=0;
log.debug("Data Length: " + data.length);
while(j<data.length) {
log.debug("header:"+headers[j]+" data:"+data[j]);
if(!headers[j].equals("Average:")) {
databaseRecord.add(d.getTime(),headers[j],data[j]);
}
j++;
}
//Output Sar info to database
output.collect(key, databaseRecord.buildChukwaRecord());
}
i++;
}
// End of parsing
} catch (Exception e)