There are several types to do a notification using Oracle Enterprise Manager as notification by e-mail, by script, by PL/SQL , SNMP and so on. Here I will show how to do a notification to an e-mail and another notification to a script in a server that OMS (Oracle Management Service) is located.
Then … hands-on :
In OEM click “Setup” -> “Notification Methods” .
In this section you have to complete some informations:
- Outgoing Mail (SMTP) Server = “smtp.brunors.com:587″
- User Name = “open2kg@brunors.com”
- Password / Confirm Password = “XXXXXXXXXX”
- Identify Sender As = “Enterprise Manager Notifications”
- Sender’s E-mail Address = “open2kg@brunors.com”
- Use Secure Connection = “NO”
- Click “Apply”
- Click “Test Mail Servers”
- Click “OK”
In the last section, I tried to use another SMTP Servers as GMAIL (smtp.gmail.com 587 TLS) or HOTMAIL (smtp.live.com 465), I’m not sure but I believe this servers may have some restrictions.
Follow below the mensage in e-mail:
Ok, our SMTP server is done. Now we can add an e-mail to receive the alerts.
- Click “Preferences”
- Click “Add another Row”
- In “E-mail Address”, write the e-mail that you want to receive the alerts. (ope2kg@gmail.com).
- “Message Format”-> Long Format
- Select and Click “Test”
Defining the rules…
- Click “Preferences”
- Notification -> Click “Rules”
- Click “Subscribe (Send E-mail)” in “Agent Upload Problems”
- Click “Subscribe (Send E-mail)” in “Agents Unreachable”
- Click “Subscribe (Send E-mail)” in “Database Availability and Critical States”
- Click “Subscribe (Send E-mail)” in “Host Availability and Critical States”
- Click “Subscribe (Send E-mail)” in “Listener Availability”
- Click “Apply”
Ok, let’s go to check the configuration doing a stop/start in the database:
The database is down. But the notification it is ok? Let’s see in the e-mail…
Yes! The notification to e-mail it is ok. Now, start the database and let’s continue to the notification to script in OMS server.
First, we have to do the script to use in OEM : (I called script_oemnotification.sh, chmod 775).
#!/bin/sh
LOG_FILE=/u01/oem_notification.log
echo “Alert logged:” >> $LOG_FILE
echo “” >> $LOG_FILE
echo “target name is ” $TARGET_NAME >> $LOG_FILE
echo “target type is ” $TARGET_TYPE >> $LOG_FILE
echo “target is on host ” $HOST >> $LOG_FILE
echo “metric in alert is ” $METRIC >> $LOG_FILE
echo “metric index is ” $KEY_VALUE >> $LOG_FILE
echo “timestamp is ” $TIMESTAMP >> $LOG_FILE
echo “severity is ” $SEVERITY >> $LOG_FILE
echo “message is ” $MESSAGE >> $LOG_FILE
echo “notification rule is ” $RULE_NAME >> $LOG_FILE
echo “rule owner is ” $RULE_OWNER >> $LOG_FILEexit 0
Ok, the script is done. Now we must configure it in OEM.
- Click “Setup”
- Click “Notification Methods”
- Add = “OS Command”
- Click “Go”
- Name = “Notification Methods OS TechDatabasket”
- OS Command = “/u01/script_oemnotification.sh”
- Click “Test OS Command”
- Click “OK”
- Click “OK”
The script it’s ok. Then, now he have to put the script in the rules.
- Click “Preferences”
- Click “Rules”
- Click “Assign Methods to Multiple Rules”
- View = “By Method”
- Click to show more about the section “Notification Methods OS TechDatabasket (OS Command)”
- Click “Assign Method to Rule” en “Agent Upload Problems”
- Click “Assign Method to Rule” en “Agents Unreachable”
- Click “Assign Method to Rule” en “Database Availability and Critical States”
- Click “Assign Method to Rule” en “Host Availability and Critical States”
- Click “Assign Method to Rule” en “Listener Availability”
- Click “OK”
Ok, the configuration was done. But it’s works? Then.. let’s put down the database again…
LOG_FILE=/u01/oem_notification.log
Start your database again and finished.
I hope this post can help you!
References:
Reblogged this on Dinesh Ram Kali..
Thank you Dinesh !
For Enterprise Manager there is now a single, comprehensive SNMP trap type that covers all available event types such as metric alerts, target availability, compliance standard violations, or job status changes.