Wednesday, February 2, 2011

Create userdefined reports in Grid Control

You can define your own reports in Grid Control.

Login as sys on the Grid Repository and execute the following:

SQL> insert into sysman.mgmt_ip_report_elem_def values('target_user_table_from_sql','database_target_type','target_user_table_from_sql',
'oracle.sysman.db.util.reports.TableTargetRenderController',0,NULL,'EM',NULL,
'10.2.0.1.0');


SQL> insert into SYSMAN.MGMT_IP_ELEM_PARAM_CLASSES
(ELEMENT_NAME_NLSID, ELEMENT_TYPE_NLSID, ELEMENT_PARAM_CLASS, DISPLAY_ORDER)
values ('target_user_table_from_sql','database_target_type'

,'oracle.sysman.eml.ip.render.elem.HeaderParamController',1);

SQL> insert into SYSMAN.MGMT_IP_ELEM_PARAM_CLASSES
(ELEMENT_NAME_NLSID, ELEMENT_TYPE_NLSID, ELEMENT_PARAM_CLASS, DISPLAY_ORDER)
values ('target_user_table_from_sql', 'database_target_type', 'oracle.sysman.eml.ip.render.elem.SQLStatementParamController', 2);

sql> Commit;

Once completed, you will get a new report element called "target_user_table_from _sql" on the report page and you will be able to create reports that query target databases.

Reset the Grid Control agent

If you would like to reset the agent and clear all the files do the following :

$AGENT_HOME/bin/emctl stop agent
$rm $AGENT_HOME/sysman/emd/agntstmp.txt
$rm $AGENT_HOME/sysman/emd/lastupld.xml
$rm $AGENT_HOME/sysman/emd/state/*.*
$rm $AGENT_HOME/sysman/emd/upload/*.*
$AGENT_HOME/bin/emctl start agent

Policy evaluation cycle

The following table describes the default evaluation cycles for Grid Control 10g, which will also determine when a violation is cleared :
  1.     Configuration Policies:  once every 12 hrs
  2.     Storage Policies:  once every 3 days
  3.     Object Policies:  once every 12 hrs
  4.     Security Policies:  once every day
These intervals are fixed for EM version 10.1.0.
Note that they are tied to the polling frequency of the associated metric.

If you would like to reevaluate the policies right now than perform the following steps :

$cd $AGENT_HOME/bin
$./emctl stop agent
$./emctl start agent
$./emctl clearstate agent
$./emctl upload agent
$./emctl clearstate agent

ypmatch: the domainname hasn't been set on this machine

Metric error received in Grid Control 10.1.0.4.0 view for AIX 5.2 target host: "ypmatch: the domainname hasn't been set on this machine."

The cause of this problem is that "bos.net.nis.client" fileset is installed, but NIS is not configured for use. The existence of this fileset causes the ypmatch command to be used as part of host metric collection, but this command will fail if NIS is not configured for use on the system.

To disable the file give the command: chmod -x /usr/bin/ypmatch, so the command cannot be sent and the error is not generated.

Error rendering element. Exception: ORA-01017: invalid username/password; logon denied

When starting a report from OEM the above error occurs. Probably the MGMT_VIEW password has been changed. See metalink : How To Change The MGMT_VIEW Password Used By Grid Control Repository [ID 374382.1]

To change the MGMT_VIEW user password:
For 10.2.0.1.0 to 10.2.0.4.0
1. Stop the OMS
cd OMS $OH/bin
$ ./emctl stop oms
2. Confirm that there is a recent backup of the repository
3. Change the MGMT_VIEW user password:
There is an API call to reset the password for MGMT_VIEW:
SQL> connect sysman/<pwd> SQL> exec mgmt_view_priv.change_view_user_password('<Insert PWD here>');
4. Start the OMS
cd OMS $OH/bin
$ ./emctl start oms

For 10.2.0.5.0 and 11.1
Starting from Grid Control 10.2.0.5.0 there is a new "emctl" command to change the MGMT_VIEW user password:
cd <OMS_HOME>/bin
> $ emctl config oms -change_view_user_pwd [-sysman_pwd <sysman_pwd>] [-user_pwd <user_pwd>] [-auto_generate]
The above does not need the emkey to be copied into the repository.
-sysman_pwd
 The password for the SYSMAN user.

-user_pwd
 The new password for theMGMT_VIEW user. This is an optional parameter and if it is not specified, the password is auto generated.

-auto_generate
 If this option is specified, the password is auto generated.