SlideShare a Scribd company logo
GEMINIT | Education
© GEMINIT 2012 AUA-UK 2012
Frédéric Barbier
frederic.barbier@geminit.be
Using IMA
for monitoring Ingres
AUA-UK Conference
June 19th 2012, London
GEMINIT
AUA-UK 2012
This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/3.0/.
Disclaimer
Representations, warranties and disclaimer. Unless otherwise mutually agreed to by the parties in writing, GEMINIT bvba offers this
documentation as-is and makes no representations or warranties of any kind concerning the work, express, implied, statutory or
otherwise, including, without limitation, warranties of title, merchantability, fitness for a particular purpose, noninfringement, or the
absence of latent or other defects, accuracy, or the presence of absence of errors, whether or not discoverable.
Limitation on liability. Except to the extent required by applicable law, in no event will GEMINIT bvba be liable to you on any legal
theory for any special, incidental, consequential, punitive or exemplary damages arising out of this license or the use of the
work, even if GEMINIT bvba has been advised of the possibility of such damages.
Using IMA for monitoring Ingres 2
GEMINIT
AUA-UK 2012
Using IMA for monitoring Ingres
• Introduction & Concepts
• Building the MIB
• Using the MIB for monitoring
• Case: lockman
Using IMA for monitoring Ingres 3
GEMINIT | Education
© GEMINIT 2012 AUA-UK 2012
Introduction & Concepts
GEMINIT
AUA-UK 2012
What is the IMA?
• = Ingres Management Architecture
• Provides access to Ingres process related
information through SQL
 select
 update (limited)
• Gateway
• imadb database created at installation
 select * from ima_server_sessions
Introduction & Concepts
Using IMA for monitoring Ingres 5
GEMINIT
AUA-UK 2012
A few concepts
• Managed processes
• Managed objects
• MIB
6
Introduction & Concepts
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Managed Processes
• Processes which exposes internal management
data.
• We can monitor certain aspects of these
processes.
• Examples: DBMS server(s), recovery server, name
server, communication server(s).
7
Introduction & Concepts – Concepts
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Managed Processes
Introduction & Concepts – Concepts
8Using IMA for monitoring Ingres
Communication
Server
DBMS Server
Recovery Server
Name Server
GEMINIT
AUA-UK 2012
Managed Objects
• Data structures (variables) in managed processes.
• Hold information about the state of the process.
• Value of type integer or varchar.
• Example:
 varchar: query currently being executed by a user
session in a DBMS server
 integer: memory left in Query Storage Facility (QSF)
9
Introduction & Concepts – Concepts
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Managed Objects
Introduction & Concepts – Concepts
10Using IMA for monitoring Ingres
Communication
Server
DBMS Server
Recovery Server
Name Server
GEMINIT
AUA-UK 2012
Managed Objects
• A managed object identified by:
 server: the managed process where it resides
 class: the type of information
‐ effective user name, session identifier,...
 instance: the occurence of a class within a process
‐ the session with identifier 0000000046913793224064
 value: the actual value which is an integer or varchar
‐ session identifier 0000000046913793224064
11
Introduction & Concepts – Concepts
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Management Domain
• Set of managed objects visible to the current
session, i.e. session specific.
• Initially only the DBMS server that a session is
connected with.
• Management domain can be expanded:
 to other processes,
 to all processes in the local node,
 to processes in a remote node.
12
Introduction & Concepts – Concepts
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Management Domain
Introduction & Concepts – Concepts
13Using IMA for monitoring Ingres
Communication
Server
DBMS Server
Recovery Server
Name Server
GEMINIT
AUA-UK 2012
MIB
• = Management Information Base
• Collection of managed objects, presented a a set
of tables.
• A row in a table = an instance.
14
Introduction & Concepts – Concepts
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
MIB
Introduction & Concepts – Concepts
15Using IMA for monitoring Ingres
Communication
Server
DBMS Server
Recovery Server
Name Server
MIB
GEMINIT | Education
© GEMINIT 2012 AUA-UK 2012
Building the MIB
GEMINIT
AUA-UK 2012
Building the MIB
• Creation of an IMA database
• Managed objects
• A simple MIB table
• Meta data about managed objects
• Relationships between MIB tables
• Control objects
• Summary
17Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Creation of an IMA database
• Database owned by $ingres
• Database imadb created automatically
• IMA tables are not normal tables
 Registered tables that map to managed objects
 Registered by user $ingres or ingres
18
Building the MIB
Using IMA for monitoring Ingres
createdb –u’$ingres’ monitordb
GEMINIT
AUA-UK 2012
Managed Objects
• Register table that will show managed objects.
• Table ima_mib_objects in imadb.
• One row for every managed object in the
management domain, i.e. flat table.
19
Building the MIB
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Managed Objects
Building the MIB
20Using IMA for monitoring Ingres
register table mon_mib_objects (
server varchar(64) not null not default
is 'SERVER',
classid varchar(64) not null not default
is 'CLASSID',
instance varchar(64) not null not default
is 'INSTANCE',
value varchar(64) not null not default
is 'VALUE',
perms integer2 not null not default
is 'PERMISSIONS')
as import from 'objects'
with update,
dbms = IMA,
structure = unique sortkeyed,
key = (server, classid, instance);
GEMINIT
AUA-UK 2012
Managed Objects
Building the MIB
21Using IMA for monitoring Ingres
register table mon_mib_objects (
server varchar(64) not null not default
is 'SERVER',
classid varchar(64) not null not default
is 'CLASSID',
instance varchar(64) not null not default
is 'INSTANCE',
value varchar(64) not null not default
is 'VALUE',
perms integer2 not null not default
is 'PERMISSIONS')
as import from 'objects'
with update,
dbms = IMA,
structure = unique sortkeyed,
key = (server, classid, instance);
register table statement
GEMINIT
AUA-UK 2012
Managed Objects
Building the MIB
22Using IMA for monitoring Ingres
data from managed objects/processes
register table mon_mib_objects (
server varchar(64) not null not default
is 'SERVER',
classid varchar(64) not null not default
is 'CLASSID',
instance varchar(64) not null not default
is 'INSTANCE',
value varchar(64) not null not default
is 'VALUE',
perms integer2 not null not default
is 'PERMISSIONS')
as import from 'objects'
with update,
dbms = IMA,
structure = unique sortkeyed,
key = (server, classid, instance);
GEMINIT
AUA-UK 2012
Managed Objects
Building the MIB
23Using IMA for monitoring Ingres
one row per managed object
register table mon_mib_objects (
server varchar(64) not null not default
is 'SERVER',
classid varchar(64) not null not default
is 'CLASSID',
instance varchar(64) not null not default
is 'INSTANCE',
value varchar(64) not null not default
is 'VALUE',
perms integer2 not null not default
is 'PERMISSIONS')
as import from 'objects'
with update,
dbms = IMA,
structure = unique sortkeyed,
key = (server, classid, instance);
GEMINIT
AUA-UK 2012
Managed Objects
Building the MIB
24Using IMA for monitoring Ingres
extended format
register table mon_mib_objects (
server varchar(64) not null not default
is 'SERVER',
classid varchar(64) not null not default
is 'CLASSID',
instance varchar(64) not null not default
is 'INSTANCE',
value varchar(64) not null not default
is 'VALUE',
perms integer2 not null not default
is 'PERMISSIONS')
as import from 'objects'
with update,
dbms = IMA,
structure = unique sortkeyed,
key = (server, classid, instance);
GEMINIT
AUA-UK 2012
Managed Objects
Building the MIB
25Using IMA for monitoring Ingres
permission mask
managed process
class of managed object
instance of managed object
character value of managed object
register table mon_mib_objects (
server varchar(64) not null not default
is 'SERVER',
classid varchar(64) not null not default
is 'CLASSID',
instance varchar(64) not null not default
is 'INSTANCE',
value varchar(64) not null not default
is 'VALUE',
perms integer2 not null not default
is 'PERMISSIONS')
as import from 'objects'
with update,
dbms = IMA,
structure = unique sortkeyed,
key = (server, classid, instance);
GEMINIT
AUA-UK 2012
Managed Objects
Building the MIB
26Using IMA for monitoring Ingres
managed object is
uniquely identified
by server, classid
and instance
register table mon_mib_objects (
server varchar(64) not null not default
is 'SERVER',
classid varchar(64) not null not default
is 'CLASSID',
instance varchar(64) not null not default
is 'INSTANCE',
value varchar(64) not null not default
is 'VALUE',
perms integer2 not null not default
is 'PERMISSIONS')
as import from 'objects'
with update,
dbms = IMA,
structure = unique sortkeyed,
key = (server, classid, instance);
GEMINIT
AUA-UK 2012
Managed Objects
Building the MIB
27Using IMA for monitoring Ingres
some managed objects are
updateable = control objects
register table mon_mib_objects (
server varchar(64) not null not default
is 'SERVER',
classid varchar(64) not null not default
is 'CLASSID',
instance varchar(64) not null not default
is 'INSTANCE',
value varchar(64) not null not default
is 'VALUE',
perms integer2 not null not default
is 'PERMISSIONS')
as import from 'objects'
with update,
dbms = IMA,
structure = unique sortkeyed,
key = (server, classid, instance);
GEMINIT
AUA-UK 2012
Managed Objects
• Ingres 10 on Windows
• Ingres 9.2.1 on Linux (Red Hat)
28
Building the MIB
Using IMA for monitoring Ingres
Server # Objects # Classes
Name Server 1246 124
DBMS Server 31122 1102
Recovery Server 31017 1052
Communication Server 1142 116
Server # Objects # Classes
Name Server 1154 116
DBMS Server 32339 1109
Recovery Server 32418 1050
Communication Server 953 64
Data Access Server 18976 88
GEMINIT
AUA-UK 2012
Managed Objects – Class ids
• Examples:
• Class ids
 form hierarchically structured name space
 levels separated by a period (.)
