using apex to create a mobile user interface for enterprise manager 12c

Post on 18-Feb-2017

1.393 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

USING APEX TO CREATE A MOBILE USER INTERFACE FOR ENTERPRISE

MANAGER 12C

Gökhan Atıl

Oracle Day İstanbul, 11/11/2014

Gökhan Atıl

• DBA Team Lead

• 10+ years experience

• 10g/11g/R12 OCP DBA

• Oracle Certified Expert on SQL & Exadata

• Comptia Linux+

• Blogger (since October 5th, 2008) gokhanatil.com

• Co-Founder of Turkey Oracle User Group (TROUG)

• Oracle ACE (since October 25th, 2011)

Expert Oracle Enterprise Manager 12c

Kellyn Pot'vin

Anand Akela

Gokhan Atil

Bobby Curtis

Alex Gorbachev

Niall Litchfield

Leighton Nelson

Pete Sharman

June 25 th, 2013

Agenda

Enterprise Manager Cloud Control

Event Management in EM12c

Why did we need a Mobile User Interface?

Views and Procedues in EM12c Repository

Oracle Application Express

Short Story of Building the Application

Result

What’s Next?

Enterprise Manager Cloud Control 12c

• Descendant of Database Console › Oracle EM Grid Control

› Oracle EM Express

• Client-Server Architecture

• Provides more than just controlling databases › Middleware, Storage, Operation System

• First product of Oracle Cloud Series (12c)

• Basic features are free as long as you purchase of any Oracle software license or Support contract.

Enterprise Manager Cloud Control 12c

• Base Framework Features › Agent Management, Monitoring and Incident

Management, My Oracle Support integration...

• Base Database Management › Pluggable Databases, Resource Management,

Scheduler Central, Patch Recommendations...

• Base Middleware Management › Only the target home page itself is unlicensed

• Base Engineered Systems Management • Server, Storage, and Virtualization Management

› Oracle VM and Guest VM provisioning

Enterprise Manager Cloud Control 12c

EM12c Web Interface

EM Repository

Oracle Management Server

EMCLI

EM Agent

EM Agent

EM Agent

Incident Management in EM12c

Problems ADR

Events

Availability Alerts

Metric Alerts

Job Status Change

Compliance Violations

User-reported

INCIDENT

INCIDENT RULES

Why did we need a Mobile User Interface?

Why don’t we use EM12c Mobile Application?

EM12c Mobile Helps you to manage Incidents

Avaliable for ONLY iPhone

Released at February 2012

Hard to Navigate

Needs More Features

It shouldn’t be hard to develop it!

Here is The Plan:

EM12c Web Interface

EM Repository

Oracle Management Server

EMCLI

EM Agent

EM Agent

EM Agent

My Mobile Application

Views and Procedures in EM12c Repository

• MGMT$TARGET – Target information (name, type, guid, hostname...)

• MGMT$INCIDENTS – All incidents (id, summary, severity, owner, status...)

• MGMT$PROBLEMS – All problems (id, problem key, summary, status...)

• EM_EVENT_MANAGER package – suppress_issue – close_problem

You can find more at Oracle Enterprise Manager Cloud Control Documentation

Oracle Application Express

• Web Applications with SQL and PL/SQL

• Supports Mobile Development using jQuery Mobile

• Fully supported, no cost option of the Oracle Database

• Installed as part of the standard Oracle Database › Needs to be upgraded!

• Right tool for the job!

Oracle Application Express

• Download the APEX (from Oracle.com)

• Easy update/installation:

$ unzip apex_4.x.x.zip -d /home/oracle

$ cd /home/oracle/apex

$ sqlplus / as sysdba

SQL> @apexins.sql SYSAUX SYSAUX TEMP /i/

SQL> @apxldimg.sql /home/oracle

SQL> @apxchpwd.sql

Welcome to Oracle APEX

• Login to: http://yourserver:8080/apex/

Preparations

• Create A Workspace – Workspace will also create a database user

• Give required permissions to schema

• Login to Your New Workspace

grant EXEMPT ACCESS POLICY to youruser;

grant EXECUTE on SYSMAN.EM_EVENT_MANAGER to youruser;

grant SELECT on SYSMAN.MGMT$INCIDENTS to youruser;

grant SELECT on SYSMAN.MGMT$PROBLEMS to youruser

grant SELECT on SYSMAN.MGMT$TARGET to youruser;

