In this tutorial, you learn how to create a simple metric extension. The metric extension will be used to check the CPU utilization of the agent process.
Approximately 1 hour.
Metric Extensions allow you to extend Enterprise Manager monitoring capabilities to cover critical information specific to the operation of your environment. This provides you with a more comprehensive view of your monitored environment. In addition, metric extensions simplify IT processes by leveraging Enterprise Manager as the primary monitoring tool used for your data center rather than relying on separate monitoring tools.
In this tutorial, you will:
The following is a list of software requirements:
This example architecture is shown diagrammatically below:
Before starting this tutorial, you should:
Note: Screen captures for this tutorial were taken in a Linux environment; if you are using a different operating system the browser look and feel will vary slightly.
. |
The metric extension that we will be creating is a host based metric extension. To create the metric extension, first you need to login to Enterprise Manager Cloud Control using the super administrator account you created earlier. From the home page, choose the Enterprise menu, then Monitoring, and then Metric Extensions: |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
. |
On the "Metric Extensions" page, scroll down and click the Create button: |
||||||||||||
. |
On the "Create New : General Properties" page, enter the following values in the "General Properties" region then click on the Next button:
|
||||||||||||
. |
This brings up the "Create New : Adapter" page where you specify the adapter definition properties. In this example, we will be running a Perl script so you need to enter the path to the Perl executable as the command. Note the list of available variables on the right hand side of the screen here includes "%perlBin% as the location of the perl binary, so the command to be entered here is %perlBin%/perl. To locate the perl script to be executed, click on the pencil icon to the right of the "Script" field: |
||||||||||||
. |
This will bring up the File Editor screen. If you click on the Upload button, it will allow you to browse for the file to load: |
||||||||||||
. |
From here, locate and select the cpu_usage.pl script and click the Open button: |
||||||||||||
. |
Next, click OK: |
||||||||||||
. |
The file contents will then be displayed (Note: If you don't have the cpu_usage.pl script, you can just type it into the File Contents window as well). Notice the two values returned via the print em_result statement are separated by the vertical bar ("|") delimiter. Click OK. Note: In the script, make sure that the emctl and ps statements are enclosed in backquotes (also known as back ticks), otherwise the statements will not execute, and you will not see any results when you test the Metric. Also, note that you need to include the correct full path to emctl (which is running on the target) if you have multiple versions of EM agents running on the taret. |
||||||||||||
. |
The "Script" field has now been filled in for you. The "Delimiter" field defaults to the vertical bar, which is what we want in this case. Since the print statement starts with em_result=, that is what we need to enter for the "Starts With" field. Click Next: |
||||||||||||
. |
Next, we need to define the columns returning the information from the metric extension. On the "Create New : Columns" page, click the Add button: |
||||||||||||
. |
The first column to add is the agent process ID. Enter a name of agent_PID, display name of Agent PID, define the column to be a Key Column and click OK: |
||||||||||||
. |
The first column has now been added. Click Add again to add the second column to contain the CPU utilization value: |
||||||||||||
. |
Enter a name of agent_CPU_util, a display name of Agent CPU Utilization (%), define the column to be of type Data Column and enter Pct for a unit. This time, we want to add an alert threshold as well, so select the comparison operator, >, and enter a warning level of 80 and a critical level of 95. We also want to only receive notifications after 3 alert thresholds, so click on the Advanced button to access this field: |
||||||||||||
. |
Enter a value of 3 for the "Number of Occurrences Before Alert" field, and click OK: |
||||||||||||
. |
You should now see both columns added. Click Next: |
||||||||||||
. |
On the "Create New : Credentials" page, accept the defaults and click Next: |
||||||||||||
. |
Next, we need to add targets, so on the "Create New : Test" page, click Add: |
||||||||||||
. |
Select the host you want to execute the metric extension on (in our example, this is host03.example.com). Click Select: |
||||||||||||
. |
You should now see the host target name added. Click Run Test to validate the script executes correctly on the target: |
||||||||||||
. |
While the test is running, you will see the "Testing Results - In Progress" screen (this will automatically close if the test is successful): |
||||||||||||
. |
You should now be returned to the "Create New : Test" screen, and the "Test Results" region should be populated with the target name, Agent PID and Agent CPU Utilization (%) fields. Click Next: |
||||||||||||
. |
The "Create New : Review" screen will now appear. Scroll down and check the testing status area shows no failures and click Finish: |
||||||||||||
. |
You should now be returned to the "Metric Extensions" screen, and a confirmation message should be displayed confirming the metric extension was successfully created: |
. |
The next stage of creating a metric extension is to save it as a deployable draft. Firstly, let's give ourselves some more real estate on the screen by closing the confirmation the metric extensions was successfully created by clicking the small x on the right hand side of the confirmation message as well as closing the overview by clicking the arrow on the left of "Hide Overview": |
---|---|
. |
Ensure the metric extension is highlighted, then click the Actions menu and select Save As Deployable Draft: |
. |
The "Status" column should now show a value of "Deployable Draft": |
. |
The final stage of the process is to publish the metric extension and deploy it to the targets you want to use it on. Again, ensure the metric extension is highlighted and select the Actions menu, but this time choose Publish Metric Extension from the list of menu items: |
---|---|
. |
The "Status" column should now show a value of "Published": |
. |
Next, from the Actions menu select the Deploy to Targets... option: |
. |
On the "Deploy To Targets" screen, click the Add button: |
. |
The "Search and Select: Targets" screen appears. From the list of targets, select the host you want to deploy the metric extension to (in our example, host03.example.com), and click Select: |
. |
The host should be added to the list of targets, so now you just need to click Submit: |
. |
The "Pending Deploy Operations" page now appears. Click the Refresh button in the top right hand corner of the screen, until the value "No data found" is shown in the "Pending Deploy Operations" list. This will show the metric extension has been successfully deployed: |
. |
Since the metric extension has been successfully deployed, we need to return to the "Metric Extensions" page by clicking the Metric Extensions link: |
. |
You should now see the metric extension has been deployed to one target. Click on the link in the Deployed Targets column: |
. |
Next, click on the target name link: |
. |
From the host home page, select Host, then Monitoring, then All Metrics: |
. |
From the list of metrics, click the Agent CPU Utilization link: |
. |
Depending on your timing, you may see "No data to deploy" in the "Agent CPU Utilization (%)" part of the screen. If so, click on the Refresh button until data appears: |
Metric Extensions allow you to extend Enterprise Manager monitoring capabilities to cover critical information specific to the operation of your environment. This provides you with a more comprehensive view of your monitored environment. In addition, metric extensions simplify IT processes by leveraging Enterprise Manager as the primary monitoring tool used for your data center rather than relying on separate monitoring tools.
In this tutorial, you should have learned how to:
Copyright © 2011, Oracle and/or its affiliates. All rights reserved | |