‐ first level exp: experimental branch
‐ second level: facility (ADF, CLF, DMF, GCF, SCF, ...)
‐ third level: part of facility
29
Building the MIB
Using IMA for monitoring Ingres
exp.adf.adg.dt_name
exp.clf.unix.cs.scb_bio
exp.clf.unix.cs.scb_stk_size
exp.dmf.dm0p.bm_bufcnt
exp.dmf.lg.ldb_d_first_la
exp.gcf.gca.assoc.session_protocol
exp.gcf.gcn.server.class
exp.glf.mo.meta.classid
exp.scf.scs.scb_query
GEMINIT
AUA-UK 2012
Managed Objects – Class ids
• Managed objects per facility (Ingres 10, Linux)
30
Building the MIB
Using IMA for monitoring Ingres
Class id level 2 Count
adf 33464
clf 1965
dmf 11590
gcf 366
glf 17998
gwf 278
psf 2
qsf 60
rdf 292
scf 1099
sxf 25
majority for definitions of data
types, operator and functions
majority for metadata about
managed objects
DMF cache, logging and
locking system, ...
GEMINIT
AUA-UK 2012
Managed Objects – Examples
• exp.scf.scs.scb_query
 exp: experimental
 scf: system control facility (MO is owned by the SCF)
 scs: sequencer (in the scs code block)
 scb: session control block
 query: the current query
31
Building the MIB
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Managed Objects – Examples
• Other examples:
 exp.scf.scs.scb_self: session identifier
 exp.scf.scs.scb_euser: effective user
 exp.scf.scs.scb_database: the database the session is
connected with
 exp.dmf.dm0p.bm_hit: number of DMF cache hits
 exp.dmf.lk.lkd_stat.deadlock: number of deadlocks
32
Building the MIB
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Managed Objects – Instances
Building the MIB
33Using IMA for monitoring Ingres
select instance, value
from mon_mib_objects
where classid = 'exp.scf.scs.scb_self';
+----------------+----------------+
|instance |value |
+----------------+----------------+
|00006984608 |00006984608 |
|00006994400 |00006994400 |
|00007004192 |00007004192 |
|00007013984 |00007013984 |
|00007023776 |00007023776 |
|00007033568 |00007033568 |
|00007043360 |00007043360 |
|00007050816 |00007050816 |
|00007058272 |00007058272 |
|00007065728 |00007065728 |
|00007082080 |00007082080 |
|00007124032 |00007124032 |
|00334561536 |00334561536 |
|00334997824 |00334997824 |
|00342819072 |00342819072 |
+----------------+----------------+
GEMINIT
AUA-UK 2012
Managed Objects – Instances
Building the MIB
34Using IMA for monitoring Ingres
+--------------------------------------+----------------------------------------------------------------+
|classid |value |
+--------------------------------------+----------------------------------------------------------------+
|exp.scf.scs.scb_client_connect |demodb |
|exp.scf.scs.scb_client_host |GEMINIT-FB |
|exp.scf.scs.scb_client_info |user='fb',host='GEMINIT-FB',tty='GEMINIT-FB',pid=8588,conn='demo|
|exp.scf.scs.scb_client_pid |8588 |
|exp.scf.scs.scb_client_tty |GEMINIT-FB |
|exp.scf.scs.scb_client_user |fb |
|exp.scf.scs.scb_database |demodb |
|exp.scf.scs.scb_dblockmode |shared |
|exp.scf.scs.scb_dbowner |fb |
|exp.scf.scs.scb_description |(unknown) |
|exp.scf.scs.scb_euser |fb |
|exp.scf.scs.scb_group | |
|exp.scf.scs.scb_index |00342819072 |
|exp.scf.scs.scb_lastquery | select * from airline |
|exp.scf.scs.scb_pid |00000000000000009296 |
|exp.scf.scs.scb_ptr |00342819072 |
|exp.scf.scs.scb_query | |
|exp.scf.scs.scb_role | |
|exp.scf.scs.scb_ruser |fb |
|exp.scf.scs.scb_s_name |fb |
|exp.scf.scs.scb_self |00342819072 |
|exp.scf.scs.scb_terminal |console |
...
+--------------------------------------+----------------------------------------------------------------+
select classid, value
from mon_mib_objects
where classid like 'exp.scf.scs.scb_%'
and instance = '00342819072' order by 1;
GEMINIT
AUA-UK 2012
A simple MIB table
• Managed object values of the same instance
become values in columns.
• These tables are called crosstabs.
35
Building the MIB
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
A simple MIB table
Building the MIB
36Using IMA for monitoring Ingres
register table statement
register table mon_sessions_simple (
server varchar(64) not null not default
is 'SERVER',
session_id varchar(32) not null not default
is 'exp.scf.scs.scb_self',
effective_user varchar(32) not null not default
is 'exp.scf.scs.scb_euser',
db_name varchar(32) not null not default
is 'exp.scf.scs.scb_database',
session_query varchar(1000) not null not default
is 'exp.scf.scs.scb_query')
as import from 'tables'
with dbms = IMA,
structure = unique sortkeyed,
key = (server, session_id);
GEMINIT
AUA-UK 2012
A simple MIB table
Building the MIB
37Using IMA for monitoring Ingres
crosstab
register table mon_sessions_simple (
server varchar(64) not null not default
is 'SERVER',
session_id varchar(32) not null not default
is 'exp.scf.scs.scb_self',
effective_user varchar(32) not null not default
is 'exp.scf.scs.scb_euser',
db_name varchar(32) not null not default
is 'exp.scf.scs.scb_database',
session_query varchar(1000) not null not default
is 'exp.scf.scs.scb_query')
as import from 'tables'
with dbms = IMA,
structure = unique sortkeyed,
key = (server, session_id);
GEMINIT
AUA-UK 2012
A simple MIB table
Building the MIB
38Using IMA for monitoring Ingres
class ids
managed process
register table mon_sessions_simple (
server varchar(64) not null not default
is 'SERVER',
session_id varchar(32) not null not default
is 'exp.scf.scs.scb_self',
effective_user varchar(32) not null not default
is 'exp.scf.scs.scb_euser',
db_name varchar(32) not null not default
is 'exp.scf.scs.scb_database',
session_query varchar(1000) not null not default
is 'exp.scf.scs.scb_query')
as import from 'tables'
with dbms = IMA,
structure = unique sortkeyed,
key = (server, session_id);
GEMINIT
AUA-UK 2012
A simple MIB table
Building the MIB
39Using IMA for monitoring Ingres
session uniquely
identified by server
process and session id
register table mon_sessions_simple (
server varchar(64) not null not default
is 'SERVER',
session_id varchar(32) not null not default
is 'exp.scf.scs.scb_self',
effective_user varchar(32) not null not default
is 'exp.scf.scs.scb_euser',
db_name varchar(32) not null not default
is 'exp.scf.scs.scb_database',
session_query varchar(1000) not null not default
is 'exp.scf.scs.scb_query')
as import from 'tables'
with dbms = IMA,
structure = unique sortkeyed,
key = (server, session_id);
GEMINIT
AUA-UK 2012
A simple MIB table
Building the MIB
40Using IMA for monitoring Ingres
+------------+-------------------------------+---------+------------------------------
|session_id |effective_user |db_name |session_query
+------------+-------------------------------+---------+------------------------------
|00006984608 | <Dead Process Detector> | |
|00006994400 | <Force Abort Thread> | |
|00007004192 | <Group Commit Thread> | |
|00007013984 | <Log Writer> | |
|00007023776 | <Consistency Pt Thread> | |
|00007033568 | <Event Thread> | |
|00007043360 | <WriteBehind 2K> | |
|00007050816 | <WriteBehind 4K> | |
|00007058272 | <WriteBehind 8K> | |
|00007065728 | <Replicator Queue Management> | |
|00007082080 | <Terminator Thread> | |
|00007124032 |$ingres |imadb |
|00334561536 |$ingres |imadb |
|00334997824 |$ingres |monitordb| select session_id, effective_
|00342819072 |fb |demodb |
+------------+-------------------------------+---------+------------------------------
select session_id, effective_user, db_name, session_query
from mon_sessions_simple
GEMINIT
AUA-UK 2012
Meta data on managed objects
• Which managed object classes can be used in
same MIB table?
• Managed objects with class id in namespace
‘exp.glf.mo.meta’ represent meta data on
managed objects.
 glf = General Library Facility
