JDBC API の使用

内容
apmdevops98jp
内容
Introscope JDBC API の構文は以下の仮想ビューをサポートします。
  • metric_data
  • trace_headers
  • traces
メトリック クエリ
メトリックを実行すると、クエリでは、Introscope JDBC ドライバによってサポートされている、以下の日付形式のいずれかが使用されます。
  • YYYY-MM-DD HH:MM:SS
  • EEE MMM dd HH:mm:ss zzz yyyy
For example, a metric query may look like: select * from metric_data where agent={regex} and metric={regex} and timestamp between {starttime} and {endtime} or: select * from metric_data where agent='.*Custom Metric Host.*' and metric='.*' and timestamp between '01/01/01 00:00:00' and '01/01/07 00:00:00'
修飾子は SQL ステートメントの中で以下の順序で記述する必要があります。
[sort by value {ascending|descending}] [maxmatches={max metrics}] [period={period in seconds}] [aggregateall]
注:
シャットダウンしているエージェントに JDBC ドライバを使用してクエリを実行すると、「0」が返されます。
以下の修飾子は Enterprise Manager のメトリック集約機能をサポートしています。
修飾子名
機能の内容
sort by value {a|d}
Enterprise Manager が各タイムスライスのメトリック値に対して昇順または降順の
N
ソートを行うようにフラグを設定します。
maxmatches
フラグと共にこの修飾子を使用すると、トップ N 個の一致だけにメトリック制限を指定できます。
maxmatches
Enterprise Manager がここで指定した数を上限とするメトリックに対するデータのみを返すようにフラグを設定します。 たとえば、
maxmatches=2
の場合、2 つのメトリックのデータのみが返されます。
これは、返される行数を制限する sql の
limit
キーワードとは異なります。
maxmatches=2
の例では、2 つのメトリックに対して 50 タイムスライス、つまり合計で 100 行のデータが返されます。
period
Enterprise Manager がデータ ポイントを指定した期間に集約するようにフラグを設定します。 たとえば、Enterprise Manager は通常 15 秒のデータ値をレポートしますが、
period=60
の場合は 60 秒に集約できます。
aggregateall
Enterprise Manager が全メトリックデータを 1 つの要約されたタイムスライスに集約するようにフラグを設定します。 たとえば、この修飾子を使用して、1 週間にわたる期間のメトリックに単一の平均応答時間を与えることができます。
aggregateall
period
修飾子と共に使用することは避けてください。いずれも集約を行うので、競合が発生します。
メトリック クエリの例
select * from metric_data where agent='.*' and metric='.*Average Response.*' and timestamp between '01/01/01 00:00:00' and '01/01/07 00:00:00' maxmatches=10 select * from metric_data where agent='.*' and metric='.*Average Response.*' and timestamp between '01/01/01 00:00:00' and '01/01/07 00:00:00' maxmatches=1 select * from metric_data where agent='.*' and metric='.*Average Response.*' and timestamp between '01/01/01 00:00:00' and '01/01/07 00:00:00' maxmatches=1 period=120 // match one metric_data and aggregate all values. This returns one row of data select * from metrics where agent='.*' and metric='.*Average Response.*' and timestamp between '01/01/01 00:00:00' and '01/01/07 00:00:00' maxmatches=1 aggregateall // this is a top 10 query select * from metric_data where agent='.*' and metric='.*Average Response.*' and timestamp between '01/01/01 00:00:00' and '01/01/07 00:00:00' sort by value d maxmatches=10
トランザクション追跡クエリ
基本的なトランザクション ヘッダ クエリの構文は以下のとおりです。
select * from trace_headers where timestamp between {starttime} and {endtime} and query={lucene query string} [limit {rows}]
lucene query string
は、Workstation の履歴クエリにあるような、有効な Lucene クエリ文字列です(詳細については、「
CA APM Workstation ユーザ ガイド
」を参照)。
オプションの
limit
フラグは、クエリが返す行数を制限します。 制限が指定されない場合、サーバで定義されているデフォルトのトランザクション制限が使用されます。
追跡本体に対するクエリは同一ですが、異なるビューを参照します。
select * from traces where timestamp between {starttime} and {endtime} and query={lucene query string} [limit {rows}]
トランザクション追跡クエリの例
select * from trace_headers where timestamp between '01/01/01 00:00:00' and '01/01/07 00:00:00' and query='s*' select * from trace_headers where timestamp between '01/01/01 00:00:00' and '01/01/07 00:00:00' and query='host:blinky' select * from traces where timestamp between '01/01/01 00:00:00' and '01/01/07 00:00:00' and query='host:blinky' limit 100
追跡クエリが返したデータ行には、ドメイン、ホスト、プロセスとエージェントの名前、およびトランザクション追跡の XML 表現などのエージェント情報が含まれます。