Short Story of Building the Application

Architecture of the Application

MAIN PAGE

(page 1)

Button

(open incidents)

Button

(open problems)

OPEN INCIDENTS

(page 2)

List View

OPEN PROBLEMS

(page 3)

List View

INCIDENT DETAILS

(page 4)

Report View

Back Button

Underlying Problems

PROBLEM DETAILS (#5)

Quick Tips for the Application

• While Creating The Application we should select jQuery Mobile Smartphone as User Interface!

• EM12c Users are also DB Users in Repository, so we can use «database users» for authorization.

Quick Tips for the Application

• We can use empty HTML regions to put buttons!

Quick Tips for the Application

• ListView is flexible component you can use for Mobile Applications

List Incidents (Page 2)

• We can use below query to list open incidents:

SELECT i.INCIDENT_ID, i.CREATION_DATE, i.SEVERiTY, t.TARGET_NAME || ': ' || i.SUMMARY_MSG MSG FROM MGMT$INCIDENTS i, MGMT$TARGET t WHERE i.TARGET_GUID= t.TARGET_GUID AND i.OPEN_STATUS = 1 AND i.iS_SUPPRESSED = 0 ORDER BY i.CREATION_DATE DESC;

• We need to link to another page from ListView:

• The above link will call page 4, and set P4_INCIDENT_ID variable in page 4 to INCIDENT_ID of the selected row.

f?p=&APP_ID.:4:&APP_SESSION.::::P4_INCIDENT_ID:&INCIDENT_ID.

List Problems (Page 3)

• We can use below query to list open problems:

SELECT p.PROBLEM_ID, p.CREATION_DATE, p.SEVERITY, t.TARGET_NAME || ' : ' || p.SUMMARY_MSG MSG FROM MGMT$PROBLEMS p, MGMT$TARGET t WHERE p.TARGET_GUID= t.TARGET_GUID AND p.OPEN_STATUS = 1 AND p.IS_SUPPRESSED = 0 ORDER BY p.CREATION_DATE DESC;

• We need to link to another page from ListView:

f?p=&APP_ID.:5:&APP_SESSION.::::P5_PROBLEM_ID:&PROBLEM_ID.

Incident Details (page 4)

SELECT i.SEVERITY,i.INCIDENT_NUM, t.TARGET_NAME,t.HOST_NAME, i.PRIORITY,i.CREATION_DATE, i.LAST_UPDATED_DATE FROM MGMT$INCIDENTS i, MGMT$TARGET t WHERE i.TARGET_GUID= t.TARGET_GUID AND i.INCIDENT_ID = :P4_INCIDENT_ID;

Development Demo

How About Some Extra?

• APEX supports HTML5 Charts, If we create dblinks to our target databases, we may even query ASH to draw nice performance charts.

How About Some Extra?

select null, TO_CHAR(sample_time, 'DD HH24:MI') st, avg(CPU) cpu, avg("User I/O") userio, avg(total-CPU-"User I/O"-"System I/O") others FROM (SELECT sample_time, sum(decode(session_state, 'ON CPU', 1, 0)) as CPU, sum(decode(wait_class, 'Scheduler', 1, 0)) as Scheduler, sum(decode(wait_class, 'User I/O', 1, 0)) as "User I/O", sum(decode(wait_class, 'System I/O', 1, 0)) as "System I/O", sum(decode(wait_class, 'Concurrency', 1, 0)) as Concurrency, sum(decode(wait_class, 'Application', 1, 0)) as Application, sum(decode(wait_class, 'Commit', 1, 0)) as Commit, sum(decode(wait_class, 'Configuration', 1, 0)) as Configuration, sum(decode(wait_class, 'Administrative', 1, 0)) as Administrative, sum(decode(wait_class, 'Network', 1, 0)) as Network, sum(decode(wait_class, 'Queueing', 1, 0)) as Queueing, sum(decode(wait_class, 'Other', 1, 0)) as Other, sum(1) total FROM gv$active_session_history@XXXXX WHERE sample_time > sysdate - (1 / 24) GROUP BY sample_time) group by TO_CHAR(sample_time, 'DD HH24:MI') order by 2;

How About Some Extra?

...with some dedication

Result:

What’s Next?

• Assigning Incidents to Users

• Reports (Be careful about licensing)

• Target Home Pages

ANY QUESTIONS?

@gokhanatil http://gokhanatil.com

top related