41
Building the MIB
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Meta data on managed objects
• Table registration
42
Building the MIB
Using IMA for monitoring Ingres
register table mon_mo_meta (
server varchar(64) not null not default is 'SERVER',
classid varchar(64) not null not default is 'exp.glf.mo.meta.classid',
class varchar(64) not null not default is 'exp.glf.mo.meta.class',
oid varchar(8) not null not default is 'exp.glf.mo.meta.oid',
perms integer2 not null not default is 'exp.glf.mo.meta.perms',
size integer2 not null not default is 'exp.glf.mo.meta.size',
xindex varchar(64) not null not default is 'exp.glf.mo.meta.index')
as import from 'tables'
with dbms = IMA,
structure = unique sortkeyed,
key = (server, classid);
GEMINIT
AUA-UK 2012
Meta data on managed objects
Building the MIB
43Using IMA for monitoring Ingres
select classid, perms, size, xindex
from mon_mo_meta
where classid like 'exp.scf.scs_scb_%' order by 1;
+--------------------------------------+------+------+-----------------------+
|classid |perms |size |xindex |
+--------------------------------------+------+------+-----------------------+
|exp.scf.scs.scb_client_connect | 9362| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_client_host | 9362| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_client_info | 9362| 4|exp.scf.scs.scb_index |
|exp.scf.scs.scb_client_pid | 9362| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_client_tty | 9362| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_client_user | 9362| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_connect_limit | 9362| 4|exp.scf.scs.scb_index |
|exp.scf.scs.scb_crash_session | 28050| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_database | 9362| 32|exp.scf.scs.scb_index |
|exp.scf.scs.scb_description | 8192| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_euser | 9362| 32|exp.scf.scs.scb_index |
|exp.scf.scs.scb_facility_index | 9362| 4|exp.scf.scs.scb_index |
|exp.scf.scs.scb_facility_name | 9362| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_gca_assoc_id | 9362| 4|exp.scf.scs.scb_index |
|exp.scf.scs.scb_group | 9362| 32|exp.scf.scs.scb_index |
|exp.scf.scs.scb_index | 9362| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_lastquery | 8192| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_pid | 9362| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_query | 8192| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_remove_session | 28050| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_role | 9362| 32|exp.scf.scs.scb_index |
|exp.scf.scs.scb_ruser | 9362| 32|exp.scf.scs.scb_index |
|exp.scf.scs.scb_self | 9362| 0|exp.scf.scs.scb_index |
|exp.scf.scs.scb_terminal | 9362| 16|exp.scf.scs.scb_index |
...
+--------------------------------------+------+------+-----------------------+
GEMINIT
AUA-UK 2012
Meta data on managed objects
• Managed object classes which have same xindex
can be used in same MIB table.
44
Building the MIB
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Relationships between MIB tables
• Example from imadb
45
Building the MIB
Using IMA for monitoring Ingres
ima_locklists
vnode
locklist_id
locklist_logical_count
locklist_status
locklist_lock_count
locklist_max_locks
locklist_name0
locklist_name1
locklist_server_pid (FK)
locklist_session_id (FK)
locklist_wait_id
locklist_related_llb
locklist_related_llb_id_id
locklist_related_count
ima_server_sessions
server
session_id
session_ptr
effective_user
real_user
db_name
db_owner
db_lock
server_facility
session_activity
activity_detail
session_query
session_terminal
session_group
session_role
client_host
client_pid
client_terminal
client_user
client_connect_string
client_info
application_code
session_name
server_pid
ima_locks
vnode (FK)
lock_id
lock_request_mode
lock_grant_mode
lock_state
lock_attributes
resource_id
locklist_id (FK)
ima_resources
vnode (FK)
resource_id
resource_grant_mode
resource_convert_mode
resource_key
resource_type
resource_database_id
resource_table_id
resource_index_id
resource_page_number
resource_row_id
resource_key6
resource_lock_id0
resource_lock_id1
resource_invalid
lock_id (FK)
GEMINIT
AUA-UK 2012
Control objects
• Permissions column in mon_mib_objects and
mon_mo_meta: who can read/write.
• Some examples of managed objects that can be
updated:
 exp.scf.scs.scb_remove_session
remove a session on a DBMS server
 exp.gwf.gwm.session.control.add_vnode
add process of a vnode to the management domain
 exp.scf.scd.server.control.shut
set a DBMS server shut
46
Building the MIB
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Control objects - Example
• Add all processes in local instance to
management domain (ex. in imadb)
47
Building the MIB
Using IMA for monitoring Ingres
UPDATE ima_mib_objects
SET value = DBMSINFO(‘IMA_VNODE’)
WHERE classid = ‘exp.gwf.gwm.session.control.add_vnode’
AND instance = ‘0’
AND server = DBMSINFO(‘IMA_SERVER’);
useful dbmsinfo parameters:
• ima_vnode
• ima_session
• ima_server
GEMINIT
AUA-UK 2012
Control objects - Procedures
• To simplify using some of these control objects, in
the imadb database you’ll find some database
procedures:
 ima_remove_session(session_id, server_id)
 ima_shut_server(server_id)
48
Building the MIB
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Summary
• Determine which information is required.
• Identify the management objects of interest
using the tables:
 mon_mib_objects (ima_mib_objects in imadb),
 mon_mo_meta (check same xindex) (ima_mo_meta).
• Identify the primary key for the MIB table, which
uniquely identifies each instance.
• Identify the relationships between MIB tables, so
you know how to join.
• Register a table.
49
Building the MIB
Using IMA for monitoring Ingres
GEMINIT | Education
© GEMINIT 2012 AUA-UK 2012
Using the MIB for monitoring
GEMINIT
AUA-UK 2012
Using the MIB for monitoring
• Monitoring
• Real-time data
• Historical data
• Alerts
51Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Monitoring
• Different levels of detail:
 summarized/aggregated:
‐ number of inbound and outbound connections per
communication server,
‐ number of active transactions,
‐ etc.
 fully detailed:
‐ list of queries being executed,
‐ list of database procedures in QSF cache,
‐ list of locks,
‐ etc.
52
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Monitoring
• Different ways to present:
 textual: formatted text,
 tabular: rows in a table,
 graphical: gauges, pie charts, bar charts, ...
53
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Real-time data
• MIB tables show only real-time information:
 reads are dirty,
 no transaction control on MIB tables (no locking).
• Information presented in real-time monitoring
reflects current status.
• Retrieve data from the IMA tables and present it.
• Examples:
 list of queries currently being executed,
 list of current inbound connections on
communication server vs maximum possible,
 etc.
54
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Historical data
• Keep record of historical data ourselves
• At regular time intervals, insert data from IMA
tables into “normal” tables: trace
• Useful for trend analysis, after-the-fact
analysis, etc.
55
Using the MIB for monitoring
Using IMA for monitoring Ingres
time
trace 1 trace 2 trace 3 trace 4 trace 5 trace 6 trace 7
GEMINIT
AUA-UK 2012
Historical data – simple tracing
• Trace = simple insert from select on MIB table(s)
into normal table.
• Have unique key for each row inserted.
• Examples:
 DMF cache tracing,
monitor the evolution of DMF cache info/stats,
 QSF and RDF cache tracing,
 number of inbound connections per communication
server,
 etc.
56
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Historical data – simple tracing - example
• DMF cache tracing: at each trace
 insert current cache statistics to a trace table
57
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Historical data – simple tracing - example
• Step 1. Create trace table
• Step 2. Create sequence for counter
58
Using the MIB for monitoring
Using IMA for monitoring Ingres
create table trc_dmf_cache_stats as
select trc_counter = int4(0),
trc_timestamp = date('now'),
s.*
from ima_dmf_cache_stats s
where 1 = 0;
create sequence trc_counter_dmf_cache
as integer4
start with 1
increment by 1
nomaxvalue
nocache;
GEMINIT
AUA-UK 2012
Historical data – simple tracing - example
• Step 3. Create the trace procedure
• Step 4. Perform trace (at regular intervals)
• Step 5. Present/analyse the traced data
59
Using the MIB for monitoring
Using IMA for monitoring Ingres
create procedure do_trace_dmf_cache_status =
declare
counter = integer4 not null not default;
begin
counter = next value for trc_counter_dmf_cache;
insert into trc_dmf_cache_stats
select :counter,
date('now'),
s.*
from ima_dmf_cache_stats s;
commit;
end;
execute procedure do_trace_dmf_cache_status;
GEMINIT
AUA-UK 2012
Historical – advanced tracing
• Trace = more than a simple insert.
• Examples:
 keeping track of how long a transaction is active,
 keeping track of how long a transaction blocks other
transactions,
 keeping track of how long a resource is locked by a
session.
• Add some analysis to the trace.
60
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Historical – advanced tracing – example
• Query duration tracing: at each trace
 Check if query was there during previous trace:
‐ if not, then insert the query in the tracing table,
‐ if it was, then update the duration of the query in the trace
table.
 Optional:
‐ Move ended queries to a history table.
‐ Delete ended queries that did not take longer than a given
number of seconds.
61
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Historical – advanced tracing – example
• Step 1. Register the MIB table
• Step 2. Create the trace table
62
Using the MIB for monitoring
Using IMA for monitoring Ingres
register table mon_queries (
server varchar(64) not null not default is 'SERVER',
session_id varchar(32) not null not default is 'exp.scf.scs.scb_self',
effective_user varchar(32) not null not default is 'exp.scf.scs.scb_euser',
db_name varchar(32) not null not default is 'exp.scf.scs.scb_database',
session_query varchar(1000) not null not default is 'exp.scf.scs.scb_query')
as import from 'tables'
with dbms = IMA,
structure = unique sortkeyed,
key = (server, session_id);
create table trc_queries as
select begin_counter = int4(0),
begin_timestamp = date('now'),
end_counter = int4(0),
end_timestamp = date('now'),
q.*
from mon_queries q
where 1 = 0;
GEMINIT
AUA-UK 2012
Historical – advanced tracing – example
• Step 3. Create sequence for counter
• Step 4. Create the trace procedure (part 1)
63
Using the MIB for monitoring
Using IMA for monitoring Ingres
create sequence trc_counter_queries
as integer4
start with 1
increment by 1
nomaxvalue
nocache;
create procedure do_trace_queries =
declare
counter = integer4 not null not default;
begin
counter = next value for trc_counter_dmf_cache;
update trc_queries t
from mon_queries q
set end_counter = :counter,
end_timestamp = date('now')
where t.session_id = q.session_id
and t.session_query = q.session_query
and q.session_query != ''
and q.session_id != dbmsinfo('ima_session');
set end counter and
timestamp for queries
that were running at
previous trace
GEMINIT
AUA-UK 2012
Historical – advanced tracing – example
• Step 4. Create the trace procedure (part 2)
64
Using the MIB for monitoring
Using IMA for monitoring Ingres
insert into trc_queries
select :counter,
date('now'),
:counter,
date('now'),
q.*
from mon_queries q
where q.session_query != ''
and q.session_id != dbmsinfo('ima_session')
and not exists (
select *
from trc_queries t
where t.session_id = q.session_id
and t.session_query = q.session_query
and t.end_counter = :counter);
delete from trc_queries
where end_counter = :counter - 1
and interval('sec',
end_timestamp - begin_timestamp) < 30;
commit;
end;
insert queries that
were not running
at previous trace
remove queries
not running longer
than 30 seconds
GEMINIT
AUA-UK 2012
Historical – advanced tracing – example
• Step 5. Perform the trace
• Step 6. Present/analyse the traced data
65
Using the MIB for monitoring
Using IMA for monitoring Ingres
execute procedure do_trace_queries;
GEMINIT
AUA-UK 2012
Alerts
• Triggered when predefined conditions are met.
• Action(s) performed when triggered.
• Can use
 current IMA data (no tracing),
 historical data (with tracing):
