This extension works only with the standalone machine agent.
The Oracle Database is an object-relational database management system.
The Oracle Database monitoring extension captures performance metrics from Oracle databases (version 10g and above) and displays them in AppDynamics. The extension comes with a standard set of queries that gather metrics based on the following categories.
This extension also allows you to query your Oracle Database and view those results on the AppDynamics Metric browser and hence allowing you to build dashboards and set Health Rules based on the output of the extension.
Before the extension is installed, the prerequisites mentioned here need to be met. Please do not proceed with the extension installation if the specified prerequisites are not met.
The Oracle DB extension needs an Oracle user account on every Oracle instance that is to be monitored. You might use an existing account with appropriate rights; however, a dedicated account will be a better solution in terms of security and manageability. - Example script for account creation (run this with a DBA user):
CREATE USER appdynamics IDENTIFIED BY oracle; GRANT CREATE SESSION TO appdynamics; GRANT SELECT ANY DICTIONARY TO appdynamics;
<MachineAgent_Dir>/monitors/The metricPrefix of the extension has to be configured as specified here. Please make sure that the right metricPrefix is chosen based on your machine agent deployment, otherwise this could lead to metrics not being visible in the controller.
Note : Please make sure to not use tab () while editing yaml files. You may want to validate the yaml file using a yaml validator
dbServers: - displayName: "OracleDB" # connectionUrl: "jdbc:oracle:thin:username/password@HostForDatabase:PortForDatabase:databaseName" connectionUrl: "jdbc:oracle:thin:@HostForDatabase:PortForDatabase:databaseName" driver: "oracle.jdbc.OracleDriver" connectionProperties: - user: "system" - password: "oracle" #Needs to be used in conjunction with `encryptionKey`. Please read the extension documentation to generate encrypted password # encryptedPassword: "9XdTa7+McBwP2g2xSpyNsg==" #Needs to be used in conjunction with `encryptedPassword`. Please read the extension documentation to generate encrypted password # encryptionKey: "myKey" # Replaces characters in metric name with the specified characters. # "replace" takes any regular expression # "replaceWith" takes the string to replace the matched characters metricCharacterReplacer: - replace: "%" replaceWith: "" - replace: "," replaceWith: "-" queries: - displayName: "Query1 Sessions " queryStmt: "SELECT 'Sessions' , count(*) NumberOfSessions from v$session " columns: - name: "'Sessions'" type: "metricPathName" - name: "NumberOfSessions" type: "metricValue" - displayName: "Query2 Percent of Max Sessions" queryStmt: "SELECT 'Percent of max sessions' as sessionNumber, a.cnt / b.cpus * 100 AS Value FROM ( SELECT COUNT(*) cnt FROM v$session ) a, ( SELECT value AS cpus FROM v$parameter WHERE name='sessions') b" columns: - name: "sessionNumber" type: "metricPathName" - name: "Value" type: "metricValue" - displayName: "Query3 Percent of Max Open Cursors" queryStmt: "SELECT 'Percent of Max open cursors' as cursors, a.crs / b.max_crs * 100 as Value FROM ( SELECT MAX(a.value) AS crs from v$sesstat a, v$statname b where a.statistic# = b.statistic# AND b.name = 'opened cursors current' ) a, ( select value AS max_crs FROM v$parameter WHERE name='open_cursors' ) b" columns: - name: "cursors" type: "metricPathName" - name: "Value" type: "metricValue" - displayName: "Query4 Active User Sessions" queryStmt: "SELECT 'Active User Sessions' as ActiveUserSessions, COUNT(*) Count FROM v$session WHERE status='ACTIVE' AND username IS NOT NULL" columns: - name: "ActiveUserSessions" type: "metricPathName" - name: "Count" type: "metricValue" - displayName: "Query5 Avg Active Sessions Per Logical CPU" queryStmt: "SELECT 'Average Active Sessions per logical CPU' as AvgActive, a.value / b.cpus AS Value FROM (SELECT value FROM v$sysmetric WHERE group_id = 2 AND metric_name = 'Average Active Sessions') a, (SELECT value AS cpus FROM v$parameter WHERE name='cpu_count') b" columns: - name: "AvgActive" type: "metricPathName" - name: "Value" type: "metricValue" - displayName: "Query6 System Metrics" queryStmt: "SELECT metric_name, Value FROM v$sysmetric WHERE group_id = 2 AND metric_name IN ('Average Active Sessions', 'Current OS Load', 'Database CPU Time Ratio', 'Database Wait Time Ratio', 'DB Block Changes Per Sec', 'DB Block Changes Per Txn', 'DB Block Gets Per Sec', 'DB Block Gets Per Txn', 'Executions Per Sec', 'Executions Per Txn', 'I/O Megabytes per Second', 'Logical Reads Per Sec', 'Physical Reads Per Sec', 'Memory Sorts Ratio', 'Physical Read Total Bytes Per Sec', 'Physical Write Total Bytes Per Sec', 'Shared Pool Free %', 'Execute Without Parse Ratio', 'Soft Parse Ratio', 'Temp Space Used', 'Total PGA Allocated', 'Response Time Per Txn', 'SQL Service Response Time') ORDER BY metric_name" columns: - name: "metric_name" type: "metricPathName" - name: "Value" type: "metricValue" - displayName: "Query7 Wait Class BreakDown Metrics" queryStmt: "SELECT 'Wait Class Breakdown|'||wait_class as waitingMetric, ROUND(aas, 2) as Value FROM(SELECT n.wait_class, m.time_waited/m.INTSIZE_CSEC AAS FROM v$waitclassmetric m, v$system_wait_class n WHERE m.wait_class_id=n.wait_class_id AND n.wait_class != 'Idle' UNION ALL SELECT 'CPU', value/100 AAS FROM v$sysmetric WHERE metric_name = 'CPU Usage Per Sec' AND group_id = 2)" columns: - name: "waitingMetric" type: "metricPathName" - name: "Value" type: "metricValue" - displayName: "Query8 Table Space Percent Free" queryStmt: "select df.tablespace_name as tableName, round(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace)) Value from (select tablespace_name, round(sum(bytes) / 1048576) totalSpace from dba_data_files group by tablespace_name) df, (select round(sum(bytes)/(1024*1024)) totalusedspace, tablespace_name from dba_segments group by tablespace_name) tu where df.tablespace_name = tu.tablespace_name" columns: - name: "tableName" type: "metricPathName" - name: "Value" type: "metricValue" numberOfThreads: 5 #Run it as a scheduled task instead of running every minute. #If you want to run this every minute, comment this out # taskSchedule: # numberOfThreads: 1 # taskDelaySeconds: 10 ```
Configure the path to the config.yml file by editing the
<MACHINE_AGENT_HOME>/monitors/OracleDBMonitor/ directory. Below is the sample
<task-arguments> <!-- config file--> <argument name="config-file" is-required="true" default-value="monitors/OracleDBMonitor/config.yml" /> .... </task-arguments> Note: You will need to provide your own JDBC driver for the database you want to connect to. Put the driver JAR file in the same directory and add it to the classpath element in the monitor.xml file.!
<java-task> <!-- Use regular classpath foo.jar;bar.jar --> <!-- append JDBC driver jar --> <classpath>oracledb-monitoring-extension.jar;Jar-File-For_Your-DB.jar</classpath> <impl-class>com.appdynamics.extensions.oracledb.OracleDBMonitor</impl-class> </java-task>
Lets take a look at some sample connection information:
dbServers: dbServers: - displayName: "OracleDB1" connectionUrl: "jdbc:oracle:thin:email@example.com:1521:orcl12c" driver: "oracle.jdbc.OracleDriver" # connectionProperties: # - user: "system" # - password: "oracle"
In order to connect to any database, you will have to provide a connectionUrl. In the example above we see that the extension is connected to the database (orcl12c)(listed in the config) using the connectionUrl. In this case we are also providing the username, password and the databaseName in the same connectionUrl and therefore the "connectionProperties" and the fields under it, "user" and "password", are commented out. You have to make sure that if you are not sending any connectionProperties to create a connection, then you should comment the whole thing out just like in the example.
Lets take a look at another way you can connect to the database. In this case we do need to provide properties such as a username and a password and therefore we uncomment those lines and update them with valid information.
dbServers: - displayName: "OracleDB1" connectionUrl: "jdbc:oracle:thin:@192.168.57.106:1521:orcl12c" driver: "oracle.jdbc.OracleDriver" connectionProperties: - user: "system" - password: "oracle"
In this case we do add the Database Name as the last part of the connectionUrl (orcl12c) but all other properties like the username and password are provided as connectionProperties. You will have to confirm how your database takes in the login information and based on that provide the information in your config.yaml in order to successfully establish a connection.
Only queries that start with SELECT are allowed! Your query should only return one row at a time.
It is suggested that you only return one row at a time because if it returns a full table with enormous amount of data, it may overwhelm the system and it may take a very long time to fetch that data.
The extension does support getting values from multiple columns at once but it can only pull the metrics from the latest value from the row returned.
The name of the metric displayed on the Metric Browser will be the "name" value that you specify in the config.yml for that metric. Looking at the following sample query :
queries: - displayName: "Active Events" queryStmt: "Select NODE_NAME, EVENT_CODE, EVENT_ID, EVENT_POSTED_COUNT from Active_events" columns: - name: "NODE_NAME" type: "metricPathName" - name: "EVENT_ID" type: "metricPathName" - name: "EVENT_CODE" type: "metricValue" - name: "EVENT_POSTED_COUNT" type: "metricValue"
For the query listed above, there will be two metrics returned as we have two columns of type "metricValue". The metric path for them will be : 1. Custom Metrics|SQL|Instance1|Active Events|NODE_NAME|EVENT_ID|EVENT_CODE 2. Custom Metrics|SQL|Instance1|Active Events|NODE_NAME|EVENT_ID|EVENT_POSTED_COUNT
Lets look at another query.
- displayName: "Node Status" queryStmt: "Select NODE_NAME, NODE_STATE from NODE_STATES" columns: - name: "NODE_NAME" type: "metricPathName" - name: "NODE_STATE" type: "metricValue" properties: convert: "INITIALIZING" : 0 "UP" : 1 "DOWN" : 2 "READY" : 3 "UNSAFE" : 4 "SHUTDOWN" : 5 "RECOVERING" : 6
Lets say if your query returns a text value, but you would still like to see it in the metric browser. In order to make that happen, you could use the "convert" property and assign each value a number. The extension will automatically convert the text value to the corresponding number.
NOTE: In order to use this feature, please make sure that the value that is being returned is EXACTLY the same as you have listed in the config.yaml, otherwise the extension will throw an error.
Here is a summary of the collected metrics. Complete documentation of Oracle's website.
AppDynamics displays metric values as integers. Some metrics are therefore scaled up by a factor of 100 for a better display of low values (e.g. between 0 and 2).
|Wait Class Breakdown||Shows average active sessions per each wait class. Typically, the top wait classes are "CPU" and "User I/O". A shift to other wait classes is a good pointer for further investigation (e.g., of network latency issues). Wait classes are documented in the Oracle Database Reference. See here: https://docs.oracle.com/cloud/latest/db112/REFRN/toc.htm|
The metrics in the supplied code are retrieved from
- v$session - v$sesstat - v$sysmetric - v$system_wait_class - v$waitclassmetric
all of which are, to the author's knowledge, not subject to additional licensing of the Oracle Diagnostics Pack. See Oracle's "Options and Packs" documentation: https://docs.oracle.com/cd/B28359_01/license.111/b28287/options.htm#DBLIC138
If you plan on extending this code using data dictionary views of the Diagnostics Pack (e.g., DBA_HIST_% views), you might want to make use of the argument "ash_licensed" in monitor.xml to easily en-/disable usage of such code.
Always feel free to fork and contribute any changes directly here on GitHub.
Find out more in the AppDynamics Exchange community.
Please visit this page to get detailed instructions on password encryption. The steps in this document will guide you through the whole process.
Workbench is an inbuilt feature provided with each extension in order to assist you to fine tune the extension setup before you actually deploy it on the controller. Please review the following document on How to use the Extensions WorkBench
If after going through the Troubleshooting Document you have not been able to get your extension working, please file a ticket and add the following information in order so that we can assist you better and faster.
Please provide the following in order for us to assist you better.
<MachineAgent>/conf/logging/log4j.xml. Change the level value of the following
<logger>elements to debug.
<MachineAgent>/monitors/ExtensionFolderYouAreHavingIssuesWithdirectory here .
For any support related questions, you can also contact firstname.lastname@example.org.
3.7 or Later
Version Tested On:
Last updated On: