From f4931f69ae96720eca04db6744117202d6732e52 Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Mon, 10 Jun 2024 13:06:59 +0530 Subject: [PATCH 01/13] Informix Release 4 metrics --- .../sensorsdk/semconv/SemanticAttributes.java | 5 ++++- .../main/java/com/instana/dc/rdb/DbDcUtil.java | 14 ++++++++++++++ .../com/instana/dc/rdb/DbRawMetricRegistry.java | 5 +++++ .../instana/dc/rdb/impl/informix/InformixDc.java | 15 +++++++++++++++ .../dc/rdb/impl/informix/InformixUtil.java | 7 ++++++- 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/rdb/src/main/java/com/instana/agent/sensorsdk/semconv/SemanticAttributes.java b/rdb/src/main/java/com/instana/agent/sensorsdk/semconv/SemanticAttributes.java index 54588a4..3875088 100644 --- a/rdb/src/main/java/com/instana/agent/sensorsdk/semconv/SemanticAttributes.java +++ b/rdb/src/main/java/com/instana/agent/sensorsdk/semconv/SemanticAttributes.java @@ -76,5 +76,8 @@ private SemanticAttributes() { public static final AttributeKey DB_SEQ_SCAN_COUNT = AttributeKey.stringKey("db.seq.scan.count"); public static final AttributeKey DB_SEQ_SCAN_TABLE_COUNT = AttributeKey.longKey("db.seq.scan.table.count"); public static final AttributeKey TABLE_NAME = AttributeKey.stringKey("table_name"); - + public static final AttributeKey DB_LOCK_WAITS = AttributeKey.longKey("db.lock.waits"); + public static final AttributeKey DB_CACHE_READ_RATIO = AttributeKey.longKey("db.cache.read.ratio"); + public static final AttributeKey DB_CACHE_WRITE_RATIO = AttributeKey.longKey("db.cache.write.ratio"); + public static final AttributeKey DB_LRU_WRITES = AttributeKey.longKey("db.lru.writes"); } diff --git a/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java b/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java index 8acc982..75b0fc5 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java @@ -209,7 +209,21 @@ private DbDcUtil() { public static final String DB_SEQ_SCAN_TABLE_DESC = "Number of tables which is having sequential scan."; public static final String DB_SEQ_SCAN_TABLE_UNIT = "{tableScan}"; + public static final String DB_LOCK_WAITS_NAME = DB_LOCK_WAITS.getKey(); + public static final String DB_LOCK_WAITS_DESC = "Number of threads waiting for lock."; + public static final String DB_LOCK_WAITS_UNIT = "{lockWaits}"; + public static final String DB_CACHE_READ_RATIO_NAME = DB_CACHE_READ_RATIO.getKey(); + public static final String DB_CACHE_READ_RATIO_DESC = "Percentage of page reads for this buffer pool that were satisfied by a cached page image"; + public static final String DB_CACHE_READ_RATIO_UNIT = "1"; + + public static final String DB_CACHE_WRITE_RATIO_NAME = DB_CACHE_WRITE_RATIO.getKey(); + public static final String DB_CACHE_WRITE_RATIO_DESC = "Percentage of page Writes for this buffer pool that were satisfied by a cached page image"; + public static final String DB_CACHE_WRITE_RATIO_UNIT = "1"; + + public static final String DB_LRU_WRITES_NAME = DB_LRU_WRITES.getKey(); + public static final String DB_LRU_WRITES_DESC = " Number of Least Recently Used Writes."; + public static final String DB_LRU_WRITES_UNIT = "lruWrites"; /* Utilities: **/ diff --git a/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java b/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java index e17ecb3..ceed2ba 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java @@ -61,6 +61,11 @@ public class DbRawMetricRegistry { put(DB_USER_OVERFLOW_NAME, new RawMetric(UPDOWN_COUNTER, DB_USER_OVERFLOW_NAME, DB_USER_OVERFLOW_DESC, DB_USER_OVERFLOW_UNIT, true, null)); put(DB_SEQ_SCAN_NAME, new RawMetric(UPDOWN_COUNTER, DB_SEQ_SCAN_NAME, DB_SEQ_SCAN_DESC, UNIT_BY, true, DB_SEQ_SCAN_KEY)); put(DB_SEQ_SCAN_TABLE_NAME, new RawMetric(GAUGE, DB_SEQ_SCAN_TABLE_NAME, DB_SEQ_SCAN_TABLE_DESC, DB_SEQ_SCAN_TABLE_UNIT, true, null)); + + put(DB_LOCK_WAITS_NAME, new RawMetric(UPDOWN_COUNTER, DB_LOCK_WAITS_NAME, DB_LOCK_WAITS_DESC, DB_LOCK_WAITS_UNIT, true, null)); + put(DB_CACHE_READ_RATIO_NAME, new RawMetric(GAUGE, DB_CACHE_READ_RATIO_NAME, DB_CACHE_READ_RATIO_DESC, DB_CACHE_READ_RATIO_UNIT, true, null)); + put(DB_CACHE_WRITE_RATIO_NAME, new RawMetric(GAUGE, DB_CACHE_WRITE_RATIO_NAME, DB_CACHE_WRITE_RATIO_DESC, DB_CACHE_WRITE_RATIO_UNIT, true, null)); + put(DB_LRU_WRITES_NAME, new RawMetric(UPDOWN_COUNTER, DB_LRU_WRITES_NAME, DB_LRU_WRITES_DESC, DB_LRU_WRITES_UNIT, true, null)); }}; public Map getMap() { diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java index ec7ab0f..21557f9 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java @@ -130,6 +130,16 @@ private void registerMetricsMetadata() { MetricsDataConfigRegister.subscribeMetricDataConfig(DB_SEQ_SCAN_TABLE_NAME, new MetricDataConfig(sequentialScanTableQuery, MetricCollectionMode.SQL, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_WAITS_NAME, + new MetricDataConfig(InformixUtil.DB_LOCK_WAITS_SQL, MetricCollectionMode.SQL, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_READ_RATIO_NAME, + new MetricDataConfig(InformixUtil.DB_CACHE_READ_RATIO_SQL, MetricCollectionMode.SQL, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_WRITE_RATIO_NAME, + new MetricDataConfig(InformixUtil.DB_CACHE_WRITE_RATIO_SQL, MetricCollectionMode.SQL, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LRU_WRITES_NAME, + new MetricDataConfig(InformixUtil.DB_LRU_WRITES_SQL, MetricCollectionMode.SQL, Number.class)); + + //Metrics via onstat command MetricsDataConfigRegister.subscribeMetricDataConfig(DB_SQL_COUNT_NAME, new MetricDataConfig(DB_SQL_COUNT_NAME, SQL_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); @@ -300,6 +310,11 @@ private void shortPollingInterval() { getRawMetric(DB_DISK_WRITE_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_DISK_WRITE_COUNT_NAME)); getRawMetric(DB_DISK_READ_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_DISK_READ_COUNT_NAME)); + + getRawMetric(DB_LOCK_WAITS_NAME).setValue((Number) metricCollector.collectMetrics(DB_LOCK_WAITS_NAME)); + getRawMetric(DB_CACHE_READ_RATIO_NAME).setValue((Number) metricCollector.collectMetrics(DB_CACHE_READ_RATIO_NAME)); + getRawMetric(DB_CACHE_WRITE_RATIO_NAME).setValue((Number) metricCollector.collectMetrics(DB_CACHE_WRITE_RATIO_NAME)); + getRawMetric(DB_LRU_WRITES_NAME).setValue((Number) metricCollector.collectMetrics(DB_LRU_WRITES_NAME)); } @SuppressWarnings("unchecked") diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java index 6b9247a..eeb1148 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java @@ -48,13 +48,18 @@ private InformixUtil() { public static final String LOCK_OVF_SQL = "select coalesce(cast(value as int)) as value from sysprofile where name = 'ovlock'"; public static final String TRANSACTION_OVF_SQL = "select coalesce(cast(value as int)) as value from sysprofile where name = 'ovtrans'"; public static final String USER_OVF_SQL = "select coalesce(cast(value as int)) as value from sysprofile where name = 'ovuser'"; - public static final String DB_SEQ_SCAN_SQL = "select coalesce(cast(seqscans as int))DATABASE_LOCK_TABLE_OVERFLOW,tabname as table_name from sysmaster:sysptprof where dbsname = %s and seqscans >= %d and tabname not like 'sys%%'"; + public static final String DB_SEQ_SCAN_SQL = "select coalesce(cast(seqscans as int))seqscan,tabname as table_name from sysmaster:sysptprof where dbsname = %s and seqscans >= %d and tabname not like 'sys%%'"; public static final String DB_SEQ_SCAN_TABLE_SQL = "SELECT count(tabname) as number_of_tables_having_sequential_scans FROM SYSPTPROF WHERE dbsname = %s and seqscans >= %d and tabname not like 'sys%%';"; //Disk Read & Write public static final String DB_DISK_WRITE_COUNT_SQL = "SELECT VALUE FROM SYSPROFILE WHERE NAME = 'dskwrites';"; public static final String DB_DISK_READ_COUNT_SQL = "SELECT VALUE FROM SYSPROFILE WHERE NAME = 'dskreads';"; + public static final String DB_LOCK_WAITS_SQL = "select value from sysprofile where name = 'lockwts'"; + public static final String DB_CACHE_READ_RATIO_SQL = "select (1-(sp0.value/sp1.value))*100 as res from sysprofile sp0 left join sysprofile sp1 on sp1.name = 'bufreads' where sp0.name= 'dskreads'"; + public static final String DB_CACHE_WRITE_RATIO_SQL = "select (1-(sp0.value/sp1.value))*100 as res from sysprofile sp0 left join sysprofile sp1 on sp1.name = 'bufwrites' where sp0.name= 'dskwrites'"; + public static final String DB_LRU_WRITES_SQL = "select value from sysprofile where name = 'lruwrites'"; + public static String decodePassword(String encodedPwd) { return new String(Base64.getDecoder().decode(encodedPwd)); } From 1ab42af17f5f4c4f7c6743b0e64b26f5246914e9 Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Tue, 11 Jun 2024 16:21:30 +0530 Subject: [PATCH 02/13] Informix DB Release 4 metrics --- .../java/com/instana/dc/rdb/impl/informix/InformixUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java index eeb1148..54667db 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java @@ -33,8 +33,8 @@ private InformixUtil() { public static final String TRANSACTION_COUNT_SQL = "SELECT COUNT(1) FROM SYSTRANS;"; public static final String SQL_ELAPSED_TIME_SQL = "SELECT SQL_RUNTIME * 1000 AS ELAPSED_TIME_MILLIS, SQL_ID AS SQL_ID, SQL_STATEMENT AS SQL_TEXT FROM INFORMIX.SYSSQLTRACE WHERE SQL_FINISHTIME >= (DBINFO('UTC_CURRENT') - %s) AND SQL_DATABASE = %s ORDER BY ELAPSED_TIME_MILLIS DESC LIMIT 20;"; //Table Space Queries - public static final String TABLESPACE_SIZE_SQL = "SELECT (PT.NPTOTAL * PT.PAGESIZE) * 1024 AS TOTAL_KB,TABNAME FROM SYSMASTER:SYSPTNHDR PT INNER JOIN SYSMASTER:SYSTABNAMES TN ON TN.PARTNUM = PT.PARTNUM WHERE TN.DBSNAME = %S ORDER BY TABNAME DESC LIMIT 20;"; - public static final String TABLESPACE_USED_SQL = "SELECT (PT.NPUSED * PT.PAGESIZE) * 1024 AS USED_KB,TABNAME FROM SYSMASTER:SYSPTNHDR PT INNER JOIN SYSMASTER:SYSTABNAMES TN ON TN.PARTNUM = PT.PARTNUM WHERE TN.DBSNAME = %S ORDER BY TABNAME DESC LIMIT 20;"; + public static final String TABLESPACE_SIZE_SQL = "SELECT (PT.NPTOTAL * PT.PAGESIZE) * 1024 AS TOTAL_KB, TABNAME FROM SYSMASTER:SYSPTNHDR PT INNER JOIN SYSMASTER:SYSTABNAMES TN ON TN.PARTNUM = PT.PARTNUM WHERE TN.DBSNAME = %s ORDER BY TABNAME DESC LIMIT 20;"; + public static final String TABLESPACE_USED_SQL = "SELECT (PT.NPUSED * PT.PAGESIZE) * 1024 AS USED_KB, TABNAME FROM SYSMASTER:SYSPTNHDR PT INNER JOIN SYSMASTER:SYSTABNAMES TN ON TN.PARTNUM = PT.PARTNUM WHERE TN.DBSNAME = %s ORDER BY TABNAME DESC LIMIT 20;"; public static final String TABLESPACE_UTILIZATION_SQL = "SELECT CASE WHEN (PT.NPTOTAL > 0) THEN ((PT.NPUSED) / PT.NPTOTAL) * 100 ELSE 0 END AS TABLE_UTILIZATION, TABNAME FROM SYSMASTER:SYSPTNHDR PT INNER JOIN SYSMASTER:SYSTABNAMES TN ON TN.PARTNUM = PT.PARTNUM WHERE TN.DBSNAME = %s ORDER BY TABNAME DESC LIMIT 20;"; public static final String TABLESPACE_MAX_SQL = "SELECT (PT.NPTOTAL * PT.PAGESIZE) * 1024 AS TOTAL_KB, TABNAME FROM SYSMASTER:SYSPTNHDR PT INNER JOIN SYSMASTER:SYSTABNAMES TN ON TN.PARTNUM = PT.PARTNUM WHERE TN.DBSNAME = %s ORDER BY TABNAME DESC LIMIT 20;"; //Database Queries From 384a3c96cd67ac1d86acf6f2ad152a4a922e3b6f Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 12 Jun 2024 15:37:39 +0530 Subject: [PATCH 03/13] Informix DB release 4 metrics Scripts --- rdb/scripts/informix/active_session_count.sh | 6 +- rdb/scripts/informix/disk_read.sh | 7 ++- rdb/scripts/informix/disk_write.sh | 4 +- rdb/scripts/informix/lock_count.sh | 6 +- rdb/scripts/informix/session_count.sh | 2 +- rdb/scripts/informix/sql_count.sh | 2 +- rdb/scripts/informix/transaction_count.sh | 4 +- .../com/instana/dc/rdb/DataCollector.java | 2 +- .../instana/dc/rdb/DbRawMetricRegistry.java | 4 +- .../com/instana/dc/rdb/impl/Constants.java | 8 +++ .../dc/rdb/impl/informix/InformixDc.java | 56 ++++++++++++++----- 11 files changed, 69 insertions(+), 32 deletions(-) diff --git a/rdb/scripts/informix/active_session_count.sh b/rdb/scripts/informix/active_session_count.sh index 6327aa8..b7b7986 100644 --- a/rdb/scripts/informix/active_session_count.sh +++ b/rdb/scripts/informix/active_session_count.sh @@ -1,13 +1,13 @@ -#!/bin/bash +# !/bin/bash # (c) Copyright IBM Corp. 2024 # (c) Copyright Instana Inc. result=$(cd $1 && export INFORMIXDIR=$2 && export ONCONFIG=$3 && - export INFO RMIXSERVER=$4 && + export INFORMIXSERVER=$4 && export PATH=$INFORMIXDIR/bin:$PATH && export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && - ./onstat -g ses active | awk 'BEGIN {RS=""; FS="\n"} NR==2 {linecount = NF -2; if (linecount>0) print linecount; else print 0}') + ./onstat -g ses active | awk 'NR==2 {linecount = NF -2; if (linecount>0) print linecount; else print 0}') echo $result \ No newline at end of file diff --git a/rdb/scripts/informix/disk_read.sh b/rdb/scripts/informix/disk_read.sh index 107a69f..e8de7b2 100644 --- a/rdb/scripts/informix/disk_read.sh +++ b/rdb/scripts/informix/disk_read.sh @@ -1,13 +1,16 @@ -!/bin/bash +# !/bin/bash # (c) Copyright IBM Corp. 2024 # (c) Copyright Instana Inc. result=$(cd $1 && export INFORMIXDIR=$2 && export ONCONFIG=$3 && - export INFO RMIXSERVER=$4 && + export INFORMIXSERVER=$4 && export PATH=$INFORMIXDIR/bin:$PATH && export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && ./onstat -p | awk 'NR==7 {print $1}') + + # For solaris 10 ./onstat -p | awk 'NR==6 {print $1}' + echo $result \ No newline at end of file diff --git a/rdb/scripts/informix/disk_write.sh b/rdb/scripts/informix/disk_write.sh index 87b9599..a2c6222 100644 --- a/rdb/scripts/informix/disk_write.sh +++ b/rdb/scripts/informix/disk_write.sh @@ -1,11 +1,11 @@ -!/bin/bash +# !/bin/bash # (c) Copyright IBM Corp. 2024 # (c) Copyright Instana Inc. result=$(cd $1 && export INFORMIXDIR=$2 && export ONCONFIG=$3 && - export INFO RMIXSERVER=$4 && + export INFORMIXSERVER=$4 && export PATH=$INFORMIXDIR/bin:$PATH && export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && ./onstat -p | awk 'NR==7 {print $5}') diff --git a/rdb/scripts/informix/lock_count.sh b/rdb/scripts/informix/lock_count.sh index 687a201..f740873 100644 --- a/rdb/scripts/informix/lock_count.sh +++ b/rdb/scripts/informix/lock_count.sh @@ -1,13 +1,13 @@ -#!/bin/bash +# !/bin/bash # (c) Copyright IBM Corp. 2024 # (c) Copyright Instana Inc. result=$(cd $1 && export INFORMIXDIR=$2 && export ONCONFIG=$3 && - export INFO RMIXSERVER=$4 && + export INFORMIXSERVER=$4 && export PATH=$INFORMIXDIR/bin:$PATH && export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && - ./onstat -k | head -n 14| tail -n 1|awk '{print $1}') + ./onstat -k | awk '{a[NR]=$0} END{print a[NR-1]}' |awk '{print $1}') echo $result diff --git a/rdb/scripts/informix/session_count.sh b/rdb/scripts/informix/session_count.sh index ee196e8..3e4f587 100644 --- a/rdb/scripts/informix/session_count.sh +++ b/rdb/scripts/informix/session_count.sh @@ -8,6 +8,6 @@ result=$(cd $1 && export INFO RMIXSERVER=$4 && export PATH=$INFORMIXDIR/bin:$PATH && export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && - ./onstat -g ses | awk 'BEGIN {RS=""; FS="\n"} NR==2 {linecount = NF -2; if (linecount>0) print linecount; else print 0}') + ./onstat -g ses | awk 'NR==2 {linecount = NF -2; if (linecount>0) print linecount; else print 0}') echo $result diff --git a/rdb/scripts/informix/sql_count.sh b/rdb/scripts/informix/sql_count.sh index f6f1e21..6b41796 100644 --- a/rdb/scripts/informix/sql_count.sh +++ b/rdb/scripts/informix/sql_count.sh @@ -8,6 +8,6 @@ result=$(cd $1 && export INFO RMIXSERVER=$4 && export PATH=$INFORMIXDIR/bin:$PATH && export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && - ./onstat -g his 1 | head -n 10 | tail -n 1 | awk '{print $4}') + ./onstat -g his 1 | head -n 11 | awk '{a[NR]=$0} END{print a[NR-1]}' | awk '{print $4}') echo $result diff --git a/rdb/scripts/informix/transaction_count.sh b/rdb/scripts/informix/transaction_count.sh index 45c1a37..faa43b7 100644 --- a/rdb/scripts/informix/transaction_count.sh +++ b/rdb/scripts/informix/transaction_count.sh @@ -5,9 +5,9 @@ result=$(cd $1 && export INFORMIXDIR=$2 && export ONCONFIG=$3 && - export INFO RMIXSERVER=$4 && + export INFORMIXSERVER=$4 && export PATH=$INFORMIXDIR/bin:$PATH && export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && - ./onstat -x | awk '{print $1}' | tail -n 2 | head -n 1) + ./onstat -x | awk '{a[NR]=$0} END{print a[NR-1]}'| awk '{print $1}') echo $result diff --git a/rdb/src/main/java/com/instana/dc/rdb/DataCollector.java b/rdb/src/main/java/com/instana/dc/rdb/DataCollector.java index 5d94738..ec247bc 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DataCollector.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DataCollector.java @@ -33,7 +33,7 @@ private DataCollector() throws Exception { ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()); String configFile = System.getenv(CONFIG_ENV); if (configFile == null) { - configFile = CONFIG_YAML; + configFile = "config/config-informix.yaml"; } dcConfig = objectMapper.readValue(new File(configFile), CustomDcConfig.class); int n = dcConfig.getInstances().size(); diff --git a/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java b/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java index ceed2ba..edcac85 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java @@ -63,8 +63,8 @@ public class DbRawMetricRegistry { put(DB_SEQ_SCAN_TABLE_NAME, new RawMetric(GAUGE, DB_SEQ_SCAN_TABLE_NAME, DB_SEQ_SCAN_TABLE_DESC, DB_SEQ_SCAN_TABLE_UNIT, true, null)); put(DB_LOCK_WAITS_NAME, new RawMetric(UPDOWN_COUNTER, DB_LOCK_WAITS_NAME, DB_LOCK_WAITS_DESC, DB_LOCK_WAITS_UNIT, true, null)); - put(DB_CACHE_READ_RATIO_NAME, new RawMetric(GAUGE, DB_CACHE_READ_RATIO_NAME, DB_CACHE_READ_RATIO_DESC, DB_CACHE_READ_RATIO_UNIT, true, null)); - put(DB_CACHE_WRITE_RATIO_NAME, new RawMetric(GAUGE, DB_CACHE_WRITE_RATIO_NAME, DB_CACHE_WRITE_RATIO_DESC, DB_CACHE_WRITE_RATIO_UNIT, true, null)); + put(DB_CACHE_READ_RATIO_NAME, new RawMetric(UPDOWN_COUNTER, DB_CACHE_READ_RATIO_NAME, DB_CACHE_READ_RATIO_DESC, DB_CACHE_READ_RATIO_UNIT, true, null)); + put(DB_CACHE_WRITE_RATIO_NAME, new RawMetric(UPDOWN_COUNTER, DB_CACHE_WRITE_RATIO_NAME, DB_CACHE_WRITE_RATIO_DESC, DB_CACHE_WRITE_RATIO_UNIT, true, null)); put(DB_LRU_WRITES_NAME, new RawMetric(UPDOWN_COUNTER, DB_LRU_WRITES_NAME, DB_LRU_WRITES_DESC, DB_LRU_WRITES_UNIT, true, null)); }}; diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java b/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java index c7bd5b9..27a5660 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java @@ -25,6 +25,14 @@ public class Constants { public static final String TOTAL_SESSION_COUNT_SCRIPT = "session_count.sh"; public static final String ACTIVE_SESSION_COUNT_SCRIPT = "active_session_count.sh"; + public static final String OVERFLOW_LOCK_COUNT_SCRIPT = "overflow_lock_count.sh"; + public static final String OVERFLOW_USER_COUNT_SCRIPT = "overflow_user_count.sh"; + public static final String OVERFLOW_TRANSACTION_COUNT_SCRIPT = "overflow_transaction_count.sh"; + public static final String CACHE_READ_RATIO_SCRIPT = "cache_read_ratio.sh"; + public static final String CACHE_WRITE_RATIO_SCRIPT = "cache_write_ratio.sh"; + public static final String LOCK_WAITS_SCRIPT = "lock_waits.sh"; + public static final String LRU_WRITES_SCRIPT = "lru_writes.sh"; + private Constants() { //Private constructor } diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java index 21557f9..48311a5 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java @@ -41,6 +41,15 @@ import static com.instana.dc.rdb.impl.Constants.DISK_READ_SCRIPT; import static com.instana.dc.rdb.impl.Constants.DISK_WRITE_SCRIPT; import static com.instana.dc.rdb.impl.Constants.LOCK_COUNT_SCRIPT; + +import static com.instana.dc.rdb.impl.Constants.OVERFLOW_LOCK_COUNT_SCRIPT; +import static com.instana.dc.rdb.impl.Constants.OVERFLOW_USER_COUNT_SCRIPT; +import static com.instana.dc.rdb.impl.Constants.OVERFLOW_TRANSACTION_COUNT_SCRIPT; +import static com.instana.dc.rdb.impl.Constants.CACHE_READ_RATIO_SCRIPT; +import static com.instana.dc.rdb.impl.Constants.CACHE_WRITE_RATIO_SCRIPT; +import static com.instana.dc.rdb.impl.Constants.LOCK_WAITS_SCRIPT; +import static com.instana.dc.rdb.impl.Constants.LRU_WRITES_SCRIPT; + import static com.instana.dc.rdb.impl.informix.InformixUtil.DB_HOST_AND_VERSION_SQL; @@ -118,26 +127,26 @@ private void registerMetricsMetadata() { new MetricDataConfig(InformixUtil.DB_DATABASE_NLS_ENABLED_SQL, MetricCollectionMode.SQL, List.class, DB_DATABASE_NLS_ENABLED_KEY)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_DATABASE_CASE_INCENSITIVE_NAME, new MetricDataConfig(InformixUtil.DB_DATABASE_CASE_INCENSITIVE_SQL, MetricCollectionMode.SQL, List.class, DB_DATABASE_CASE_INCENSITIVE_KEY)); - MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_TABLE_OVERFLOW_NAME, - new MetricDataConfig(InformixUtil.LOCK_OVF_SQL, MetricCollectionMode.SQL, Number.class)); - MetricsDataConfigRegister.subscribeMetricDataConfig(DB_TRANSACTION_OVERFLOW_NAME, - new MetricDataConfig(InformixUtil.TRANSACTION_OVF_SQL, MetricCollectionMode.SQL, Number.class)); - MetricsDataConfigRegister.subscribeMetricDataConfig(DB_USER_OVERFLOW_NAME, - new MetricDataConfig(InformixUtil.USER_OVF_SQL, MetricCollectionMode.SQL, Number.class)); +// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_TABLE_OVERFLOW_NAME, +// new MetricDataConfig(InformixUtil.LOCK_OVF_SQL, MetricCollectionMode.SQL, Number.class)); +// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_TRANSACTION_OVERFLOW_NAME, +// new MetricDataConfig(InformixUtil.TRANSACTION_OVF_SQL, MetricCollectionMode.SQL, Number.class)); +// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_USER_OVERFLOW_NAME, +// new MetricDataConfig(InformixUtil.USER_OVF_SQL, MetricCollectionMode.SQL, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_SEQ_SCAN_NAME, new MetricDataConfig(sequentialScanQuery, MetricCollectionMode.SQL, List.class, DB_SEQ_SCAN_KEY)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_SEQ_SCAN_TABLE_NAME, new MetricDataConfig(sequentialScanTableQuery, MetricCollectionMode.SQL, Number.class)); - MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_WAITS_NAME, - new MetricDataConfig(InformixUtil.DB_LOCK_WAITS_SQL, MetricCollectionMode.SQL, Number.class)); - MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_READ_RATIO_NAME, - new MetricDataConfig(InformixUtil.DB_CACHE_READ_RATIO_SQL, MetricCollectionMode.SQL, Number.class)); - MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_WRITE_RATIO_NAME, - new MetricDataConfig(InformixUtil.DB_CACHE_WRITE_RATIO_SQL, MetricCollectionMode.SQL, Number.class)); - MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LRU_WRITES_NAME, - new MetricDataConfig(InformixUtil.DB_LRU_WRITES_SQL, MetricCollectionMode.SQL, Number.class)); +// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_WAITS_NAME, +// new MetricDataConfig(InformixUtil.DB_LOCK_WAITS_SQL, MetricCollectionMode.SQL, Number.class)); +// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_READ_RATIO_NAME, +// new MetricDataConfig(InformixUtil.DB_CACHE_READ_RATIO_SQL, MetricCollectionMode.SQL, Number.class)); +// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_WRITE_RATIO_NAME, +// new MetricDataConfig(InformixUtil.DB_CACHE_WRITE_RATIO_SQL, MetricCollectionMode.SQL, Number.class)); +// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LRU_WRITES_NAME, +// new MetricDataConfig(InformixUtil.DB_LRU_WRITES_SQL, MetricCollectionMode.SQL, Number.class)); //Metrics via onstat command @@ -167,6 +176,23 @@ private void registerMetricsMetadata() { new MetricDataConfig(DB_LOCK_COUNT_NAME, LOCK_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_TASK_WAIT_COUNT_NAME, new MetricDataConfig(DB_TASK_WAIT_COUNT_NAME, TASK_WAIT_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); + + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_WAITS_NAME, + new MetricDataConfig(DB_LOCK_WAITS_NAME,LOCK_WAITS_SCRIPT, MetricCollectionMode.CMD, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_READ_RATIO_NAME, + new MetricDataConfig(DB_CACHE_READ_RATIO_NAME,CACHE_READ_RATIO_SCRIPT, MetricCollectionMode.CMD, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_WRITE_RATIO_NAME, + new MetricDataConfig(DB_CACHE_WRITE_RATIO_NAME,CACHE_WRITE_RATIO_SCRIPT, MetricCollectionMode.CMD, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LRU_WRITES_NAME, + new MetricDataConfig(DB_LRU_WRITES_NAME,LRU_WRITES_SCRIPT, MetricCollectionMode.CMD, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_TABLE_OVERFLOW_NAME, + new MetricDataConfig(DB_LOCK_TABLE_OVERFLOW_NAME,OVERFLOW_LOCK_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_TRANSACTION_OVERFLOW_NAME, + new MetricDataConfig(DB_TRANSACTION_OVERFLOW_NAME,OVERFLOW_TRANSACTION_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); + MetricsDataConfigRegister.subscribeMetricDataConfig(DB_USER_OVERFLOW_NAME, + new MetricDataConfig(DB_USER_OVERFLOW_NAME,OVERFLOW_USER_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); + + } /** @@ -285,7 +311,7 @@ private void getallMetrics() { @SuppressWarnings("unchecked") private void mediumPollingInterval() { - getRawMetric(DB_SQL_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_SQL_COUNT_NAME)); + getRawMetric(DB_SQL_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_SQL_COUNT_NAME)); getRawMetric(DB_SQL_RATE_NAME).setValue((Number) metricCollector.collectMetrics(DB_SQL_RATE_NAME)); getRawMetric(DB_TRANSACTION_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_TRANSACTION_COUNT_NAME)); getRawMetric(DB_TRANSACTION_RATE_NAME).setValue((Number) metricCollector.collectMetrics(DB_TRANSACTION_COUNT_NAME)); From f95ed83514059abb8d207c7643d1423491176106 Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 12 Jun 2024 15:43:21 +0530 Subject: [PATCH 04/13] Informix DB release 4 metrics Scripts --- rdb/scripts/informix/cache_read_ratio.sh | 13 +++++++++++++ rdb/scripts/informix/cache_write_ratio.sh | 13 +++++++++++++ rdb/scripts/informix/disk_read.sh | 3 --- rdb/scripts/informix/lock_waits.sh | 13 +++++++++++++ rdb/scripts/informix/lru_writes.sh | 13 +++++++++++++ rdb/scripts/informix/overflow_lock_count.sh | 13 +++++++++++++ rdb/scripts/informix/overflow_transaction_count.sh | 13 +++++++++++++ rdb/scripts/informix/overflow_user_count.sh | 13 +++++++++++++ 8 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 rdb/scripts/informix/cache_read_ratio.sh create mode 100644 rdb/scripts/informix/cache_write_ratio.sh create mode 100644 rdb/scripts/informix/lock_waits.sh create mode 100644 rdb/scripts/informix/lru_writes.sh create mode 100644 rdb/scripts/informix/overflow_lock_count.sh create mode 100644 rdb/scripts/informix/overflow_transaction_count.sh create mode 100644 rdb/scripts/informix/overflow_user_count.sh diff --git a/rdb/scripts/informix/cache_read_ratio.sh b/rdb/scripts/informix/cache_read_ratio.sh new file mode 100644 index 0000000..9e42111 --- /dev/null +++ b/rdb/scripts/informix/cache_read_ratio.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# (c) Copyright IBM Corp. 2024 +# (c) Copyright Instana Inc. + +result=$(cd $1 && + export INFORMIXDIR=$2 && + export ONCONFIG=$3 && + export INFORMIXSERVER=$4 && + export PATH=$INFORMIXDIR/bin:$PATH && + export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && + ./onstat -p |head -n 8| awk '{a[NR]=$0} END{print a[NR-1]}'| awk '{print $4}') + +echo $result|cut -d'.' -f 1 \ No newline at end of file diff --git a/rdb/scripts/informix/cache_write_ratio.sh b/rdb/scripts/informix/cache_write_ratio.sh new file mode 100644 index 0000000..934d889 --- /dev/null +++ b/rdb/scripts/informix/cache_write_ratio.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# (c) Copyright IBM Corp. 2024 +# (c) Copyright Instana Inc. + +result=$(cd $1 && + export INFORMIXDIR=$2 && + export ONCONFIG=$3 && + export INFORMIXSERVER=$4 && + export PATH=$INFORMIXDIR/bin:$PATH && + export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && + ./onstat -p |head -n 8| awk '{a[NR]=$0} END{print a[NR-1]}'| awk '{print $8}') + +echo $result|cut -d'.' -f 1 \ No newline at end of file diff --git a/rdb/scripts/informix/disk_read.sh b/rdb/scripts/informix/disk_read.sh index e8de7b2..875b12a 100644 --- a/rdb/scripts/informix/disk_read.sh +++ b/rdb/scripts/informix/disk_read.sh @@ -10,7 +10,4 @@ result=$(cd $1 && export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && ./onstat -p | awk 'NR==7 {print $1}') - - # For solaris 10 ./onstat -p | awk 'NR==6 {print $1}' - echo $result \ No newline at end of file diff --git a/rdb/scripts/informix/lock_waits.sh b/rdb/scripts/informix/lock_waits.sh new file mode 100644 index 0000000..f7d2953 --- /dev/null +++ b/rdb/scripts/informix/lock_waits.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# (c) Copyright IBM Corp. 2024 +# (c) Copyright Instana Inc. + +result=$(cd $1 && + export INFORMIXDIR=$2 && + export ONCONFIG=$3 && + export INFORMIXSERVER=$4 && + export PATH=$INFORMIXDIR/bin:$PATH && + export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && + ./onstat -p |head -n 20| awk '{a[NR]=$0} END{print a[NR-1]}'| awk '{print $2}') + +echo $result \ No newline at end of file diff --git a/rdb/scripts/informix/lru_writes.sh b/rdb/scripts/informix/lru_writes.sh new file mode 100644 index 0000000..0ab63cc --- /dev/null +++ b/rdb/scripts/informix/lru_writes.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# (c) Copyright IBM Corp. 2024 +# (c) Copyright Instana Inc. + +result=$(cd $1 && + export INFORMIXDIR=$2 && + export ONCONFIG=$3 && + export INFORMIXSERVER=$4 && + export PATH=$INFORMIXDIR/bin:$PATH && + export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && + ./onstat -F| head -n 8| awk '{a[NR]=$0} END{print a[NR-1]}'| awk '{print $2}') + +echo $result \ No newline at end of file diff --git a/rdb/scripts/informix/overflow_lock_count.sh b/rdb/scripts/informix/overflow_lock_count.sh new file mode 100644 index 0000000..d8f8baf --- /dev/null +++ b/rdb/scripts/informix/overflow_lock_count.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# (c) Copyright IBM Corp. 2024 +# (c) Copyright Instana Inc. + +result=$(cd $1 && + export INFORMIXDIR=$2 && + export ONCONFIG=$3 && + export INFORMIXSERVER=$4 && + export PATH=$INFORMIXDIR/bin:$PATH && + export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && + ./onstat -p |head -n 17| awk '{a[NR]=$0} END{print a[NR-1]}'| awk '{print $1}') + +echo $result \ No newline at end of file diff --git a/rdb/scripts/informix/overflow_transaction_count.sh b/rdb/scripts/informix/overflow_transaction_count.sh new file mode 100644 index 0000000..ff6fd66 --- /dev/null +++ b/rdb/scripts/informix/overflow_transaction_count.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# (c) Copyright IBM Corp. 2024 +# (c) Copyright Instana Inc. + +result=$(cd $1 && + export INFORMIXDIR=$2 && + export ONCONFIG=$3 && + export INFORMIXSERVER=$4 && + export PATH=$INFORMIXDIR/bin:$PATH && + export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && + ./onstat -p |head -n 17| awk '{a[NR]=$0} END{print a[NR-1]}'| awk '{print $3}') + +echo $result \ No newline at end of file diff --git a/rdb/scripts/informix/overflow_user_count.sh b/rdb/scripts/informix/overflow_user_count.sh new file mode 100644 index 0000000..ba3e043 --- /dev/null +++ b/rdb/scripts/informix/overflow_user_count.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# (c) Copyright IBM Corp. 2024 +# (c) Copyright Instana Inc. + +result=$(cd $1 && + export INFORMIXDIR=$2 && + export ONCONFIG=$3 && + export INFORMIXSERVER=$4 && + export PATH=$INFORMIXDIR/bin:$PATH && + export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && + ./onstat -p |head -n 17| awk '{a[NR]=$0} END{print a[NR-1]}'| awk '{print $2}') + +echo $result \ No newline at end of file From 68695a63bf00e5e29efe7e055555af975365c5c3 Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 12 Jun 2024 15:46:29 +0530 Subject: [PATCH 05/13] Informix DB release 4 metrics Scripts --- rdb/scripts/informix/active_session_count.sh | 2 +- rdb/scripts/informix/disk_read.sh | 2 +- rdb/scripts/informix/disk_write.sh | 2 +- rdb/scripts/informix/lock_count.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rdb/scripts/informix/active_session_count.sh b/rdb/scripts/informix/active_session_count.sh index b7b7986..e8e95a9 100644 --- a/rdb/scripts/informix/active_session_count.sh +++ b/rdb/scripts/informix/active_session_count.sh @@ -1,4 +1,4 @@ -# !/bin/bash +#!/bin/bash # (c) Copyright IBM Corp. 2024 # (c) Copyright Instana Inc. diff --git a/rdb/scripts/informix/disk_read.sh b/rdb/scripts/informix/disk_read.sh index 875b12a..c3ec852 100644 --- a/rdb/scripts/informix/disk_read.sh +++ b/rdb/scripts/informix/disk_read.sh @@ -1,4 +1,4 @@ -# !/bin/bash +#!/bin/bash # (c) Copyright IBM Corp. 2024 # (c) Copyright Instana Inc. diff --git a/rdb/scripts/informix/disk_write.sh b/rdb/scripts/informix/disk_write.sh index a2c6222..f780a61 100644 --- a/rdb/scripts/informix/disk_write.sh +++ b/rdb/scripts/informix/disk_write.sh @@ -1,4 +1,4 @@ -# !/bin/bash +#!/bin/bash # (c) Copyright IBM Corp. 2024 # (c) Copyright Instana Inc. diff --git a/rdb/scripts/informix/lock_count.sh b/rdb/scripts/informix/lock_count.sh index f740873..f27100b 100644 --- a/rdb/scripts/informix/lock_count.sh +++ b/rdb/scripts/informix/lock_count.sh @@ -1,4 +1,4 @@ -# !/bin/bash +#!/bin/bash # (c) Copyright IBM Corp. 2024 # (c) Copyright Instana Inc. From 0c5c6dbb0b1d665980dcbf387a496c3bcb05622c Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 12 Jun 2024 15:51:47 +0530 Subject: [PATCH 06/13] Informix DB release 4 metrics Scripts --- rdb/scripts/informix/sql_count.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdb/scripts/informix/sql_count.sh b/rdb/scripts/informix/sql_count.sh index 6b41796..088e3ee 100644 --- a/rdb/scripts/informix/sql_count.sh +++ b/rdb/scripts/informix/sql_count.sh @@ -8,6 +8,6 @@ result=$(cd $1 && export INFO RMIXSERVER=$4 && export PATH=$INFORMIXDIR/bin:$PATH && export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/$5 && - ./onstat -g his 1 | head -n 11 | awk '{a[NR]=$0} END{print a[NR-1]}' | awk '{print $4}') + ./onstat -g his 1 | head -n 10 | awk '{a[NR]=$0} END{print a[NR-1]}' | awk '{print $4}') echo $result From 7f7294b61a9adfb9e860072a5738bdcf1e3040d3 Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 12 Jun 2024 16:00:07 +0530 Subject: [PATCH 07/13] Informix DB release 4 metrics Scripts --- rdb/src/main/java/com/instana/dc/rdb/DataCollector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdb/src/main/java/com/instana/dc/rdb/DataCollector.java b/rdb/src/main/java/com/instana/dc/rdb/DataCollector.java index ec247bc..5d94738 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DataCollector.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DataCollector.java @@ -33,7 +33,7 @@ private DataCollector() throws Exception { ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()); String configFile = System.getenv(CONFIG_ENV); if (configFile == null) { - configFile = "config/config-informix.yaml"; + configFile = CONFIG_YAML; } dcConfig = objectMapper.readValue(new File(configFile), CustomDcConfig.class); int n = dcConfig.getInstances().size(); From 278bb107a0b27214ffa56f0d0859ef65f4900ca6 Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 12 Jun 2024 16:04:05 +0530 Subject: [PATCH 08/13] Informix DB release 4 metrics Scripts --- .../dc/rdb/impl/informix/InformixDc.java | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java index 48311a5..2a27842 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java @@ -13,7 +13,6 @@ import com.instana.dc.rdb.impl.informix.metric.collection.*; import com.instana.dc.rdb.impl.informix.metric.collection.strategy.MetricsCollector; import org.apache.commons.dbcp2.BasicDataSource; - import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; @@ -26,7 +25,6 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; - import static com.instana.dc.rdb.DbDcUtil.*; import static com.instana.dc.rdb.impl.Constants.ACTIVE_SESSION_COUNT_SCRIPT; import static com.instana.dc.rdb.impl.Constants.DISK_READ_SCRIPT; @@ -41,7 +39,6 @@ import static com.instana.dc.rdb.impl.Constants.DISK_READ_SCRIPT; import static com.instana.dc.rdb.impl.Constants.DISK_WRITE_SCRIPT; import static com.instana.dc.rdb.impl.Constants.LOCK_COUNT_SCRIPT; - import static com.instana.dc.rdb.impl.Constants.OVERFLOW_LOCK_COUNT_SCRIPT; import static com.instana.dc.rdb.impl.Constants.OVERFLOW_USER_COUNT_SCRIPT; import static com.instana.dc.rdb.impl.Constants.OVERFLOW_TRANSACTION_COUNT_SCRIPT; @@ -49,7 +46,6 @@ import static com.instana.dc.rdb.impl.Constants.CACHE_WRITE_RATIO_SCRIPT; import static com.instana.dc.rdb.impl.Constants.LOCK_WAITS_SCRIPT; import static com.instana.dc.rdb.impl.Constants.LRU_WRITES_SCRIPT; - import static com.instana.dc.rdb.impl.informix.InformixUtil.DB_HOST_AND_VERSION_SQL; @@ -127,28 +123,11 @@ private void registerMetricsMetadata() { new MetricDataConfig(InformixUtil.DB_DATABASE_NLS_ENABLED_SQL, MetricCollectionMode.SQL, List.class, DB_DATABASE_NLS_ENABLED_KEY)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_DATABASE_CASE_INCENSITIVE_NAME, new MetricDataConfig(InformixUtil.DB_DATABASE_CASE_INCENSITIVE_SQL, MetricCollectionMode.SQL, List.class, DB_DATABASE_CASE_INCENSITIVE_KEY)); -// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_TABLE_OVERFLOW_NAME, -// new MetricDataConfig(InformixUtil.LOCK_OVF_SQL, MetricCollectionMode.SQL, Number.class)); -// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_TRANSACTION_OVERFLOW_NAME, -// new MetricDataConfig(InformixUtil.TRANSACTION_OVF_SQL, MetricCollectionMode.SQL, Number.class)); -// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_USER_OVERFLOW_NAME, -// new MetricDataConfig(InformixUtil.USER_OVF_SQL, MetricCollectionMode.SQL, Number.class)); - MetricsDataConfigRegister.subscribeMetricDataConfig(DB_SEQ_SCAN_NAME, new MetricDataConfig(sequentialScanQuery, MetricCollectionMode.SQL, List.class, DB_SEQ_SCAN_KEY)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_SEQ_SCAN_TABLE_NAME, new MetricDataConfig(sequentialScanTableQuery, MetricCollectionMode.SQL, Number.class)); -// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_WAITS_NAME, -// new MetricDataConfig(InformixUtil.DB_LOCK_WAITS_SQL, MetricCollectionMode.SQL, Number.class)); -// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_READ_RATIO_NAME, -// new MetricDataConfig(InformixUtil.DB_CACHE_READ_RATIO_SQL, MetricCollectionMode.SQL, Number.class)); -// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_WRITE_RATIO_NAME, -// new MetricDataConfig(InformixUtil.DB_CACHE_WRITE_RATIO_SQL, MetricCollectionMode.SQL, Number.class)); -// MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LRU_WRITES_NAME, -// new MetricDataConfig(InformixUtil.DB_LRU_WRITES_SQL, MetricCollectionMode.SQL, Number.class)); - - //Metrics via onstat command MetricsDataConfigRegister.subscribeMetricDataConfig(DB_SQL_COUNT_NAME, new MetricDataConfig(DB_SQL_COUNT_NAME, SQL_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); @@ -176,7 +155,6 @@ private void registerMetricsMetadata() { new MetricDataConfig(DB_LOCK_COUNT_NAME, LOCK_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_TASK_WAIT_COUNT_NAME, new MetricDataConfig(DB_TASK_WAIT_COUNT_NAME, TASK_WAIT_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); - MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_WAITS_NAME, new MetricDataConfig(DB_LOCK_WAITS_NAME,LOCK_WAITS_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_READ_RATIO_NAME, @@ -311,12 +289,11 @@ private void getallMetrics() { @SuppressWarnings("unchecked") private void mediumPollingInterval() { - getRawMetric(DB_SQL_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_SQL_COUNT_NAME)); + getRawMetric(DB_SQL_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_SQL_COUNT_NAME)); getRawMetric(DB_SQL_RATE_NAME).setValue((Number) metricCollector.collectMetrics(DB_SQL_RATE_NAME)); getRawMetric(DB_TRANSACTION_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_TRANSACTION_COUNT_NAME)); getRawMetric(DB_TRANSACTION_RATE_NAME).setValue((Number) metricCollector.collectMetrics(DB_TRANSACTION_COUNT_NAME)); getRawMetric(DB_SQL_ELAPSED_TIME_NAME).setValue((List) metricCollector.collectMetrics(DB_SQL_ELAPSED_TIME_NAME)); - } private void shortPollingInterval() { @@ -333,10 +310,8 @@ private void shortPollingInterval() { getRawMetric(DB_IO_READ_RATE_NAME).setValue((Number) metricCollector.collectMetrics(DB_IO_READ_RATE_NAME)); getRawMetric(DB_IO_WRITE_RATE_NAME).setValue((Number) metricCollector.collectMetrics(DB_IO_WRITE_RATE_NAME)); getRawMetric(DB_MEM_UTILIZATION_NAME).setValue((Number) metricCollector.collectMetrics(DB_MEM_UTILIZATION_NAME)); - getRawMetric(DB_DISK_WRITE_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_DISK_WRITE_COUNT_NAME)); getRawMetric(DB_DISK_READ_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_DISK_READ_COUNT_NAME)); - getRawMetric(DB_LOCK_WAITS_NAME).setValue((Number) metricCollector.collectMetrics(DB_LOCK_WAITS_NAME)); getRawMetric(DB_CACHE_READ_RATIO_NAME).setValue((Number) metricCollector.collectMetrics(DB_CACHE_READ_RATIO_NAME)); getRawMetric(DB_CACHE_WRITE_RATIO_NAME).setValue((Number) metricCollector.collectMetrics(DB_CACHE_WRITE_RATIO_NAME)); From 493723b55be5f35d02ec533a9209997b91ea13ce Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 12 Jun 2024 16:06:02 +0530 Subject: [PATCH 09/13] Informix DB release 4 metrics Scripts --- rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java b/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java index 75b0fc5..4057ece 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java @@ -223,7 +223,7 @@ private DbDcUtil() { public static final String DB_LRU_WRITES_NAME = DB_LRU_WRITES.getKey(); public static final String DB_LRU_WRITES_DESC = " Number of Least Recently Used Writes."; - public static final String DB_LRU_WRITES_UNIT = "lruWrites"; + public static final String DB_LRU_WRITES_UNIT = "{lruWrites}"; /* Utilities: **/ From ec6a6bfcb14d27ca0043922ba2886acdc77a0fc1 Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 12 Jun 2024 16:07:06 +0530 Subject: [PATCH 10/13] Informix DB release 4 metrics Scripts --- rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java b/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java index 4057ece..c27cccf 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java @@ -222,7 +222,7 @@ private DbDcUtil() { public static final String DB_CACHE_WRITE_RATIO_UNIT = "1"; public static final String DB_LRU_WRITES_NAME = DB_LRU_WRITES.getKey(); - public static final String DB_LRU_WRITES_DESC = " Number of Least Recently Used Writes."; + public static final String DB_LRU_WRITES_DESC = "Number of LRU (Least Recently Used) Writes."; public static final String DB_LRU_WRITES_UNIT = "{lruWrites}"; /* Utilities: From 52f5d3250eba717886aaeff24561b3f989d50782 Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 12 Jun 2024 16:08:49 +0530 Subject: [PATCH 11/13] Informix DB release 4 metrics Scripts --- rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java | 1 - rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java | 1 - 2 files changed, 2 deletions(-) diff --git a/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java b/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java index edcac85..1362530 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java @@ -61,7 +61,6 @@ public class DbRawMetricRegistry { put(DB_USER_OVERFLOW_NAME, new RawMetric(UPDOWN_COUNTER, DB_USER_OVERFLOW_NAME, DB_USER_OVERFLOW_DESC, DB_USER_OVERFLOW_UNIT, true, null)); put(DB_SEQ_SCAN_NAME, new RawMetric(UPDOWN_COUNTER, DB_SEQ_SCAN_NAME, DB_SEQ_SCAN_DESC, UNIT_BY, true, DB_SEQ_SCAN_KEY)); put(DB_SEQ_SCAN_TABLE_NAME, new RawMetric(GAUGE, DB_SEQ_SCAN_TABLE_NAME, DB_SEQ_SCAN_TABLE_DESC, DB_SEQ_SCAN_TABLE_UNIT, true, null)); - put(DB_LOCK_WAITS_NAME, new RawMetric(UPDOWN_COUNTER, DB_LOCK_WAITS_NAME, DB_LOCK_WAITS_DESC, DB_LOCK_WAITS_UNIT, true, null)); put(DB_CACHE_READ_RATIO_NAME, new RawMetric(UPDOWN_COUNTER, DB_CACHE_READ_RATIO_NAME, DB_CACHE_READ_RATIO_DESC, DB_CACHE_READ_RATIO_UNIT, true, null)); put(DB_CACHE_WRITE_RATIO_NAME, new RawMetric(UPDOWN_COUNTER, DB_CACHE_WRITE_RATIO_NAME, DB_CACHE_WRITE_RATIO_DESC, DB_CACHE_WRITE_RATIO_UNIT, true, null)); diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java b/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java index 27a5660..061909b 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java @@ -24,7 +24,6 @@ public class Constants { public static final String TASK_WAIT_COUNT_SCRIPT = "task_wait_count.sh"; public static final String TOTAL_SESSION_COUNT_SCRIPT = "session_count.sh"; public static final String ACTIVE_SESSION_COUNT_SCRIPT = "active_session_count.sh"; - public static final String OVERFLOW_LOCK_COUNT_SCRIPT = "overflow_lock_count.sh"; public static final String OVERFLOW_USER_COUNT_SCRIPT = "overflow_user_count.sh"; public static final String OVERFLOW_TRANSACTION_COUNT_SCRIPT = "overflow_transaction_count.sh"; From 9bae4421f780aa389fb383f7013f0e8703bb121a Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Thu, 13 Jun 2024 10:45:22 +0530 Subject: [PATCH 12/13] Informix DB Release 4 metrics --- rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java | 2 +- .../com/instana/dc/rdb/DbRawMetricRegistry.java | 4 ++-- .../instana/dc/rdb/impl/informix/InformixDc.java | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java b/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java index c27cccf..212baf6 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DbDcUtil.java @@ -222,7 +222,7 @@ private DbDcUtil() { public static final String DB_CACHE_WRITE_RATIO_UNIT = "1"; public static final String DB_LRU_WRITES_NAME = DB_LRU_WRITES.getKey(); - public static final String DB_LRU_WRITES_DESC = "Number of LRU (Least Recently Used) Writes."; + public static final String DB_LRU_WRITES_DESC = "Number of LRU (Least Recently Used) Writes."; public static final String DB_LRU_WRITES_UNIT = "{lruWrites}"; /* Utilities: diff --git a/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java b/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java index 1362530..5a96384 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java +++ b/rdb/src/main/java/com/instana/dc/rdb/DbRawMetricRegistry.java @@ -62,8 +62,8 @@ public class DbRawMetricRegistry { put(DB_SEQ_SCAN_NAME, new RawMetric(UPDOWN_COUNTER, DB_SEQ_SCAN_NAME, DB_SEQ_SCAN_DESC, UNIT_BY, true, DB_SEQ_SCAN_KEY)); put(DB_SEQ_SCAN_TABLE_NAME, new RawMetric(GAUGE, DB_SEQ_SCAN_TABLE_NAME, DB_SEQ_SCAN_TABLE_DESC, DB_SEQ_SCAN_TABLE_UNIT, true, null)); put(DB_LOCK_WAITS_NAME, new RawMetric(UPDOWN_COUNTER, DB_LOCK_WAITS_NAME, DB_LOCK_WAITS_DESC, DB_LOCK_WAITS_UNIT, true, null)); - put(DB_CACHE_READ_RATIO_NAME, new RawMetric(UPDOWN_COUNTER, DB_CACHE_READ_RATIO_NAME, DB_CACHE_READ_RATIO_DESC, DB_CACHE_READ_RATIO_UNIT, true, null)); - put(DB_CACHE_WRITE_RATIO_NAME, new RawMetric(UPDOWN_COUNTER, DB_CACHE_WRITE_RATIO_NAME, DB_CACHE_WRITE_RATIO_DESC, DB_CACHE_WRITE_RATIO_UNIT, true, null)); + put(DB_CACHE_READ_RATIO_NAME, new RawMetric(GAUGE, DB_CACHE_READ_RATIO_NAME, DB_CACHE_READ_RATIO_DESC, DB_CACHE_READ_RATIO_UNIT, true, null)); + put(DB_CACHE_WRITE_RATIO_NAME, new RawMetric(GAUGE, DB_CACHE_WRITE_RATIO_NAME, DB_CACHE_WRITE_RATIO_DESC, DB_CACHE_WRITE_RATIO_UNIT, true, null)); put(DB_LRU_WRITES_NAME, new RawMetric(UPDOWN_COUNTER, DB_LRU_WRITES_NAME, DB_LRU_WRITES_DESC, DB_LRU_WRITES_UNIT, true, null)); }}; diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java index 2a27842..cc31a8a 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java @@ -156,19 +156,19 @@ private void registerMetricsMetadata() { MetricsDataConfigRegister.subscribeMetricDataConfig(DB_TASK_WAIT_COUNT_NAME, new MetricDataConfig(DB_TASK_WAIT_COUNT_NAME, TASK_WAIT_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_WAITS_NAME, - new MetricDataConfig(DB_LOCK_WAITS_NAME,LOCK_WAITS_SCRIPT, MetricCollectionMode.CMD, Number.class)); + new MetricDataConfig(DB_LOCK_WAITS_NAME, LOCK_WAITS_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_READ_RATIO_NAME, - new MetricDataConfig(DB_CACHE_READ_RATIO_NAME,CACHE_READ_RATIO_SCRIPT, MetricCollectionMode.CMD, Number.class)); + new MetricDataConfig(DB_CACHE_READ_RATIO_NAME, CACHE_READ_RATIO_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_CACHE_WRITE_RATIO_NAME, - new MetricDataConfig(DB_CACHE_WRITE_RATIO_NAME,CACHE_WRITE_RATIO_SCRIPT, MetricCollectionMode.CMD, Number.class)); + new MetricDataConfig(DB_CACHE_WRITE_RATIO_NAME, CACHE_WRITE_RATIO_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LRU_WRITES_NAME, - new MetricDataConfig(DB_LRU_WRITES_NAME,LRU_WRITES_SCRIPT, MetricCollectionMode.CMD, Number.class)); + new MetricDataConfig(DB_LRU_WRITES_NAME, LRU_WRITES_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_LOCK_TABLE_OVERFLOW_NAME, - new MetricDataConfig(DB_LOCK_TABLE_OVERFLOW_NAME,OVERFLOW_LOCK_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); + new MetricDataConfig(DB_LOCK_TABLE_OVERFLOW_NAME, OVERFLOW_LOCK_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_TRANSACTION_OVERFLOW_NAME, - new MetricDataConfig(DB_TRANSACTION_OVERFLOW_NAME,OVERFLOW_TRANSACTION_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); + new MetricDataConfig(DB_TRANSACTION_OVERFLOW_NAME, OVERFLOW_TRANSACTION_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); MetricsDataConfigRegister.subscribeMetricDataConfig(DB_USER_OVERFLOW_NAME, - new MetricDataConfig(DB_USER_OVERFLOW_NAME,OVERFLOW_USER_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); + new MetricDataConfig(DB_USER_OVERFLOW_NAME, OVERFLOW_USER_COUNT_SCRIPT, MetricCollectionMode.CMD, Number.class)); } From 1e972766b1fb4183e6d47b74232477a2a719c1dc Mon Sep 17 00:00:00 2001 From: vivek mahalingam Date: Wed, 19 Jun 2024 14:09:30 +0530 Subject: [PATCH 13/13] Changing queries for Buffer Cache read and Buffer Cache writes --- .../java/com/instana/dc/rdb/impl/informix/InformixUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java index 54667db..fede7f2 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixUtil.java @@ -56,8 +56,8 @@ private InformixUtil() { public static final String DB_DISK_READ_COUNT_SQL = "SELECT VALUE FROM SYSPROFILE WHERE NAME = 'dskreads';"; public static final String DB_LOCK_WAITS_SQL = "select value from sysprofile where name = 'lockwts'"; - public static final String DB_CACHE_READ_RATIO_SQL = "select (1-(sp0.value/sp1.value))*100 as res from sysprofile sp0 left join sysprofile sp1 on sp1.name = 'bufreads' where sp0.name= 'dskreads'"; - public static final String DB_CACHE_WRITE_RATIO_SQL = "select (1-(sp0.value/sp1.value))*100 as res from sysprofile sp0 left join sysprofile sp1 on sp1.name = 'bufwrites' where sp0.name= 'dskwrites'"; + public static final String DB_CACHE_READ_RATIO_SQL = "select (1-(dskReadsVal / bufReadsVal)) * 100 as res from (select sp0.value as dskReadsVal, (select sp1.value from sysprofile sp1 where sp1.name = 'bufreads') as bufReadsVal from sysprofile sp0 where sp0.name= 'dskreads' )"; + public static final String DB_CACHE_WRITE_RATIO_SQL = "select (1-(dskWritesVal / bufWritesVal)) * 100 as res from (select sp0.value as dskWritesVal, (select sp1.value from sysprofile sp1 where sp1.name = 'bufwrites') as bufWritesVal from sysprofile sp0 where sp0.name= 'dskwrites' )"; public static final String DB_LRU_WRITES_SQL = "select value from sysprofile where name = 'lruwrites'"; public static String decodePassword(String encodedPwd) {