‐ check for conditions after each trace.
• Implemented using scripting/programming
language:
 “external” actions cannot be executed in database
procedure.
66
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Alerts - Examples
• Conditions:
 a query taking longer than a given number of
seconds,
 the number of inbound connections on a
communication server exceeding 90% of the
maximum,
 a transaction blocking other transactions for more
than a given number of seconds,
 the hit ratio of a DMF cache dropping under a given
percentage,
 etc.
67
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT
AUA-UK 2012
Alerts - Examples
• Actions:
 sending an e-mail or any type of message,
 removing the blocking session,
 updating the status on a central monitoring
dashboard,
 etc.
68
Using the MIB for monitoring
Using IMA for monitoring Ingres
GEMINIT | Education
© GEMINIT 2012 AUA-UK 2012
Case: lockman
GEMINIT
AUA-UK 2012
Lockman
• A tool to trace and analyze (b)locking problems:
 detailed information about blocking problems is
stored in tables for further analysis.
• This is a commercial tool developed by GEMINIT!
 contact lockman@geminit.be for further information
• A few customers are already using it in
production!
 helps to find
‐ missing commits/rollbacks,
‐ missing indexes,
‐ long queries,
‐ long transactions.
Using IMA for monitoring Ingres 70
GEMINIT
AUA-UK 2012
Lockman
• Modes:
 real-time: analysis of current situation
 tracing (as service):
‐ keeps history of (b)locking problems
‐ support for analysis of history
• 2 levels of detail
 summary
 full detail
• Interface:
 command line interface
 web interface in pipeline
Using IMA for monitoring Ingres 71
GEMINIT
AUA-UK 2012
Blocking hierarchies
Session A1
Session B1 Session C1
Session D1 Session E1
Session F1 Session G1
blocks blocks
blocks blocks
blocks blocks
root sessions
Session A2
Session B2 Session C2
Session E2
blocks blocks
blocks
Using IMA for monitoring Ingres 72
GEMINIT
AUA-UK 2012
Lockman features
• Real-time
 Which sessions/transactions are currently blocking
other sessions/transactions?
 Which sessions/transactions are currently blocked by
other sessions/transactions?
 Which are the root blocking sessions?
 Show blocking hierarchy.
 What resources are locked by a session?
 Remove root blocking session.
Using IMA for monitoring Ingres 73
GEMINIT
AUA-UK 2012
Lockman features
• Analysis of tracing results
 Which sessions/transactions were blocking other
sessions/transactions?
 Which sessions/transactions were blocked by other
sessions/transactions?
 Which were the root blocking sessions?
 What resources were locked by a session?
Using IMA for monitoring Ingres 74
GEMINIT
AUA-UK 2012
Lockman features
• Filter results during analysis:
 on database,
 on table,
 on time.
• Support for archiving of historal data.
• Support for include scripts:
 contain lockman commands.
• Support for command aliases:
 e.g. to translate, for command shortcuts.
• Commands and output can be logged (by default)
for later analysis.
Using IMA for monitoring Ingres 75
GEMINIT
AUA-UK 2012
Lockman features
• Alerter
 Types:
‐ root blocking session,
‐ blocking session,
‐ blocked session,
‐ Query.
 Condition:
‐ longer than given number of seconds.
 Action:
‐ execute lockman command(s),
‐ run shell script, e.g. to send an e-mail.
Using IMA for monitoring Ingres 76
GEMINIT
AUA-UK 2012
Lockman output example
77Using IMA for monitoring Ingres
ROOT LOCKING SESSION(S):
DATABASE dbserver.dba.mydatabase
********************************
-----------------------------------------------------------------------------------------------
* SESSION id: 0000000046913824268416 terminal: batch
real user: sarah effective user: sarah
group: role:
description: (unknown)
CLIENT host: KCTXVS02 user: sarah
process id: 149560 terminal: KCTXVS02
connect string: prod::mydatabase
TRANSACTION id: 00004F72570D9E48
+ SESSION(S) BLOCKED BY TRANSACTION
- RESOURCE id: 1016 TABLE mydatabase.dba.mytable
key: KEY(TABLE,DB=4F8D9A0F,TABLE=[852,0])
lock granted: exclusive, requested: exclusive, state: granted
QUERY description: (unknown)
current query:
previous query: UPDATE mytable SET col3 = 'X' WHERE col3 = 'A'
BLOCKED SESSION(S)
. SESSION id: 0000000046913823834624 terminal: batch
real user: john effective user: john
group: role:
description: (unknown)
CLIENT host: KCTXVS01 user: john
process id: 149561 terminal: KCTXVS01
connect string: PROD::mydatabase/INGRES
TRANSACTION id: 00004F72570D9E86
QUERY description: (unknown)
current query: SELECT col1, col2 FROM mytable
previous query: SELECT col1, col2 FROM mytable2
RESOURCE id: 1016 TABLE mydatabase.dba.mytable
key: KEY(TABLE,DB=4F8D9A0F,TABLE=[852,0])
lock granted: null, requested: intended shared, state: waiting
GEMINIT | Education
© GEMINIT 2012 AUA-UK 2012
The End – Thank You!

More Related Content

Similar to Using IMA for monitoring Ingres

Sybase BAM Overview
Sybase BAM OverviewSybase BAM Overview
Sybase BAM Overview
Xu Jiang
 
OSMC 2021 | Still directing the director… and more!
OSMC 2021 | Still directing the director… and more!OSMC 2021 | Still directing the director… and more!
OSMC 2021 | Still directing the director… and more!
NETWAYS
 
Nagios Conference 2012 - Mike Weber - disaster
Nagios Conference 2012 - Mike Weber - disasterNagios Conference 2012 - Mike Weber - disaster
Nagios Conference 2012 - Mike Weber - disaster
Nagios
 
Monitoring und Metriken im Wunderland
Monitoring und Metriken im WunderlandMonitoring und Metriken im Wunderland
Monitoring und Metriken im Wunderland
D
 
Building a devops CMDB
Building a devops CMDBBuilding a devops CMDB
Building a devops CMDB
Jaime Valero de Bernabé
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aop
Dror Helper
 
CQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSICQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSI
Elogic Magento Development
 
CQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSICQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSI
Igor Miniailo
 
Advanced APM .NET Hands-On Lab - AppSphere16
Advanced APM .NET Hands-On Lab - AppSphere16Advanced APM .NET Hands-On Lab - AppSphere16
Advanced APM .NET Hands-On Lab - AppSphere16
AppDynamics
 
CMDB Building Blocks
CMDB Building BlocksCMDB Building Blocks
CMDB Building Blocks
Joshua Schuller
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.js
Return on Intelligence
 
Auto inspection lot creation and Auto Usage decision for required parts
Auto inspection lot creation and Auto Usage decision for required partsAuto inspection lot creation and Auto Usage decision for required parts
Auto inspection lot creation and Auto Usage decision for required parts
Akshath L.T
 
Data Driven Security in SSAS
Data Driven Security in SSASData Driven Security in SSAS
Data Driven Security in SSAS
Mike Duffy
 
IBM-QRadar-Corporate-Online-Training.
IBM-QRadar-Corporate-Online-Training.IBM-QRadar-Corporate-Online-Training.
IBM-QRadar-Corporate-Online-Training.
Avishek Priyadarshi
 
IMCSummit 2015 - Day 1 Developer Track - Implementing Operational Intelligenc...
IMCSummit 2015 - Day 1 Developer Track - Implementing Operational Intelligenc...IMCSummit 2015 - Day 1 Developer Track - Implementing Operational Intelligenc...
IMCSummit 2015 - Day 1 Developer Track - Implementing Operational Intelligenc...
In-Memory Computing Summit
 
Ensure The Success of VMware Horizon View Deployments
Ensure The Success of VMware Horizon View DeploymentsEnsure The Success of VMware Horizon View Deployments
Ensure The Success of VMware Horizon View Deployments
eG Innovations
 
Cloud Iris Verifcation System
Cloud Iris Verifcation SystemCloud Iris Verifcation System
Cloud Iris Verifcation System
Mohamed Refaei
 
How Pixid dropped Oracle and went hybrid with MariaDB
How Pixid dropped Oracle and went hybrid with MariaDBHow Pixid dropped Oracle and went hybrid with MariaDB
How Pixid dropped Oracle and went hybrid with MariaDB
MariaDB plc
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
Mahmoud Hamed Mahmoud
 
