The sample Perl script used in this example monitors the 5-minute load average on the system. The script performs this function by using the uptime command to obtain the average number of jobs in the run queue over the last 5 minutes.
The script is written in Perl. Enterprise Manager uses the system variables %perlBin% to obtain the location of the Perl interpreter and %scriptsDir% to obtain the location of the script. Both of these variables are defined in the emd.properties file.
This script, called udmload.pl, is installed in a common administrative
script directory (%scriptsDir% = $ORACLE_ HOME/admin_scripts).
Important: Do not store user-defined metric monitoring scripts in the same location as Enterprise Manager system scripts.
Copy the script (udmload.pl) to the monitored target. For example: $ORACLE_ HOME/admin_scripts. Make sure you have an Enterprise Manager 10g Management Agent running on this machine.
Edit the script, if necessary, to point to the location of the Perl interpreter on the monitored target. By default, the script assumes the Perl interpreter is in /usr/local/bin.
As a test, run the script: udmload.pl You may need to set its file permissions so that it runs successfully. You should see output of this form:
em_result=2.1
Definition Settings
Metric Name: Test User-Defined Metric
Metric Type: Number
Command Line: %perlBin%/perl %scriptsDir%/udmload.pl
Environment: leave blank
Operating System User Name: <OS user able to execute the script>
Password: ******
Threshold Settings
Comparison Operator: >=
Critical Threshold: 0.005
Warning Threshold: 0.001
Consecutive Occurrences Preceding Notification: 1
In this example, we want the metric to trigger an alert at a Warning level if the 5-minute load average on the machine reaches 0.005, and trigger an alert at a Critical level if the 5-minute load average reaches 0.001. Feel free to change these thresholds depending on your system.
Schedule Settings:
Start: Immediately after creation
Frequency: Repeat every 5 minutes
Note: You must specify at least a 5 minute interval
When the 5-minute load reaches at least 0.001, you should see the metric trigger an alert.
Creating Your Monitoring Script
Registering the Script as a User-Defined Metric
Enterprise Manager Information Roadmap
Copyright © 1996, 2007, Oracle. All rights reserved.