Adding an Entity to Oracle Management Cloud with JSON Method
Authors: Monowar Mukul (OCM), Nassyam Basha (Oracle ACE Director, OCM)
Introduction
In the earlier articles, we have added entities using Oracle Management Cloud Graphical user interface, in this article we will add the database entity using the JSON method. Entity addition to OMC will be pushed from the target server using the command line utility OMCLI for Infrastructure monitoring with detailed instructions. Finally, we will also test how to delete the entity from the Oracle Management Cloud.
Prerequisites
Prerequisites are the same for adding entities either from OMC GUI or using the JSON push method. Please refer to the article “OMC: Discovering Entities for Oracle Infrastructure Monitoring — Part II” for more details on how to add entity using OMC GUI method. As part of prerequisites, we need to create the database user, or we can use the default database user “DBSNMP.” To create the new user, execute the predefined script “GrantPrivilegesMonSvc.sh” available to download from MOS Doc ID 2401597.1. This script will create user and grants the necessary roles and privileges.
$chmod 777 grantPrivilegesMonSvc.sh
$./grantPrivilegesMonSvc.sh
After completion of the script, we can see the monitoring user has created, and then we can proceed to install the agent, the installation of an agent already shown with more details in the article “Oracle Management Cloud — Agent Deployment.”
To get the benefit of IT analytics modules, database user needs few additional roles by running the script “grantPrivilegesITA.sh.”
Adding the Database Entity using JSON
We have already created the user omcmon and created and granted to adequate roles and permissions following the documentation. Now we will add the database entity with the JSON method. To add the entity using command line we must use OMCLI (Oracle Management Command Line Interface). Using OMCLI we have to use two JSON files 1) Credentials 2) Entity information. We will see the practical steps below.
Note: We will add the entity from the target server
Initially, we have to prepare the credentials JSON used to authenticate and register the credentials with the Oracle Management Cloud. In credentials JSON file we have to enter the database user, password and the role of the user.
Download JSON Files: https://codepen.io/nassyambasha/pen/rRVPQW.html
Next, we will prepare the JSON file for the Database entity; we have to mention the configuration of the entity such as
- Entity Name
- Entity Type
- Display Name
- Time zone region name
- Hostname
- Port
- SID
- Monitoring Password
Download JSON Files: https://codepen.io/nassyambasha/pen/rRVPQW.html
After preparing the JSON files, we will add the entity using the OMCLI with the below command.
[oracle@DOETST OMC]$ omcli add_entity agent omc_oracle_db_add.json -credential_file omc_oracle_db_creds.json
Oracle Management Cloud Agent
Copyright © 1996, 2018 Oracle Corporation. All rights reserved.
Operation Succeeded: Accepted 1 of 1 entities for processing.
After adding the entity, we can view the status of the entity by passing the entity JSON file.
[oracle@DOETST OMC]$ omcli status_entity agent omc_oracle_db_add.json
Oracle Management Cloud Agent
Copyright © 1996, 2018 Oracle Corporation. All rights reserved.
omc_oracle_db.oradb : AGENT:entity successfully added — ( Entity count: 3 Validation checks: 2 warnings found )
omc_oracle_db_instance.oradb/EAMYT
omc_oracle_pdb.oradb/PDB1
In the above output, if the add entity failed then to troubleshoot, we can add verbose with the same command.
[oracle@DOETST OMC]$ omcli status_entity agent omc_oracle_db_add.json -verbose
Oracle Management Cloud Agent
Copyright © 1996, 2018 Oracle Corporation. All rights reserved.
omc_oracle_db.oradb : AGENT:entity successfully added — ( Entity count: 3 Validation checks: 2 warnings found )
omc_oracle_db_instance.oradb/EAMYT
omc_oracle_pdb.oradb/PDB1
Details:
Check 1 : Validate if parameter “Host Name (host_name)” is provided.
Status : SUCCESS
Check 2 : Validate if parameter “port” is provided.
Status : SUCCESS
Check 3 : Validate if parameter “sid or Service Name (service_name)” is provided.
Status : SUCCESS
Check 4 : Validate if parameter “protocol” is provided.
Status : SUCCESS
Check 5 : Validate if credential parameter “Username (DBUserName)” is provided.
Status : SUCCESS
Check 6 : Validate if credential parameter “Password (DBPassword)” is provided.
Status : SUCCESS
Check 7 : Validate if credential parameter “Database Role (DBRole)” is provided.
Status : SUCCESS
Check 8 : Validate if credential parameter “name” is provided.
Status : SUCCESS
Check 9 : Validate if credential parameter “credType” is provided.
Status : SUCCESS
Check 10: Validate database connectivity
Status : SUCCESS
Check 11: Version Compatibility Check
Status : SUCCESS
Check 12: Validate if the user “C##OMCMON” has required privileges and grants.
Status : WARNING
Issue : The following privileges have not been granted to “C##OMCMON”.
READ ON V_$RSRCPDBMETRIC_HISTORY
READ ON GV_$RSRCPDBMETRIC_HISTORY
READ ON GV_$CON_SYSMETRIC_HISTORY
READ ON V_$SYSTEM_PARAMETER
READ ON GV_$SYSTEM_PARAMETER
READ ON V_$CON_SYSMETRIC_HISTORY
Action : For details on how to grant the required privileges, follow instructions athttp://www.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/management-cloud&id=im_prereq_omc_oracle_dbCheck 13: Validate if the user “C##OMCMON” has required privileges and grants, in case if there is
plan to enable Enterprise Edition license.
Status : WARNING
Issue : The following privileges have not been granted to “C##OMCMON”.
SELECT ON V_$RSRC_CONSUMER_GROUP
SELECT ON DBA_HIST_SNAPSHOT
SELECT ON DBA_HIST_IC_CLIENT_STATS
SELECT ON GV_$RSRC_CONSUMER_GROUP
SELECT ON V_$SQL_PLAN
SELECT ON GV_$SQL_PLAN
SELECT ON DBA_HIST_PGASTAT
SELECT ON DBA_HIST_OSSTAT
SELECT ON DBA_HIST_SQLTEXT
SELECT ON GV_$SQLCOMMAND
SELECT ON DBA_HIST_SQLSTAT
SELECT ON DBA_HIST_SGA
SELECT ON DBA_HIST_SYS_TIME_MODEL
SELECT ON DBA_HIST_SYSMETRIC_HISTORY
SELECT ON DBA_HIST_DATABASE_INSTANCE
SELECT ON DBA_HIST_SYSSTAT
SELECT ON V_$SQL
SELECT ON DBA_HIST_SYSTEM_EVENT
SELECT ON DBA_HIST_SGASTAT
Action : If you plan on enabling Enterprise Edition on this database, you will need to add
additional privileges to the monitoring user “C##OMCMON”. See
https://docs.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/management-cloud&id=im_prereq_omc_oracle_db
for details.
Check 14: Perform entity discovery
Status : SUCCESS
omc_oracle_db_instance.oradb/EAMYT
omc_oracle_pdb.oradb/PDB1
We can see the entity was added to the OMC successfully. Similarly, to delete the entity, we can use a similar command with the change of attribute “delete_entity.”
[oracle@DOETST OMC]$ omcli delete_entity agent omc_oracle_db_add.json
Oracle Management Cloud Agent
Copyright © 1996, 2018 Oracle Corporation. All rights reserved.
Request for removing the entities was accepted for processing.
Summary
We’ve seen starting from prerequisites how to prepare the JSON files to add the entity to Oracle management cloud for infrastructure using command line utility OMCLI including troubleshooting. In this article key part is to understand the JSON file and to use the proper values carefully before adding an entity. We’ve also seen how to delete the entity using command line utility OMCLI.
Authors Bio
Nassyam Basha is a Database Administrator. He has around ten years of experience as a Production Oracle DBA, currently working as Database Expert with eProseed KSA. He holds a master’s degree in Computer Applications from the University of Madras. He is an Oracle 11g Certified master an Oracle ACE Director. He actively participates in Oracle-related forums such as OTN with a status of Super Hero, Oracle support awarded as “Guru” and acting as OTN Moderator and written numerous articles with OTN and on Toad World. He maintains an Oracle technology-related blog, www.oracle-ckpt.com and can be reached at https://www.linkedin.com/in/nassyambasha/
Monowar Mukul is currently working as a Principal Oracle Database Specialist. I am an Oracle certified Master (Oracle 12c Certified Master Administration, Oracle 12c Certified Master MAA, and Oracle 11g Certified Master Administration). He has been working as an Oracle DBA consultant over 17 years with Oracle MAA space for both Exadata and non-Exadata Systems, Oracle Cloud Space and SOA Middleware. He worked across various business sectors including tertiary education, energy, government, mining and transport in Australia. He demonstrated highly developed critical thinking and analytical skills working as a Principal Oracle Database Specialist. You can find more details about him and his work achievements at https://www.linkedin.com/in/monowarmukul/
References
Creating the Oracle Database monitoring credentials for Oracle Management Cloud (Infrastructure Monitoring) (Doc ID 2401597.1)