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

32
USING APEX TO CREATE A MOBILE USER INTERFACE FOR ENTERPRISE MANAGER 12C Gökhan Atıl Oracle Day İstanbul, 11/11/2014

Upload: gokhan-atil

Post on 18-Feb-2017

1.393 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

USING APEX TO CREATE A MOBILE USER INTERFACE FOR ENTERPRISE

MANAGER 12C

Gökhan Atıl

Oracle Day İstanbul, 11/11/2014

Page 2: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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)

Page 3: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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

Page 4: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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?

Page 5: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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.

Page 6: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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

Page 7: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Enterprise Manager Cloud Control 12c

EM12c Web Interface

EM Repository

Oracle Management Server

EMCLI

EM Agent

EM Agent

EM Agent

Page 8: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Incident Management in EM12c

Problems ADR

Events

Availability Alerts

Metric Alerts

Job Status Change

Compliance Violations

User-reported

INCIDENT

INCIDENT RULES

Page 9: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Why did we need a Mobile User Interface?

Page 10: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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!

Page 11: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Here is The Plan:

EM12c Web Interface

EM Repository

Oracle Management Server

EMCLI

EM Agent

EM Agent

EM Agent

My Mobile Application

Page 12: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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

Page 13: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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!

Page 14: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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

Page 15: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Welcome to Oracle APEX

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

Page 16: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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;

Page 17: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Short Story of Building the Application

Page 18: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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)

Page 19: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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.

Page 20: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Quick Tips for the Application

• We can use empty HTML regions to put buttons!

Page 21: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Quick Tips for the Application

• ListView is flexible component you can use for Mobile Applications

Page 22: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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.

Page 23: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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.

Page 24: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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;

Page 25: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Development Demo

Page 26: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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.

Page 27: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

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;

Page 28: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

How About Some Extra?

Page 29: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

...with some dedication

Page 30: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

Result:

Page 31: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

What’s Next?

• Assigning Incidents to Users

• Reports (Be careful about licensing)

• Target Home Pages

Page 32: Using APEX to Create a Mobile User Interface for Enterprise Manager 12c

ANY QUESTIONS?

@gokhanatil http://gokhanatil.com