Added additional Oracle views to metric collection (v, v).
This commit is contained in:
@@ -18,7 +18,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
testCompile group: 'junit', name: 'junit', version: '4.11'
|
||||
runtime fileTree(dir: 'lib', include: '*.jar')
|
||||
runtime fileTree(dir: 'libs', include: '*.jar')
|
||||
compile group: 'net.sourceforge.collections', name: 'collections-generic', version: '4.01'
|
||||
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
|
||||
compile group: 'log4j', name: 'log4j', version: '1.2.17'
|
||||
@@ -51,8 +51,8 @@ dependencies {
|
||||
// https://mvnrepository.com/artifact/org.postgresql/postgresql
|
||||
compile group: 'org.postgresql', name: 'postgresql', version: '9.4-1201-jdbc41'
|
||||
|
||||
// This lib has to be manually downloaded from Oracle
|
||||
dependencies {compile files('lib/ojdbc8.jar')}
|
||||
// For Oracle, create the directory client/controller/libs and copy the driver
|
||||
// (e.g., ojdbc8.jar) into it. The driver must be manually downloaded from Oracle.
|
||||
}
|
||||
|
||||
run {
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#Thu Nov 30 15:45:05 EST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
|
||||
File diff suppressed because it is too large
Load Diff
4902
client/controller/sample_output/oracle/knobs_including_hidden.json
Normal file
4902
client/controller/sample_output/oracle/knobs_including_hidden.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,7 @@ import com.controller.util.json.JSONStringer;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Map;
|
||||
@@ -32,6 +33,10 @@ public class OracleCollector extends DBCollector {
|
||||
|
||||
private static final String METRICS_SQL = "select name, value from v$sysstat";
|
||||
|
||||
private static final String METRICS_SQL2 = "select stat_name, value from v$sys_time_model";
|
||||
|
||||
private static final String METRICS_SQL3 = "select * from v$system_event";
|
||||
|
||||
public OracleCollector(String oriDBUrl, String username, String password) {
|
||||
try {
|
||||
Connection conn = DriverManager.getConnection(oriDBUrl, username, password);
|
||||
@@ -43,7 +48,7 @@ public class OracleCollector extends DBCollector {
|
||||
}
|
||||
|
||||
// Collect DBMS parameters
|
||||
out = statement.executeQuery(PARAMETERS_SQL_WITH_HIDDEN);
|
||||
out = statement.executeQuery(PARAMETERS_SQL);
|
||||
while (out.next()) {
|
||||
dbParameters.put(out.getString(1).toLowerCase(), out.getString(2));
|
||||
}
|
||||
@@ -53,6 +58,28 @@ public class OracleCollector extends DBCollector {
|
||||
while (out.next()) {
|
||||
dbMetrics.put(out.getString(1).toLowerCase(), out.getString(2));
|
||||
}
|
||||
|
||||
out = statement.executeQuery(METRICS_SQL2);
|
||||
while (out.next()) {
|
||||
dbMetrics.put(out.getString(1).toLowerCase(), out.getString(2));
|
||||
}
|
||||
|
||||
out = statement.executeQuery(METRICS_SQL3);
|
||||
ResultSetMetaData meta = out.getMetaData();
|
||||
int columnCount = meta.getColumnCount();
|
||||
String[] columnNames = new String[columnCount];
|
||||
for (int i = 0; i < columnCount; ++i) {
|
||||
columnNames[i] = meta.getColumnName(i + 1).toLowerCase();
|
||||
}
|
||||
while (out.next()) {
|
||||
String eventName = out.getString(1).toLowerCase();
|
||||
for (int i = 2; i <= columnCount; ++i) {
|
||||
String name = eventName + "." + columnNames[i - 1];
|
||||
Object value = out.getObject(i);
|
||||
dbMetrics.put(name, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
LOG.error("Error while collecting DB parameters: " + e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user