Crash course in Kubernetes monitoring
Crash course in Kubernetes monitoringCrash course in Kubernetes monitoring
Crash course in Kubernetes monitoring
Robert Munteanu
 

Similar to Using IMA for monitoring Ingres (20)

Sybase BAM Overview
Sybase BAM OverviewSybase BAM Overview
Sybase BAM Overview
 
OSMC 2021 | Still directing the director… and more!
OSMC 2021 | Still directing the director… and more!OSMC 2021 | Still directing the director… and more!
OSMC 2021 | Still directing the director… and more!
 
Nagios Conference 2012 - Mike Weber - disaster
Nagios Conference 2012 - Mike Weber - disasterNagios Conference 2012 - Mike Weber - disaster
Nagios Conference 2012 - Mike Weber - disaster
 
Monitoring und Metriken im Wunderland
Monitoring und Metriken im WunderlandMonitoring und Metriken im Wunderland
Monitoring und Metriken im Wunderland
 
Building a devops CMDB
Building a devops CMDBBuilding a devops CMDB
Building a devops CMDB
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aop
 
CQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSICQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSI
 
CQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSICQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSI
 
Advanced APM .NET Hands-On Lab - AppSphere16
Advanced APM .NET Hands-On Lab - AppSphere16Advanced APM .NET Hands-On Lab - AppSphere16
Advanced APM .NET Hands-On Lab - AppSphere16
 
CMDB Building Blocks
CMDB Building BlocksCMDB Building Blocks
CMDB Building Blocks
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.js
 
Auto inspection lot creation and Auto Usage decision for required parts
Auto inspection lot creation and Auto Usage decision for required partsAuto inspection lot creation and Auto Usage decision for required parts
Auto inspection lot creation and Auto Usage decision for required parts
 
Data Driven Security in SSAS
Data Driven Security in SSASData Driven Security in SSAS
Data Driven Security in SSAS
 
IBM-QRadar-Corporate-Online-Training.
IBM-QRadar-Corporate-Online-Training.IBM-QRadar-Corporate-Online-Training.
IBM-QRadar-Corporate-Online-Training.
 
IMCSummit 2015 - Day 1 Developer Track - Implementing Operational Intelligenc...
IMCSummit 2015 - Day 1 Developer Track - Implementing Operational Intelligenc...IMCSummit 2015 - Day 1 Developer Track - Implementing Operational Intelligenc...
IMCSummit 2015 - Day 1 Developer Track - Implementing Operational Intelligenc...
 
Ensure The Success of VMware Horizon View Deployments
Ensure The Success of VMware Horizon View DeploymentsEnsure The Success of VMware Horizon View Deployments
Ensure The Success of VMware Horizon View Deployments
 
Cloud Iris Verifcation System
Cloud Iris Verifcation SystemCloud Iris Verifcation System
Cloud Iris Verifcation System
 
How Pixid dropped Oracle and went hybrid with MariaDB
How Pixid dropped Oracle and went hybrid with MariaDBHow Pixid dropped Oracle and went hybrid with MariaDB
How Pixid dropped Oracle and went hybrid with MariaDB
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 
Crash course in Kubernetes monitoring
Crash course in Kubernetes monitoringCrash course in Kubernetes monitoring
Crash course in Kubernetes monitoring
 

