Search in sources :

Example 21 with ResultList

use of com.yahoo.dba.perf.myperf.common.ResultList in project mysql_perf_analyzer by yahoo.

the class SNMPQueryProcessor method querySystemData.

private ResultList querySystemData(SNMPClient client, QueryParameters qps) throws Exception {
    boolean diff = "1".equalsIgnoreCase(qps.getSqlParams().get("p_2"));
    List<SNMPTriple> snmpData = client.querySysData3();
    if (snmpData == null)
        return null;
    ColumnDescriptor desc = new ColumnDescriptor();
    desc.addColumn("NAME", false, 0);
    desc.addColumn("OID", false, 1);
    desc.addColumn("VALUE", false, 2);
    ResultList rList = new ResultList();
    rList.setColumnDescriptor(desc);
    for (SNMPTriple t : snmpData) {
        if (diff) {
            try {
                BigDecimal bd = new BigDecimal(t.value);
            } catch (Exception ex) {
                continue;
            }
        }
        ResultRow row = new ResultRow();
        row.addColumn(t.name);
        row.addColumn(t.oid);
        row.addColumn(t.value);
        row.setColumnDescriptor(desc);
        rList.addRow(row);
    }
    return rList;
}
Also used : ResultRow(com.yahoo.dba.perf.myperf.common.ResultRow) ResultList(com.yahoo.dba.perf.myperf.common.ResultList) ColumnDescriptor(com.yahoo.dba.perf.myperf.common.ColumnDescriptor) SNMPTriple(com.yahoo.dba.perf.myperf.snmp.SNMPClient.SNMPTriple) BigDecimal(java.math.BigDecimal) SQLException(java.sql.SQLException)

Example 22 with ResultList

use of com.yahoo.dba.perf.myperf.common.ResultList in project mysql_perf_analyzer by yahoo.

the class SNMPQueryProcessor method queryDisk.

/**
	 * Query disk data, in (name, oid, value). Note name will be prefixed with disk name.
	 * @param qps
	 * @return
	 * @throws Exception
	 */
private ResultList queryDisk(SNMPClient client, QueryParameters qps) throws Exception {
    boolean diff = "1".equalsIgnoreCase(qps.getSqlParams().get("p_2"));
    Map<String, List<SNMPTriple>> snmpData = client.getMultiDiskData();
    if (snmpData == null)
        return null;
    ColumnDescriptor desc = new ColumnDescriptor();
    desc.addColumn("NAME", false, 0);
    desc.addColumn("OID", false, 1);
    desc.addColumn("VALUE", false, 2);
    ResultList rList = new ResultList();
    rList.setColumnDescriptor(desc);
    for (Map.Entry<String, List<SNMPTriple>> e : snmpData.entrySet()) {
        String disk = e.getKey();
        for (SNMPTriple t : e.getValue()) {
            if (diff) {
                try {
                    BigDecimal bd = new BigDecimal(t.value);
                } catch (Exception ex) {
                    continue;
                }
            }
            ResultRow row = new ResultRow();
            row.addColumn(disk + "." + t.name);
            row.addColumn(t.oid);
            row.addColumn(t.value);
            row.setColumnDescriptor(desc);
            rList.addRow(row);
        }
    }
    return rList;
}
Also used : ResultRow(com.yahoo.dba.perf.myperf.common.ResultRow) ResultList(com.yahoo.dba.perf.myperf.common.ResultList) ColumnDescriptor(com.yahoo.dba.perf.myperf.common.ColumnDescriptor) SNMPTriple(com.yahoo.dba.perf.myperf.snmp.SNMPClient.SNMPTriple) List(java.util.List) ResultList(com.yahoo.dba.perf.myperf.common.ResultList) Map(java.util.Map) BigDecimal(java.math.BigDecimal) SQLException(java.sql.SQLException)

Example 23 with ResultList

use of com.yahoo.dba.perf.myperf.common.ResultList in project mysql_perf_analyzer by yahoo.

the class SNMPQueryProcessor method queryTableSNMP.

private ResultList queryTableSNMP(SNMPClient client, QueryParameters qps) throws Exception {
    //p2 will be oid
    String oid = qps.getSqlParams().get("p_2");
    List<SNMPTriple> snmpData = client.querySingleSNMPTableByOID(oid);
    if (snmpData == null)
        return null;
    ColumnDescriptor desc = new ColumnDescriptor();
    desc.addColumn("NAME", false, 0);
    desc.addColumn("OID", false, 1);
    desc.addColumn("VALUE", false, 2);
    ResultList rList = new ResultList();
    rList.setColumnDescriptor(desc);
    for (SNMPTriple t : snmpData) {
        ResultRow row = new ResultRow();
        row.addColumn(t.name);
        row.addColumn(t.oid);
        row.addColumn(t.value);
        row.setColumnDescriptor(desc);
        rList.addRow(row);
    }
    return rList;
}
Also used : ResultRow(com.yahoo.dba.perf.myperf.common.ResultRow) ResultList(com.yahoo.dba.perf.myperf.common.ResultList) ColumnDescriptor(com.yahoo.dba.perf.myperf.common.ColumnDescriptor) SNMPTriple(com.yahoo.dba.perf.myperf.snmp.SNMPClient.SNMPTriple)

