In a recent post on monitoring Oracle GoldenGate, I talked about how to configure the JAGENT to use Oracle Enterprise Manager 12c to monitor Oracle GoldenGate. If you would like to review that post, you can find it here. For this post, I’ll show you how you can use Metric Extensions within Oracle Enterprise Manager 12c to monitor Oracle GoldenGate.
Note: Another good post on this topic can be found from my friend Maaz. Here is his post.
As Maaz and I were talking about the finer aspects of the JAGENT, we started to talk about Metric Extensions to monitor Oracle GoldenGate. This got me to thinking how this could be accomplished.
One of the first things that is needed before you can set up a Metric Extension is how you are going to monitor the processes. Being that most of the Oracle GoldenGate instances that I monitor are on Unix/Linux, I decided to use a Perl script to grab the basic info associated with Oracle GoldenGate. This basically means, I just wanted to see what the current status of the processes was. This is achieved from GGSCI using the INFO ALL command (Figure 1).
As you can tell, all of the Oracle GoldenGate processes are running. In order to monitor these processes, they need to be put into a format that Oracle Enterprise Manager 12c can understand. In order to do this, I used a Perl script to get the output in Figure 1 into a pipe delimited string. The Perl script that I used to do this is located in Listing 1.
Listing 1: Perl Script
my $gghome = “/oracle/app/product/12.1.2/ggate”;
my @buf = `$gghome/ggsci << EOF
The Perl script provided (Listing 1) basically reads the output from the INFO ALL command into a buffer. For everything in the buffer, look for any lines that have EXTRACT or REPLICAT in it. Then replace all the spaces with a pipe (|) . Lastly print out the output I want. When the script is ran, you should get output similar to Figure 2.
Now that the output is in a pipe (|) format, I can use this in the Metric Extension.
Before we take a look at Metric Extensions, if you have never used them they are a great way to extend Oracle Enterprise Manager 12c to be more efficient in monitoring granular things. The documentation associated with Metric Extensions in Oracle docs are great and they are also covered in the Expert Oracle Enterprise Manager 12c book out by Apress.
To begin setting up a Metric Extension for monitoring Oracle GoldenGate, you need to go to the Metric Extensions page within Oracle Enterprise Manager 12c (Enterprise –> Monitoring –> Metric Extensions). Once on the page, you are presented with a Create button about half way down the page (Figure 3). The Create option can also be accessed from the Actions drop down.
Figure3: Metric Extensions Page
Once you click on the Create button, you will be taken to a wizard to begin developing the Metric Extension. On the General Properties page, you need to fill out the required fields. Since you are going to monitor this with a Perl script, the Target Type will be Host. Then you need to name the Metric Extension (ME$). Next provide the display name; this is the name that will show up in the All Metrics later. Finally, the Adaptor drop down, select OS Command – Multiple Columns. This way the metric will read the pipe (|) sign and break the string up. Figure 4 provides you a screen shot.
On the next screen, you need to provide the command that will run the script and the script that you want ran. The delimiter field is a pipe (|) by default. Fill in the required information (Figure 5).
The Columns screen is next. This screen is where you will setup the names of the columns and map what will go where. Also, you can set the Alert Threshold for the the column that will be monitored. One key think to point out here, you will need a PK for the data. This basically means a unique way of identify an Oracle GoldenGate process. For this configuration, the PK is the uniqueness between Program and Object. Figure 6 illustrates how I have the columns configured for this setup.
Once you have the columns established, Oracle Enterprise Manager 12c will ask you what Credentials you want to use with this metric. The default monitoring credentials are fine (Figure 7).
Finally, you can test the Metric Extension and see how it is going to look. This is your chance to make sure that all the values from the script return and appear how you expect them to be. Figure 8, shows a successful test run. If you have everything configured as expected, your output should come up in the Test Results without the pipe (|) signs. If an error message is returned then investigate why you received it.
In my testing, the errors I received were due to the PK issue with the columns when defined for the metric.
Lastly, when you make it to the review screen, just check everything and click Finish. Once you click Finish, you will be taken back to the Metric Extension landing page. From the landing page, you can now deploy the metric to target the Metric Extension is to be associated with.
To deploy the Metric Extension, use the Action menu and select Deploy to Target. Select the target which is should be deployed to (Figure 9).
Once you Metric Extension has been deployed to the selected target, you can then go to that target and check in All Metrics to see how it looks. For a host, you can do this by going to Targets –> Hosts. Then select the host that you wanted. From the Host menu, select Monitoring –> All Metrics. Once on the All Metrics landing page, look for the name of the metric in the drop down tree then click on it. You will be presented with the current status of the metric in the right-hand pane (Figure 10).
At this point, the Metric Extension for monitoring Oracle GoldenGate processes has been successfully developed, tested and deployed to a target. The next step you need to accomplish is to ensure that you are notified when something happens to a process. This is done with Notification Rules (not covered here). Once the notification rules are established, monitoring Oracle GoldenGate using Metric Extensions is a great way to work around any JAGENT issues you may have.