62,612
社区成员
发帖
与我相关
我的任务
分享
public List<String[]> getTopNCPUSNMP(int n) {
// TODO Auto-generated method stub
String sqlStr = "select monitor.Title,ServerAddress,monitor.MonitorValue from monitor,equipment where monitor.EquipmentId=equipment.RecId and monitor.Title = 'CPU_SNMP' order by MonitorValue desc limit ?";
//System.out.println(sqlStr);
List<String[]> list = jdbcTemplate.query(sqlStr, new Object[]{n}, new RowMapper<String[]>(){
public String[] mapRow(ResultSet rs, int index)throws SQLException{
String i = rs.getString(3);
String Average = i.substring(i.indexOf("=")+1,i.indexOf(","));
//System.out.println("+++++++++++++++++"+rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));
String [] str = {rs.getString(1),rs.getString(2),Average};
return str;
}
});
return list;
}