Example 24 with ResultList

use of com.yahoo.dba.perf.myperf.common.ResultList in project mysql_perf_analyzer by yahoo.

the class SNMPQueryProcessor method queryMysqldData.

private ResultList queryMysqldData(SNMPClient client, QueryParameters qps) throws Exception {
    boolean diff = "1".equalsIgnoreCase(qps.getSqlParams().get("p_2"));
    List<SNMPTriple> snmpData = null;
    try {
        snmpData = client.getProcessData("mysqld");
    } catch (Exception ex) {
        logger.log(Level.SEVERE, "Failed to retrieve mysqld perf data", ex);
    }
    if (snmpData == null)
        return null;
    ColumnDescriptor desc = new ColumnDescriptor();
    desc.addColumn("NAME", false, 0);
    desc.addColumn("OID", false, 1);
    desc.addColumn("VALUE", false, 2);
    ResultList rList = new ResultList();
    rList.setColumnDescriptor(desc);
    for (SNMPTriple t : snmpData) {
        if (diff) {
            try {
                BigDecimal bd = new BigDecimal(t.value);
            } catch (Exception ex) {
                continue;
            }
        }
        ResultRow row = new ResultRow();
        row.addColumn(t.name);
        row.addColumn(t.oid);
        row.addColumn(t.value);
        row.setColumnDescriptor(desc);
        rList.addRow(row);
    }
    return rList;
}
Also used : ResultRow(com.yahoo.dba.perf.myperf.common.ResultRow) ResultList(com.yahoo.dba.perf.myperf.common.ResultList) ColumnDescriptor(com.yahoo.dba.perf.myperf.common.ColumnDescriptor) SNMPTriple(com.yahoo.dba.perf.myperf.snmp.SNMPClient.SNMPTriple) SQLException(java.sql.SQLException) BigDecimal(java.math.BigDecimal)

Example 25 with ResultList

use of com.yahoo.dba.perf.myperf.common.ResultList in project mysql_perf_analyzer by yahoo.

the class SNMPQueryProcessor method querySingleSNMP.

private ResultList querySingleSNMP(SNMPClient client, QueryParameters qps) throws Exception {
    //p2 will be oid
    String oid = qps.getSqlParams().get("p_2");
    List<SNMPTriple> snmpData = client.querySingleSNMPEntryByOID(oid);
    if (snmpData == null)
        return null;
    ColumnDescriptor desc = new ColumnDescriptor();
    desc.addColumn("NAME", false, 0);
    desc.addColumn("OID", false, 1);
    desc.addColumn("VALUE", false, 2);
    ResultList rList = new ResultList();
    rList.setColumnDescriptor(desc);
    for (SNMPTriple t : snmpData) {
        ResultRow row = new ResultRow();
        row.addColumn(t.name);
        row.addColumn(t.oid);
        row.addColumn(t.value);
        row.setColumnDescriptor(desc);
        rList.addRow(row);
    }
    return rList;
}
Also used : ResultRow(com.yahoo.dba.perf.myperf.common.ResultRow) ResultList(com.yahoo.dba.perf.myperf.common.ResultList) ColumnDescriptor(com.yahoo.dba.perf.myperf.common.ColumnDescriptor) SNMPTriple(com.yahoo.dba.perf.myperf.snmp.SNMPClient.SNMPTriple)

Aggregations

ResultList (com.yahoo.dba.perf.myperf.common.ResultList)31 ResultRow (com.yahoo.dba.perf.myperf.common.ResultRow)22 ColumnDescriptor (com.yahoo.dba.perf.myperf.common.ColumnDescriptor)21 SQLException (java.sql.SQLException)17 ArrayList (java.util.ArrayList)10 Map (java.util.Map)9 ResultSet (java.sql.ResultSet)8 SNMPTriple (com.yahoo.dba.perf.myperf.snmp.SNMPClient.SNMPTriple)7 Connection (java.sql.Connection)7 ModelAndView (org.springframework.web.servlet.ModelAndView)7 DBInstanceInfo (com.yahoo.dba.perf.myperf.common.DBInstanceInfo)6 QueryParameters (com.yahoo.dba.perf.myperf.common.QueryParameters)6 PreparedStatement (java.sql.PreparedStatement)6 BigDecimal (java.math.BigDecimal)5 List (java.util.List)5 HashMap (java.util.HashMap)4 Statement (java.sql.Statement)3 HashSet (java.util.HashSet)3 LinkedHashMap (java.util.LinkedHashMap)3 ColumnInfo (com.yahoo.dba.perf.myperf.common.ColumnInfo)2