Using IMA for monitoring Ingres

  • 1. GEMINIT | Education © GEMINIT 2012 AUA-UK 2012 Frédéric Barbier frederic.barbier@geminit.be Using IMA for monitoring Ingres AUA-UK Conference June 19th 2012, London
  • 2. GEMINIT AUA-UK 2012 This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/3.0/. Disclaimer Representations, warranties and disclaimer. Unless otherwise mutually agreed to by the parties in writing, GEMINIT bvba offers this documentation as-is and makes no representations or warranties of any kind concerning the work, express, implied, statutory or otherwise, including, without limitation, warranties of title, merchantability, fitness for a particular purpose, noninfringement, or the absence of latent or other defects, accuracy, or the presence of absence of errors, whether or not discoverable. Limitation on liability. Except to the extent required by applicable law, in no event will GEMINIT bvba be liable to you on any legal theory for any special, incidental, consequential, punitive or exemplary damages arising out of this license or the use of the work, even if GEMINIT bvba has been advised of the possibility of such damages. Using IMA for monitoring Ingres 2
  • 3. GEMINIT AUA-UK 2012 Using IMA for monitoring Ingres • Introduction & Concepts • Building the MIB • Using the MIB for monitoring • Case: lockman Using IMA for monitoring Ingres 3
  • 4. GEMINIT | Education © GEMINIT 2012 AUA-UK 2012 Introduction & Concepts
  • 5. GEMINIT AUA-UK 2012 What is the IMA? • = Ingres Management Architecture • Provides access to Ingres process related information through SQL  select  update (limited) • Gateway • imadb database created at installation  select * from ima_server_sessions Introduction & Concepts Using IMA for monitoring Ingres 5
  • 6. GEMINIT AUA-UK 2012 A few concepts • Managed processes • Managed objects • MIB 6 Introduction & Concepts Using IMA for monitoring Ingres
  • 7. GEMINIT AUA-UK 2012 Managed Processes • Processes which exposes internal management data. • We can monitor certain aspects of these processes. • Examples: DBMS server(s), recovery server, name server, communication server(s). 7 Introduction & Concepts – Concepts Using IMA for monitoring Ingres
  • 8. GEMINIT AUA-UK 2012 Managed Processes Introduction & Concepts – Concepts 8Using IMA for monitoring Ingres Communication Server DBMS Server Recovery Server Name Server
  • 9. GEMINIT AUA-UK 2012 Managed Objects • Data structures (variables) in managed processes. • Hold information about the state of the process. • Value of type integer or varchar. • Example:  varchar: query currently being executed by a user session in a DBMS server  integer: memory left in Query Storage Facility (QSF) 9 Introduction & Concepts – Concepts Using IMA for monitoring Ingres
  • 10. GEMINIT AUA-UK 2012 Managed Objects Introduction & Concepts – Concepts 10Using IMA for monitoring Ingres Communication Server DBMS Server Recovery Server Name Server
  • 11. GEMINIT AUA-UK 2012 Managed Objects • A managed object identified by:  server: the managed process where it resides  class: the type of information ‐ effective user name, session identifier,...  instance: the occurence of a class within a process ‐ the session with identifier 0000000046913793224064  value: the actual value which is an integer or varchar ‐ session identifier 0000000046913793224064 11 Introduction & Concepts – Concepts Using IMA for monitoring Ingres
  • 12. GEMINIT AUA-UK 2012 Management Domain • Set of managed objects visible to the current session, i.e. session specific. • Initially only the DBMS server that a session is connected with. • Management domain can be expanded:  to other processes,  to all processes in the local node,  to processes in a remote node. 12 Introduction & Concepts – Concepts Using IMA for monitoring Ingres
  • 13. GEMINIT AUA-UK 2012 Management Domain Introduction & Concepts – Concepts 13Using IMA for monitoring Ingres Communication Server DBMS Server Recovery Server Name Server
  • 14. GEMINIT AUA-UK 2012 MIB • = Management Information Base • Collection of managed objects, presented a a set of tables. • A row in a table = an instance. 14 Introduction & Concepts – Concepts Using IMA for monitoring Ingres
  • 15. GEMINIT AUA-UK 2012 MIB Introduction & Concepts – Concepts 15Using IMA for monitoring Ingres Communication Server DBMS Server Recovery Server Name Server MIB
  • 16. GEMINIT | Education © GEMINIT 2012 AUA-UK 2012 Building the MIB
  • 17. GEMINIT AUA-UK 2012 Building the MIB • Creation of an IMA database • Managed objects • A simple MIB table • Meta data about managed objects • Relationships between MIB tables • Control objects • Summary 17Using IMA for monitoring Ingres
  • 18. GEMINIT AUA-UK 2012 Creation of an IMA database • Database owned by $ingres • Database imadb created automatically • IMA tables are not normal tables  Registered tables that map to managed objects  Registered by user $ingres or ingres 18 Building the MIB Using IMA for monitoring Ingres createdb –u’$ingres’ monitordb
  • 19. GEMINIT AUA-UK 2012 Managed Objects • Register table that will show managed objects. • Table ima_mib_objects in imadb. • One row for every managed object in the management domain, i.e. flat table. 19 Building the MIB Using IMA for monitoring Ingres
  • 20. GEMINIT AUA-UK 2012 Managed Objects Building the MIB 20Using IMA for monitoring Ingres register table mon_mib_objects ( server varchar(64) not null not default is 'SERVER', classid varchar(64) not null not default is 'CLASSID', instance varchar(64) not null not default is 'INSTANCE', value varchar(64) not null not default is 'VALUE', perms integer2 not null not default is 'PERMISSIONS') as import from 'objects' with update, dbms = IMA, structure = unique sortkeyed, key = (server, classid, instance);
  • 21. GEMINIT AUA-UK 2012 Managed Objects Building the MIB 21Using IMA for monitoring Ingres register table mon_mib_objects ( server varchar(64) not null not default is 'SERVER', classid varchar(64) not null not default is 'CLASSID', instance varchar(64) not null not default is 'INSTANCE', value varchar(64) not null not default is 'VALUE', perms integer2 not null not default is 'PERMISSIONS') as import from 'objects' with update, dbms = IMA, structure = unique sortkeyed, key = (server, classid, instance); register table statement
  • 22. GEMINIT AUA-UK 2012 Managed Objects Building the MIB 22Using IMA for monitoring Ingres data from managed objects/processes register table mon_mib_objects ( server varchar(64) not null not default is 'SERVER', classid varchar(64) not null not default is 'CLASSID', instance varchar(64) not null not default is 'INSTANCE', value varchar(64) not null not default is 'VALUE', perms integer2 not null not default is 'PERMISSIONS') as import from 'objects' with update, dbms = IMA, structure = unique sortkeyed, key = (server, classid, instance);
  • 23. GEMINIT AUA-UK 2012 Managed Objects Building the MIB 23Using IMA for monitoring Ingres one row per managed object register table mon_mib_objects ( server varchar(64) not null not default is 'SERVER', classid varchar(64) not null not default is 'CLASSID', instance varchar(64) not null not default is 'INSTANCE', value varchar(64) not null not default is 'VALUE', perms integer2 not null not default is 'PERMISSIONS') as import from 'objects' with update, dbms = IMA, structure = unique sortkeyed, key = (server, classid, instance);
  • 24. GEMINIT AUA-UK 2012 Managed Objects Building the MIB 24Using IMA for monitoring Ingres extended format register table mon_mib_objects ( server varchar(64) not null not default is 'SERVER', classid varchar(64) not null not default is 'CLASSID', instance varchar(64) not null not default is 'INSTANCE', value varchar(64) not null not default is 'VALUE', perms integer2 not null not default is 'PERMISSIONS') as import from 'objects' with update, dbms = IMA, structure = unique sortkeyed, key = (server, classid, instance);
  • 25. GEMINIT AUA-UK 2012 Managed Objects Building the MIB 25Using IMA for monitoring Ingres permission mask managed process class of managed object instance of managed object character value of managed object register table mon_mib_objects ( server varchar(64) not null not default is 'SERVER', classid varchar(64) not null not default is 'CLASSID', instance varchar(64) not null not default is 'INSTANCE', value varchar(64) not null not default is 'VALUE', perms integer2 not null not default is 'PERMISSIONS') as import from 'objects' with update, dbms = IMA, structure = unique sortkeyed, key = (server, classid, instance);
  • 26. GEMINIT AUA-UK 2012 Managed Objects Building the MIB 26Using IMA for monitoring Ingres managed object is uniquely identified by server, classid and instance register table mon_mib_objects ( server varchar(64) not null not default is 'SERVER', classid varchar(64) not null not default is 'CLASSID', instance varchar(64) not null not default is 'INSTANCE', value varchar(64) not null not default is 'VALUE', perms integer2 not null not default is 'PERMISSIONS') as import from 'objects' with update, dbms = IMA, structure = unique sortkeyed, key = (server, classid, instance);
  • 27. GEMINIT AUA-UK 2012 Managed Objects Building the MIB 27Using IMA for monitoring Ingres some managed objects are updateable = control objects register table mon_mib_objects ( server varchar(64) not null not default is 'SERVER', classid varchar(64) not null not default is 'CLASSID', instance varchar(64) not null not default is 'INSTANCE', value varchar(64) not null not default is 'VALUE', perms integer2 not null not default is 'PERMISSIONS') as import from 'objects' with update, dbms = IMA, structure = unique sortkeyed, key = (server, classid, instance);
  • 28. GEMINIT AUA-UK 2012 Managed Objects • Ingres 10 on Windows • Ingres 9.2.1 on Linux (Red Hat) 28 Building the MIB Using IMA for monitoring Ingres Server # Objects # Classes Name Server 1246 124 DBMS Server 31122 1102 Recovery Server 31017 1052 Communication Server 1142 116 Server # Objects # Classes Name Server 1154 116 DBMS Server 32339 1109 Recovery Server 32418 1050 Communication Server 953 64 Data Access Server 18976 88
  • 29. GEMINIT AUA-UK 2012 Managed Objects – Class ids • Examples: • Class ids  form hierarchically structured name space  levels separated by a period (.) ‐ first level exp: experimental branch ‐ second level: facility (ADF, CLF, DMF, GCF, SCF, ...) ‐ third level: part of facility 29 Building the MIB Using IMA for monitoring Ingres exp.adf.adg.dt_name exp.clf.unix.cs.scb_bio exp.clf.unix.cs.scb_stk_size exp.dmf.dm0p.bm_bufcnt exp.dmf.lg.ldb_d_first_la exp.gcf.gca.assoc.session_protocol exp.gcf.gcn.server.class exp.glf.mo.meta.classid exp.scf.scs.scb_query
  • 30. GEMINIT AUA-UK 2012 Managed Objects – Class ids • Managed objects per facility (Ingres 10, Linux) 30 Building the MIB Using IMA for monitoring Ingres Class id level 2 Count adf 33464 clf 1965 dmf 11590 gcf 366 glf 17998 gwf 278 psf 2 qsf 60 rdf 292 scf 1099 sxf 25 majority for definitions of data types, operator and functions majority for metadata about managed objects DMF cache, logging and locking system, ...
  • 31. GEMINIT AUA-UK 2012 Managed Objects – Examples • exp.scf.scs.scb_query  exp: experimental  scf: system control facility (MO is owned by the SCF)  scs: sequencer (in the scs code block)  scb: session control block  query: the current query 31 Building the MIB Using IMA for monitoring Ingres
  • 32. GEMINIT AUA-UK 2012 Managed Objects – Examples • Other examples:  exp.scf.scs.scb_self: session identifier  exp.scf.scs.scb_euser: effective user  exp.scf.scs.scb_database: the database the session is connected with  exp.dmf.dm0p.bm_hit: number of DMF cache hits  exp.dmf.lk.lkd_stat.deadlock: number of deadlocks 32 Building the MIB Using IMA for monitoring Ingres
  • 33. GEMINIT AUA-UK 2012 Managed Objects – Instances Building the MIB 33Using IMA for monitoring Ingres select instance, value from mon_mib_objects where classid = 'exp.scf.scs.scb_self'; +----------------+----------------+ |instance |value | +----------------+----------------+ |00006984608 |00006984608 | |00006994400 |00006994400 | |00007004192 |00007004192 | |00007013984 |00007013984 | |00007023776 |00007023776 | |00007033568 |00007033568 | |00007043360 |00007043360 | |00007050816 |00007050816 | |00007058272 |00007058272 | |00007065728 |00007065728 | |00007082080 |00007082080 | |00007124032 |00007124032 | |00334561536 |00334561536 | |00334997824 |00334997824 | |00342819072 |00342819072 | +----------------+----------------+
  • 34. GEMINIT AUA-UK 2012 Managed Objects – Instances Building the MIB 34Using IMA for monitoring Ingres +--------------------------------------+----------------------------------------------------------------+ |classid |value | +--------------------------------------+----------------------------------------------------------------+ |exp.scf.scs.scb_client_connect |demodb | |exp.scf.scs.scb_client_host |GEMINIT-FB | |exp.scf.scs.scb_client_info |user='fb',host='GEMINIT-FB',tty='GEMINIT-FB',pid=8588,conn='demo| |exp.scf.scs.scb_client_pid |8588 | |exp.scf.scs.scb_client_tty |GEMINIT-FB | |exp.scf.scs.scb_client_user |fb | |exp.scf.scs.scb_database |demodb | |exp.scf.scs.scb_dblockmode |shared | |exp.scf.scs.scb_dbowner |fb | |exp.scf.scs.scb_description |(unknown) | |exp.scf.scs.scb_euser |fb | |exp.scf.scs.scb_group | | |exp.scf.scs.scb_index |00342819072 | |exp.scf.scs.scb_lastquery | select * from airline | |exp.scf.scs.scb_pid |00000000000000009296 | |exp.scf.scs.scb_ptr |00342819072 | |exp.scf.scs.scb_query | | |exp.scf.scs.scb_role | | |exp.scf.scs.scb_ruser |fb | |exp.scf.scs.scb_s_name |fb | |exp.scf.scs.scb_self |00342819072 | |exp.scf.scs.scb_terminal |console | ... +--------------------------------------+----------------------------------------------------------------+ select classid, value from mon_mib_objects where classid like 'exp.scf.scs.scb_%' and instance = '00342819072' order by 1;
  • 35. GEMINIT AUA-UK 2012 A simple MIB table • Managed object values of the same instance become values in columns. • These tables are called crosstabs. 35 Building the MIB Using IMA for monitoring Ingres
  • 36. GEMINIT AUA-UK 2012 A simple MIB table Building the MIB 36Using IMA for monitoring Ingres register table statement register table mon_sessions_simple ( server varchar(64) not null not default is 'SERVER', session_id varchar(32) not null not default is 'exp.scf.scs.scb_self', effective_user varchar(32) not null not default is 'exp.scf.scs.scb_euser', db_name varchar(32) not null not default is 'exp.scf.scs.scb_database', session_query varchar(1000) not null not default is 'exp.scf.scs.scb_query') as import from 'tables' with dbms = IMA, structure = unique sortkeyed, key = (server, session_id);
  • 37. GEMINIT AUA-UK 2012 A simple MIB table Building the MIB 37Using IMA for monitoring Ingres crosstab register table mon_sessions_simple ( server varchar(64) not null not default is 'SERVER', session_id varchar(32) not null not default is 'exp.scf.scs.scb_self', effective_user varchar(32) not null not default is 'exp.scf.scs.scb_euser', db_name varchar(32) not null not default is 'exp.scf.scs.scb_database', session_query varchar(1000) not null not default is 'exp.scf.scs.scb_query') as import from 'tables' with dbms = IMA, structure = unique sortkeyed, key = (server, session_id);
  • 38. GEMINIT AUA-UK 2012 A simple MIB table Building the MIB 38Using IMA for monitoring Ingres class ids managed process register table mon_sessions_simple ( server varchar(64) not null not default is 'SERVER', session_id varchar(32) not null not default is 'exp.scf.scs.scb_self', effective_user varchar(32) not null not default is 'exp.scf.scs.scb_euser', db_name varchar(32) not null not default is 'exp.scf.scs.scb_database', session_query varchar(1000) not null not default is 'exp.scf.scs.scb_query') as import from 'tables' with dbms = IMA, structure = unique sortkeyed, key = (server, session_id);
  • 39. GEMINIT AUA-UK 2012 A simple MIB table Building the MIB 39Using IMA for monitoring Ingres session uniquely identified by server process and session id register table mon_sessions_simple ( server varchar(64) not null not default is 'SERVER', session_id varchar(32) not null not default is 'exp.scf.scs.scb_self', effective_user varchar(32) not null not default is 'exp.scf.scs.scb_euser', db_name varchar(32) not null not default is 'exp.scf.scs.scb_database', session_query varchar(1000) not null not default is 'exp.scf.scs.scb_query') as import from 'tables' with dbms = IMA, structure = unique sortkeyed, key = (server, session_id);
  • 40. GEMINIT AUA-UK 2012 A simple MIB table Building the MIB 40Using IMA for monitoring Ingres +------------+-------------------------------+---------+------------------------------ |session_id |effective_user |db_name |session_query +------------+-------------------------------+---------+------------------------------ |00006984608 | <Dead Process Detector> | | |00006994400 | <Force Abort Thread> | | |00007004192 | <Group Commit Thread> | | |00007013984 | <Log Writer> | | |00007023776 | <Consistency Pt Thread> | | |00007033568 | <Event Thread> | | |00007043360 | <WriteBehind 2K> | | |00007050816 | <WriteBehind 4K> | | |00007058272 | <WriteBehind 8K> | | |00007065728 | <Replicator Queue Management> | | |00007082080 | <Terminator Thread> | | |00007124032 |$ingres |imadb | |00334561536 |$ingres |imadb | |00334997824 |$ingres |monitordb| select session_id, effective_ |00342819072 |fb |demodb | +------------+-------------------------------+---------+------------------------------ select session_id, effective_user, db_name, session_query from mon_sessions_simple
  • 41. GEMINIT AUA-UK 2012 Meta data on managed objects • Which managed object classes can be used in same MIB table? • Managed objects with class id in namespace ‘exp.glf.mo.meta’ represent meta data on managed objects.  glf = General Library Facility 41 Building the MIB Using IMA for monitoring Ingres
  • 42. GEMINIT AUA-UK 2012 Meta data on managed objects • Table registration 42 Building the MIB Using IMA for monitoring Ingres register table mon_mo_meta ( server varchar(64) not null not default is 'SERVER', classid varchar(64) not null not default is 'exp.glf.mo.meta.classid', class varchar(64) not null not default is 'exp.glf.mo.meta.class', oid varchar(8) not null not default is 'exp.glf.mo.meta.oid', perms integer2 not null not default is 'exp.glf.mo.meta.perms', size integer2 not null not default is 'exp.glf.mo.meta.size', xindex varchar(64) not null not default is 'exp.glf.mo.meta.index') as import from 'tables' with dbms = IMA, structure = unique sortkeyed, key = (server, classid);
  • 43. GEMINIT AUA-UK 2012 Meta data on managed objects Building the MIB 43Using IMA for monitoring Ingres select classid, perms, size, xindex from mon_mo_meta where classid like 'exp.scf.scs_scb_%' order by 1; +--------------------------------------+------+------+-----------------------+ |classid |perms |size |xindex | +--------------------------------------+------+------+-----------------------+ |exp.scf.scs.scb_client_connect | 9362| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_client_host | 9362| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_client_info | 9362| 4|exp.scf.scs.scb_index | |exp.scf.scs.scb_client_pid | 9362| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_client_tty | 9362| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_client_user | 9362| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_connect_limit | 9362| 4|exp.scf.scs.scb_index | |exp.scf.scs.scb_crash_session | 28050| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_database | 9362| 32|exp.scf.scs.scb_index | |exp.scf.scs.scb_description | 8192| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_euser | 9362| 32|exp.scf.scs.scb_index | |exp.scf.scs.scb_facility_index | 9362| 4|exp.scf.scs.scb_index | |exp.scf.scs.scb_facility_name | 9362| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_gca_assoc_id | 9362| 4|exp.scf.scs.scb_index | |exp.scf.scs.scb_group | 9362| 32|exp.scf.scs.scb_index | |exp.scf.scs.scb_index | 9362| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_lastquery | 8192| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_pid | 9362| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_query | 8192| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_remove_session | 28050| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_role | 9362| 32|exp.scf.scs.scb_index | |exp.scf.scs.scb_ruser | 9362| 32|exp.scf.scs.scb_index | |exp.scf.scs.scb_self | 9362| 0|exp.scf.scs.scb_index | |exp.scf.scs.scb_terminal | 9362| 16|exp.scf.scs.scb_index | ... +--------------------------------------+------+------+-----------------------+
  • 44. GEMINIT AUA-UK 2012 Meta data on managed objects • Managed object classes which have same xindex can be used in same MIB table. 44 Building the MIB Using IMA for monitoring Ingres
  • 45. GEMINIT AUA-UK 2012 Relationships between MIB tables • Example from imadb 45 Building the MIB Using IMA for monitoring Ingres ima_locklists vnode locklist_id locklist_logical_count locklist_status locklist_lock_count locklist_max_locks locklist_name0 locklist_name1 locklist_server_pid (FK) locklist_session_id (FK) locklist_wait_id locklist_related_llb locklist_related_llb_id_id locklist_related_count ima_server_sessions server session_id session_ptr effective_user real_user db_name db_owner db_lock server_facility session_activity activity_detail session_query session_terminal session_group session_role client_host client_pid client_terminal client_user client_connect_string client_info application_code session_name server_pid ima_locks vnode (FK) lock_id lock_request_mode lock_grant_mode lock_state lock_attributes resource_id locklist_id (FK) ima_resources vnode (FK) resource_id resource_grant_mode resource_convert_mode resource_key resource_type resource_database_id resource_table_id resource_index_id resource_page_number resource_row_id resource_key6 resource_lock_id0 resource_lock_id1 resource_invalid lock_id (FK)
  • 46. GEMINIT AUA-UK 2012 Control objects • Permissions column in mon_mib_objects and mon_mo_meta: who can read/write. • Some examples of managed objects that can be updated:  exp.scf.scs.scb_remove_session remove a session on a DBMS server  exp.gwf.gwm.session.control.add_vnode add process of a vnode to the management domain  exp.scf.scd.server.control.shut set a DBMS server shut 46 Building the MIB Using IMA for monitoring Ingres
  • 47. GEMINIT AUA-UK 2012 Control objects - Example • Add all processes in local instance to management domain (ex. in imadb) 47 Building the MIB Using IMA for monitoring Ingres UPDATE ima_mib_objects SET value = DBMSINFO(‘IMA_VNODE’) WHERE classid = ‘exp.gwf.gwm.session.control.add_vnode’ AND instance = ‘0’ AND server = DBMSINFO(‘IMA_SERVER’); useful dbmsinfo parameters: • ima_vnode • ima_session • ima_server
  • 48. GEMINIT AUA-UK 2012 Control objects - Procedures • To simplify using some of these control objects, in the imadb database you’ll find some database procedures:  ima_remove_session(session_id, server_id)  ima_shut_server(server_id) 48 Building the MIB Using IMA for monitoring Ingres
  • 49. GEMINIT AUA-UK 2012 Summary • Determine which information is required. • Identify the management objects of interest using the tables:  mon_mib_objects (ima_mib_objects in imadb),  mon_mo_meta (check same xindex) (ima_mo_meta). • Identify the primary key for the MIB table, which uniquely identifies each instance. • Identify the relationships between MIB tables, so you know how to join. • Register a table. 49 Building the MIB Using IMA for monitoring Ingres
  • 50. GEMINIT | Education © GEMINIT 2012 AUA-UK 2012 Using the MIB for monitoring
  • 51. GEMINIT AUA-UK 2012 Using the MIB for monitoring • Monitoring • Real-time data • Historical data • Alerts 51Using IMA for monitoring Ingres
  • 52. GEMINIT AUA-UK 2012 Monitoring • Different levels of detail:  summarized/aggregated: ‐ number of inbound and outbound connections per communication server, ‐ number of active transactions, ‐ etc.  fully detailed: ‐ list of queries being executed, ‐ list of database procedures in QSF cache, ‐ list of locks, ‐ etc. 52 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 53. GEMINIT AUA-UK 2012 Monitoring • Different ways to present:  textual: formatted text,  tabular: rows in a table,  graphical: gauges, pie charts, bar charts, ... 53 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 54. GEMINIT AUA-UK 2012 Real-time data • MIB tables show only real-time information:  reads are dirty,  no transaction control on MIB tables (no locking). • Information presented in real-time monitoring reflects current status. • Retrieve data from the IMA tables and present it. • Examples:  list of queries currently being executed,  list of current inbound connections on communication server vs maximum possible,  etc. 54 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 55. GEMINIT AUA-UK 2012 Historical data • Keep record of historical data ourselves • At regular time intervals, insert data from IMA tables into “normal” tables: trace • Useful for trend analysis, after-the-fact analysis, etc. 55 Using the MIB for monitoring Using IMA for monitoring Ingres time trace 1 trace 2 trace 3 trace 4 trace 5 trace 6 trace 7
  • 56. GEMINIT AUA-UK 2012 Historical data – simple tracing • Trace = simple insert from select on MIB table(s) into normal table. • Have unique key for each row inserted. • Examples:  DMF cache tracing, monitor the evolution of DMF cache info/stats,  QSF and RDF cache tracing,  number of inbound connections per communication server,  etc. 56 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 57. GEMINIT AUA-UK 2012 Historical data – simple tracing - example • DMF cache tracing: at each trace  insert current cache statistics to a trace table 57 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 58. GEMINIT AUA-UK 2012 Historical data – simple tracing - example • Step 1. Create trace table • Step 2. Create sequence for counter 58 Using the MIB for monitoring Using IMA for monitoring Ingres create table trc_dmf_cache_stats as select trc_counter = int4(0), trc_timestamp = date('now'), s.* from ima_dmf_cache_stats s where 1 = 0; create sequence trc_counter_dmf_cache as integer4 start with 1 increment by 1 nomaxvalue nocache;
  • 59. GEMINIT AUA-UK 2012 Historical data – simple tracing - example • Step 3. Create the trace procedure • Step 4. Perform trace (at regular intervals) • Step 5. Present/analyse the traced data 59 Using the MIB for monitoring Using IMA for monitoring Ingres create procedure do_trace_dmf_cache_status = declare counter = integer4 not null not default; begin counter = next value for trc_counter_dmf_cache; insert into trc_dmf_cache_stats select :counter, date('now'), s.* from ima_dmf_cache_stats s; commit; end; execute procedure do_trace_dmf_cache_status;
  • 60. GEMINIT AUA-UK 2012 Historical – advanced tracing • Trace = more than a simple insert. • Examples:  keeping track of how long a transaction is active,  keeping track of how long a transaction blocks other transactions,  keeping track of how long a resource is locked by a session. • Add some analysis to the trace. 60 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 61. GEMINIT AUA-UK 2012 Historical – advanced tracing – example • Query duration tracing: at each trace  Check if query was there during previous trace: ‐ if not, then insert the query in the tracing table, ‐ if it was, then update the duration of the query in the trace table.  Optional: ‐ Move ended queries to a history table. ‐ Delete ended queries that did not take longer than a given number of seconds. 61 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 62. GEMINIT AUA-UK 2012 Historical – advanced tracing – example • Step 1. Register the MIB table • Step 2. Create the trace table 62 Using the MIB for monitoring Using IMA for monitoring Ingres register table mon_queries ( server varchar(64) not null not default is 'SERVER', session_id varchar(32) not null not default is 'exp.scf.scs.scb_self', effective_user varchar(32) not null not default is 'exp.scf.scs.scb_euser', db_name varchar(32) not null not default is 'exp.scf.scs.scb_database', session_query varchar(1000) not null not default is 'exp.scf.scs.scb_query') as import from 'tables' with dbms = IMA, structure = unique sortkeyed, key = (server, session_id); create table trc_queries as select begin_counter = int4(0), begin_timestamp = date('now'), end_counter = int4(0), end_timestamp = date('now'), q.* from mon_queries q where 1 = 0;
  • 63. GEMINIT AUA-UK 2012 Historical – advanced tracing – example • Step 3. Create sequence for counter • Step 4. Create the trace procedure (part 1) 63 Using the MIB for monitoring Using IMA for monitoring Ingres create sequence trc_counter_queries as integer4 start with 1 increment by 1 nomaxvalue nocache; create procedure do_trace_queries = declare counter = integer4 not null not default; begin counter = next value for trc_counter_dmf_cache; update trc_queries t from mon_queries q set end_counter = :counter, end_timestamp = date('now') where t.session_id = q.session_id and t.session_query = q.session_query and q.session_query != '' and q.session_id != dbmsinfo('ima_session'); set end counter and timestamp for queries that were running at previous trace
  • 64. GEMINIT AUA-UK 2012 Historical – advanced tracing – example • Step 4. Create the trace procedure (part 2) 64 Using the MIB for monitoring Using IMA for monitoring Ingres insert into trc_queries select :counter, date('now'), :counter, date('now'), q.* from mon_queries q where q.session_query != '' and q.session_id != dbmsinfo('ima_session') and not exists ( select * from trc_queries t where t.session_id = q.session_id and t.session_query = q.session_query and t.end_counter = :counter); delete from trc_queries where end_counter = :counter - 1 and interval('sec', end_timestamp - begin_timestamp) < 30; commit; end; insert queries that were not running at previous trace remove queries not running longer than 30 seconds
  • 65. GEMINIT AUA-UK 2012 Historical – advanced tracing – example • Step 5. Perform the trace • Step 6. Present/analyse the traced data 65 Using the MIB for monitoring Using IMA for monitoring Ingres execute procedure do_trace_queries;
  • 66. GEMINIT AUA-UK 2012 Alerts • Triggered when predefined conditions are met. • Action(s) performed when triggered. • Can use  current IMA data (no tracing),  historical data (with tracing): ‐ check for conditions after each trace. • Implemented using scripting/programming language:  “external” actions cannot be executed in database procedure. 66 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 67. GEMINIT AUA-UK 2012 Alerts - Examples • Conditions:  a query taking longer than a given number of seconds,  the number of inbound connections on a communication server exceeding 90% of the maximum,  a transaction blocking other transactions for more than a given number of seconds,  the hit ratio of a DMF cache dropping under a given percentage,  etc. 67 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 68. GEMINIT AUA-UK 2012 Alerts - Examples • Actions:  sending an e-mail or any type of message,  removing the blocking session,  updating the status on a central monitoring dashboard,  etc. 68 Using the MIB for monitoring Using IMA for monitoring Ingres
  • 69. GEMINIT | Education © GEMINIT 2012 AUA-UK 2012 Case: lockman
  • 70. GEMINIT AUA-UK 2012 Lockman • A tool to trace and analyze (b)locking problems:  detailed information about blocking problems is stored in tables for further analysis. • This is a commercial tool developed by GEMINIT!  contact lockman@geminit.be for further information • A few customers are already using it in production!  helps to find ‐ missing commits/rollbacks, ‐ missing indexes, ‐ long queries, ‐ long transactions. Using IMA for monitoring Ingres 70
  • 71. GEMINIT AUA-UK 2012 Lockman • Modes:  real-time: analysis of current situation  tracing (as service): ‐ keeps history of (b)locking problems ‐ support for analysis of history • 2 levels of detail  summary  full detail • Interface:  command line interface  web interface in pipeline Using IMA for monitoring Ingres 71
  • 72. GEMINIT AUA-UK 2012 Blocking hierarchies Session A1 Session B1 Session C1 Session D1 Session E1 Session F1 Session G1 blocks blocks blocks blocks blocks blocks root sessions Session A2 Session B2 Session C2 Session E2 blocks blocks blocks Using IMA for monitoring Ingres 72
  • 73. GEMINIT AUA-UK 2012 Lockman features • Real-time  Which sessions/transactions are currently blocking other sessions/transactions?  Which sessions/transactions are currently blocked by other sessions/transactions?  Which are the root blocking sessions?  Show blocking hierarchy.  What resources are locked by a session?  Remove root blocking session. Using IMA for monitoring Ingres 73
  • 74. GEMINIT AUA-UK 2012 Lockman features • Analysis of tracing results  Which sessions/transactions were blocking other sessions/transactions?  Which sessions/transactions were blocked by other sessions/transactions?  Which were the root blocking sessions?  What resources were locked by a session? Using IMA for monitoring Ingres 74
  • 75. GEMINIT AUA-UK 2012 Lockman features • Filter results during analysis:  on database,  on table,  on time. • Support for archiving of historal data. • Support for include scripts:  contain lockman commands. • Support for command aliases:  e.g. to translate, for command shortcuts. • Commands and output can be logged (by default) for later analysis. Using IMA for monitoring Ingres 75
  • 76. GEMINIT AUA-UK 2012 Lockman features • Alerter  Types: ‐ root blocking session, ‐ blocking session, ‐ blocked session, ‐ Query.  Condition: ‐ longer than given number of seconds.  Action: ‐ execute lockman command(s), ‐ run shell script, e.g. to send an e-mail. Using IMA for monitoring Ingres 76
  • 77. GEMINIT AUA-UK 2012 Lockman output example 77Using IMA for monitoring Ingres ROOT LOCKING SESSION(S): DATABASE dbserver.dba.mydatabase ******************************** ----------------------------------------------------------------------------------------------- * SESSION id: 0000000046913824268416 terminal: batch real user: sarah effective user: sarah group: role: description: (unknown) CLIENT host: KCTXVS02 user: sarah process id: 149560 terminal: KCTXVS02 connect string: prod::mydatabase TRANSACTION id: 00004F72570D9E48 + SESSION(S) BLOCKED BY TRANSACTION - RESOURCE id: 1016 TABLE mydatabase.dba.mytable key: KEY(TABLE,DB=4F8D9A0F,TABLE=[852,0]) lock granted: exclusive, requested: exclusive, state: granted QUERY description: (unknown) current query: previous query: UPDATE mytable SET col3 = 'X' WHERE col3 = 'A' BLOCKED SESSION(S) . SESSION id: 0000000046913823834624 terminal: batch real user: john effective user: john group: role: description: (unknown) CLIENT host: KCTXVS01 user: john process id: 149561 terminal: KCTXVS01 connect string: PROD::mydatabase/INGRES TRANSACTION id: 00004F72570D9E86 QUERY description: (unknown) current query: SELECT col1, col2 FROM mytable previous query: SELECT col1, col2 FROM mytable2 RESOURCE id: 1016 TABLE mydatabase.dba.mytable key: KEY(TABLE,DB=4F8D9A0F,TABLE=[852,0]) lock granted: null, requested: intended shared, state: waiting
  • 78. GEMINIT | Education © GEMINIT 2012 AUA-UK 2012 The End – Thank You!

Editor's Notes

  1. GLF = General Library Facility