Projet

Général

Profil

Révision ca01c6e3

IDca01c6e3dce214704aa4973bd843e539c632b79c
Parent c51f9d32
Enfant 827c75fb

Ajouté par K.Shimadera il y a presque 9 ans

Update oracle_sysstat_ plugin

  • Add modules
    logon
    cputime
    blockrw
    redosize
    eventwaitnetwork
    eventwaitadministrative
    eventwaitconfiguration
  • Update modules
    cachehit: Changed to calculate hit ratio between munin-node update intervals by CDEF
    sessionwait: Add CPU status, Add graph_info
    table_fetch: Add table_fetch_continued_row field
    pgastat: Add aggregate PGA target parameter field
  • Improvement
    Change not to execute sqlplus in for loop in getvalue funcs to improve performance
    Change to add field.min 0 when type is DERIVE
    Add label_max_length in config() to supress new line in graph image
    Change graph_title for sorting
  • Fix styles
    Enable set -o nounset
    Add double quote to supress shellcheck warning
    Change some quote styles
    Remove meaningless double quote around $( )
    Add whenever sqlerror exit sql.sqlcode

Voir les différences:

plugins/oracle/oracle_sysstat_
7 7

  
8 8
  oracle_sysstat_* - Munin plugin to monitor Oracle Statistics
9 9

  
10
    execute              - To monitor Oracle Sysstat Execute Count
11
    parse                - To monitor Oracle Sysstat Parse Count
12
    tablefetch           - To monitor Oracle Sysstat Table Fetch Rows
13
    tablescan            - To monitor Oracle Sysstat Table Scans
14
    transaction          - To monitor Oracle Sysstat Transactions
15
    sort                 - To monitor Oracle Sysstat Sorts
16
    cursor               - To monitor Oracle Sysstat Open Cursor
17
    enqueue              - To monitor Oracle Sysstat Enqueues
18
    redolog              - To monitor Oracle Sysstat Redo Log
19
    physicaliops         - To monitor Oracle Sysstat Physical I/O Requests
20
    physicalrw           - To monitor Oracle Sysstat Physical Read/Write Bytes
21
    netrw                - To monitor Oracle Sysstat Network Send/Receive Bytes
22
    sgainfo              - To monitor Oracle Memory SGA
23
    pgastat              - To monitor Oracle Memory PGA
24
    cachehit             - To monitor Oracle Cache Hit Ratio
25
    sessionuser          - To monitor Oracle Session Users
26
    sessionwait          - To monitor Oracle Session Wait
27
    eventwait            - To monitor Oracle Wait Events
28
    eventwaitapplication - To monitor Oracle Wait Events Application
29
    eventwaitconcurrency - To monitor Oracle Wait Events Concurrency
30
    eventwaituserio      - To monitor Oracle Wait Events User I/O
31
    eventwaitsystemio    - To monitor Oracle Wait Events System I/O
32
    eventwaitcluster     - To monitor Oracle Wait Events Cluster
33
    tablespace           - To monitor Oracle Table Space Usage
34
    asmusage             - To monitor Oracle ASM Disk Group Usage
10
    execute                 - To monitor Oracle Sysstat SQL Execute Count
11
    parse                   - To monitor Oracle Sysstat SQL Parse Count
12
    tablefetch              - To monitor Oracle Sysstat SQL Table Fetch Rows
13
    tablescan               - To monitor Oracle Sysstat SQL Table Scans
14
    transaction             - To monitor Oracle Sysstat SQL Transactions
15
    sort                    - To monitor Oracle Sysstat SQL Sorts
16
    logon                   - To monitor Oracle Sysstat User Logons
17
    cursor                  - To monitor Oracle Sysstat User Opened Cursors
18
    enqueue                 - To monitor Oracle Sysstat Enqueues
19
    redolog                 - To monitor Oracle Sysstat Redo Entries
20
    redosize                - To monitor Oracle Sysstat Redo Size
21
    physicaliops            - To monitor Oracle Sysstat I/O Physical Requests
22
    physicalrw              - To monitor Oracle Sysstat I/O Physical Bytes
23
    blockrw                 - To monitor Oracle Sysstat I/O Blocks
24
    netrw                   - To monitor Oracle Sysstat I/O Network Bytes
25
    sgainfo                 - To monitor Oracle Memory SGA
26
    pgastat                 - To monitor Oracle Memory PGA
27
    cputime                 - To monitor Oracle CPU Time
28
    cachehit                - To monitor Oracle Cache Hit Ratio
29
    sessionuser             - To monitor Oracle Session Users
30
    sessionwait             - To monitor Oracle Session Wait
31
    eventwait               - To monitor Oracle Wait Events
32
    eventwaitapplication    - To monitor Oracle Wait Events Application
33
    eventwaitnetwork        - To monitor Oracle Wait Events Network
34
    eventwaitconcurrency    - To monitor Oracle Wait Events Concurrency
35
    eventwaituserio         - To monitor Oracle Wait Events User I/O
36
    eventwaitsystemio       - To monitor Oracle Wait Events System I/O
37
    eventwaitcluster        - To monitor Oracle Wait Events Cluster
38
    eventwaitadministrative - To monitor Oracle Wait Events Administrative
39
    eventwaitconfiguration  - To monitor Oracle Wait Events Configuration
40
    tablespace              - To monitor Oracle Table Space Usage
41
    asmusage                - To monitor Oracle ASM Disk Group Usage
35 42

  
36 43
=head1 CONFIGURATION
37 44

  
......
77 84
#%# family=contrib
78 85
#%# capabilities=autoconf suggest
79 86

  
80
# Include plugin.sh
81
. "${MUNIN_LIBDIR}/plugins/plugin.sh"
82

  
83 87
# Like perl 'use strict;' 
84
#set -o nounset
88
set -o nounset
89

  
90
# Include plugin.sh
91
. "${MUNIN_LIBDIR:-}/plugins/plugin.sh"
85 92

  
86 93
# Environments
87 94
: "${ORACLE_HOME:=$( echo /opt/oracle/product/* )}"
......
102 109

  
103 110
key=execute
104 111
global_attrs[$key]="
105
    graph_title Oracle Sysstat Execute Count
112
    graph_title Oracle Sysstat SQL Execute Count
106 113
    graph_category db
107 114
    graph_args --base 1000 --lower-limit 0 --rigid
108 115
    graph_vlabel count per second
109
    graph_info Oracle Sysstat Execute Count
116
    graph_info Oracle Sysstat SQL Execute Count
110 117
"
111 118
data_attrs[$key]="
112
    execute_count    DERIVE LINE execute count
113
    user_calls       DERIVE LINE user calls
114
    recursive_calls  DERIVE LINE recursive calls
119
    execute_count   DERIVE LINE execute count
120
    user_calls      DERIVE LINE user calls
121
    recursive_calls DERIVE LINE recursive calls
115 122
"
116 123
getvalue_func[$key]=getvalue_sysstat
117 124

  
118 125
key=parse
119 126
global_attrs[$key]="
120
    graph_title Oracle Sysstat Parse Count
127
    graph_title Oracle Sysstat SQL Parse Count
121 128
    graph_category db
122 129
    graph_args --base 1000 --lower-limit 0 --rigid
123 130
    graph_vlabel count per second
124
    graph_info Oracle Sysstat Parse Count
131
    graph_info Oracle Sysstat SQL Parse Count
125 132
"
126 133
data_attrs[$key]="
127
    parse_count_total     DERIVE LINE parse count (total)
128
    parse_count_hard      DERIVE LINE parse count (hard)
129
    parse_count_failures  DERIVE LINE parse count (failures)
130
    parse_count_describe  DERIVE LINE parse count (describe)
134
    parse_count_total    DERIVE LINE parse count (total)
135
    parse_count_hard     DERIVE LINE parse count (hard)
136
    parse_count_describe DERIVE LINE parse count (describe)
137
    parse_count_failures DERIVE LINE parse count (failures)
131 138
"
132 139
getvalue_func[$key]=getvalue_sysstat
133 140

  
134 141
key=tablefetch
135 142
global_attrs[$key]="
136
    graph_title Oracle Sysstat Table Fetch Rows
143
    graph_title Oracle Sysstat SQL Table Fetch Rows
137 144
    graph_category db
138 145
    graph_args --base 1000 --lower-limit 0 --rigid
139 146
    graph_vlabel count per second
140
    graph_info Oracle Sysstat Table Scans
147
    graph_info Oracle Sysstat SQL Table Fetch Rows
141 148
"
142 149
data_attrs[$key]="
143
    table_fetch_by_rowid   DERIVE LINE table fetch by rowid
144
    table_scan_rows_gotten DERIVE LINE table scan rows gotten
150
    table_fetch_by_rowid      DERIVE LINE table fetch by rowid
151
    table_scan_rows_gotten    DERIVE LINE table scan rows gotten
152
    table_fetch_continued_row DERIVE LINE table fetch continued row
145 153
"
146 154
getvalue_func[$key]=getvalue_sysstat
147 155

  
148 156
key=tablescan
149 157
global_attrs[$key]="
150
    graph_title Oracle Sysstat Table Scans
158
    graph_title Oracle Sysstat SQL Table Scans
151 159
    graph_category db
152 160
    graph_args --base 1000 --lower-limit 0 --rigid
153 161
    graph_vlabel count per second
154
    graph_info Oracle Sysstat Table Scans
162
    graph_info Oracle Sysstat SQL Table Scans
155 163
"
156 164
data_attrs[$key]="
157 165
    table_scans_short_tables DERIVE LINE table scans (short tables)
......
161 169

  
162 170
key=transaction
163 171
global_attrs[$key]="
164
    graph_title Oracle Sysstat Transactions
172
    graph_title Oracle Sysstat SQL Transactions
165 173
    graph_category db
166 174
    graph_args --base 1000 --lower-limit 0 --rigid
167 175
    graph_vlabel count per second
168
    graph_info Oracle Sysstat Transactions
176
    graph_info Oracle Sysstat SQL Transactions
169 177
"
170 178
data_attrs[$key]="
171 179
    user_commits   DERIVE LINE user commits
......
175 183

  
176 184
key=sort
177 185
global_attrs[$key]="
178
    graph_title Oracle Sysstat Sorts
186
    graph_title Oracle Sysstat SQL Sorts
179 187
    graph_category db
180 188
    graph_args --base 1000 --lower-limit 0 --rigid
181 189
    graph_vlabel count per second
182
    graph_info Oracle Sysstat - Sorts
190
    graph_info Oracle Sysstat SQL Sorts
183 191
"
184 192
data_attrs[$key]="
185 193
    sorts_memory DERIVE LINE sorts (memory)
......
187 195
"
188 196
getvalue_func[$key]=getvalue_sysstat
189 197

  
198
key=logon
199
global_attrs[$key]="
200
    graph_title Oracle Sysstat User Logons
201
    graph_category db
202
    graph_args --base 1000 --lower-limit 0 --rigid
203
    graph_vlabel count per second
204
    graph_info Oracle Sysstat User Logons
205
"
206
data_attrs[$key]="
207
    logon DERIVE LINE logons cumulative
208
"
209
getvalue_func[$key]=getvalue_sysstat
210

  
190 211
key=cursor
191 212
global_attrs[$key]="
192
    graph_title Oracle Sysstat Open Cursors
213
    graph_title Oracle Sysstat User Opened Cursors
193 214
    graph_category db
194 215
    graph_args --base 1000 --lower-limit 0 --rigid
195 216
    graph_vlabel count
196
    graph_info Oracle Sysstat Open Cursors
217
    graph_info Oracle Sysstat User Opened Cursors
197 218
"
198 219
data_attrs[$key]="
199 220
    open_cursor GAUGE LINE opened cursors current
......
220 241

  
221 242
key=redolog
222 243
global_attrs[$key]="
223
    graph_title Oracle Sysstat Redo Log
244
    graph_title Oracle Sysstat Redo Entries
224 245
    graph_category db
225 246
    graph_args --base 1000 --lower-limit 0 --rigid
226 247
    graph_vlabel count per second
227
    graph_info Oracle Sysstat Redo Log
248
    graph_info Oracle Sysstat Redo Entries
228 249
"
229 250
data_attrs[$key]="
230 251
    redo_entries                   DERIVE LINE redo entries
252
    redo_writes                    DERIVE LINE redo writes
253
    redo_synch_writes              DERIVE LINE redo synch writes
231 254
    redo_buffer_allocation_retries DERIVE LINE redo buffer allocation retries
232 255
    redo_log_space_requests        DERIVE LINE redo log space requests
233 256
"
234 257
getvalue_func[$key]=getvalue_sysstat
235 258

  
259
key=redosize
260
global_attrs[$key]="
261
    graph_title Oracle Sysstat Redo Size
262
    graph_category db
263
    graph_args --base 1024 --lower-limit 0 --rigid
264
    graph_vlabel bytes per second
265
    graph_info Oracle Sysstat Redo Size
266
"
267
data_attrs[$key]="
268
    redo_size    DERIVE LINE redo size
269
    redo_wastage DERIVE LINE redo wastage
270
"
271
getvalue_func[$key]=getvalue_sysstat
272

  
236 273
key=physicaliops
237 274
global_attrs[$key]="
238
    graph_title Oracle Sysstat Physical I/O Requests
275
    graph_title Oracle Sysstat I/O Physical Requests
239 276
    graph_category db
240 277
    graph_args --base 1000 --lower-limit 0 --rigid
241 278
    graph_vlabel iops
242
    graph_info Oracle Sysstat Physical I/O Requests
279
    graph_info Oracle Sysstat I/O Physical Requests
243 280
"
244 281
data_attrs[$key]="
245 282
    physical_read_total        DERIVE LINE2 physical read total IO requests
......
253 290

  
254 291
key=physicalrw
255 292
global_attrs[$key]="
256
    graph_title Oracle Sysstat Physical Read/Write Bytes
293
    graph_title Oracle Sysstat I/O Physical Bytes
257 294
    graph_category db
258 295
    graph_args --base 1024 --lower-limit 0 --rigid
259 296
    graph_vlabel bytes per second
260
    graph_info Oracle Sysstat Physical Read/Write Bytes
297
    graph_info Oracle Sysstat I/O Physical Bytes
261 298
"
262 299
data_attrs[$key]="
263 300
    physical_read_total  DERIVE LINE2 physical read total bytes
......
267 304
"
268 305
getvalue_func[$key]=getvalue_sysstat
269 306

  
307
key=blockrw
308
global_attrs[$key]="
309
    graph_title Oracle Sysstat I/O Blocks
310
    graph_category db
311
    graph_args --base 1000 --lower-limit 0 --rigid
312
    graph_vlabel blocks per second
313
    graph_info Oracle Sysstat I/O Blocks
314
"
315
data_attrs[$key]="
316
    db_block_gets      DERIVE LINE db block gets
317
    db_block_changes   DERIVE LINE db block changes
318
    consistent_gets    DERIVE LINE consistent gets
319
    consistent_changes DERIVE LINE consistent changes
320
    physical_reads     DERIVE LINE physical reads
321
    physical_writes    DERIVE LINE physical writes
322
"
323
getvalue_func[$key]=getvalue_sysstat
324

  
325

  
270 326
key=netrw
271 327
global_attrs[$key]="
272
    graph_title Oracle Sysstat Network Send/Receive Bytes
328
    graph_title Oracle Sysstat I/O Network Bytes
273 329
    graph_category db
274 330
    graph_args --base 1024 --lower-limit 0 --rigid
275 331
    graph_vlabel bytes per second
276
    graph_info Oracle Sysstat Network Send/Receive Bytes
332
    graph_info Oracle Sysstat I/O Network Bytes
277 333
"
278 334
data_attrs[$key]="
279 335
    bytes_sent_via_sql_net_to_client       DERIVE LINE bytes sent via SQL*Net to client
......
314 370
    graph_info Oracle Memory PGA
315 371
"
316 372
data_attrs[$key]="
317
    pga_target    GAUGE LINE aggregate PGA auto target
318
    pga_allocated GAUGE LINE total PGA allocated
319
    pga_inuse     GAUGE AREA total PGA inuse
373
    pga_target       GAUGE LINE aggregate PGA target parameter
374
    pga_auto_target  GAUGE LINE aggregate PGA auto target
375
    pga_allocated    GAUGE LINE total PGA allocated
376
    pga_inuse        GAUGE AREA total PGA inuse
320 377
"
321 378
getvalue_func[$key]=getvalue_pgastat
322 379

  
380
key=cputime
381
global_attrs[$key]="
382
    graph_title Oracle CPU Time
383
    graph_category db
384
    graph_args --base 1000 --lower-limit 0 --rigid
385
    graph_vlabel seconds
386
    graph_info Oracle CPU Time
387
"
388
data_attrs[$key]="
389
    db_time                                        DERIVE LINE2 DB time
390
    db_cpu                                         DERIVE LINE2 DB CPU
391
    background_elapsed_time                        DERIVE LINE2 background elapsed time
392
    background_cpu_time                            DERIVE LINE2 background cpu time
393
    connection_management_call_elapsed_time        DERIVE LINE  connection management call elapsed time
394
    sequence_load_elapsed_time                     DERIVE LINE  sequence load elapsed time
395
    sql_execute_elapsed_time                       DERIVE LINE  sql execute elapsed time
396
    parse_time_elapsed                             DERIVE LINE  parse time elapsed
397
    hard_parse_elapsed_time                        DERIVE LINE  hard parse elapsed time
398
    hard_parse_sharing_criteria_elapsed_time       DERIVE LINE  hard parse (sharing criteria) elapsed time
399
    hard_parse_bind_mismatch_elapsed_time          DERIVE LINE  hard parse (bind mismatch) elapsed time
400
    failed_parse_elapsed_time                      DERIVE LINE  failed parse elapsed time
401
    failed_parse_out_of_shared_memory_elapsed_time DERIVE LINE  failed parse (out of shared memory) elapsed time
402
    pl_sql_execution_elapsed_time                  DERIVE LINE  PL/SQL execution elapsed time
403
    inbound_pl_sql_rpc_elapsed_time                DERIVE LINE  inbound PL/SQL rpc elapsed time
404
    pl_sql_compilation_elapsed_time                DERIVE LINE  PL/SQL compilation elapsed time
405
    java_execution_elapsed_time                    DERIVE LINE  Java execution elapsed time
406
    repeated_bind_elapsed_time                     DERIVE LINE  repeated bind elapsed time
407
    rman_cpu_time_backup_restore                   DERIVE LINE  RMAN cpu time (backup/restore)
408
"
409
getvalue_func[$key]=getvalue_cputime
410

  
323 411
key=cachehit
412
# buf_hitratio = 1 - physical_reads / ( db_block_gets + consistent_gets )
413
# lib_hitratio = 1 - reloads / pins
414
# dic_hitratio = ( gets - misses ) / gets
324 415
global_attrs[$key]="
325 416
    graph_title Oracle Cache Hit Ratio
326 417
    graph_category db
327 418
    graph_args --base 1000 --lower-limit 0 --upper-limit 100 --rigid
328 419
    graph_vlabel %
329
    graph_info Oracle Cache Hit Ratio
420
    graph_info Oracle Cache Hit Ratio - The graph shows cache hit ratio between munin-update intervals (5 minutes in most cases).
330 421
    graph_scale no
422

  
423
    $( for field in buf_physical buf_logical lib_pins lib_reloads dic_gets dic_getmisses
424
       do
425
           echo "${field}.graph no"
426
           echo "${field}.type DERIVE"
427
           echo "${field}.min 0"
428
           echo "${field}.label ${field}"
429
       done
430
    )
431

  
432
    buf_hitratio.cdef 100,1,buf_physical,buf_logical,/,-,*,FLOOR
433
    lib_hitratio.cdef 100,1,lib_reloads,lib_pins,/,-,*,FLOOR
434
    dic_hitratio.cdef 100,dic_gets,dic_getmisses,-,dic_gets,/,*,FLOOR
331 435
"
332 436
data_attrs[$key]="
333
    buf_hitratio  GAUGE LINE Buffer Cache Hit Ratio
334
    lib_hitratio  GAUGE LINE Library Cache Hit Ratio
335
    dict_hitratio GAUGE LINE Dictionary Cache Hit Ratio
437
    buf_hitratio GAUGE LINE Buffer Cache Hit Ratio
438
    lib_hitratio GAUGE LINE Library Cache Hit Ratio
439
    dic_hitratio GAUGE LINE Dictionary Cache Hit Ratio
336 440
"
337 441
getvalue_func[$key]=getvalue_cachehit
338 442

  
......
366 470
    graph_category db
367 471
    graph_args --base 1000 --lower-limit 0 --rigid
368 472
    graph_vlabel microseconds
369
    graph_info Oracle Wait Events
473
    graph_info Oracle Wait Events - It may looks wierd that Y-axis indicates 'microseconds per second'. Although number of times of wait event looks easier to understand, in many cases the number of events does not matter, but wait time become more important to analyze bottle necks.
370 474
"
371 475
data_attrs[$key]=""
372 476
getfield_func[$key]=getfield_eventwait
......
384 488
getfield_func[$key]="getfield_eventwait2 Application"
385 489
getvalue_func[$key]="getvalue_eventwait2 Application"
386 490

  
491
key=eventwaitnetwork
492
global_attrs[$key]="
493
    graph_title Oracle Wait Events Network
494
    graph_category db
495
    graph_args --base 1000 --lower-limit 0 --rigid
496
    graph_vlabel microseconds
497
    graph_info Oracle Wait Events Network
498
"
499
data_attrs[$key]=""
500
getfield_func[$key]="getfield_eventwait2 Network"
501
getvalue_func[$key]="getvalue_eventwait2 Network"
502

  
387 503
key=eventwaitconcurrency
388 504
global_attrs[$key]="
389 505
    graph_title Oracle Wait Events Concurrency
......
433 549
getfield_func[$key]="getfield_eventwait2 Cluster"
434 550
getvalue_func[$key]="getvalue_eventwait2 Cluster"
435 551

  
552
key=eventwaitadministrative
553
global_attrs[$key]="
554
    graph_title Oracle Wait Events Administrative
555
    graph_category db
556
    graph_args --base 1000 --lower-limit 0 --rigid
557
    graph_vlabel microseconds
558
    graph_info Oracle Wait Events Administrative
559
"
560
data_attrs[$key]=" "
561
getfield_func[$key]="getfield_eventwait2 Administrative"
562
getvalue_func[$key]="getvalue_eventwait2 Administrative"
563

  
564
key=eventwaitconfiguration
565
global_attrs[$key]="
566
    graph_title Oracle Wait Events Configuration
567
    graph_category db
568
    graph_args --base 1000 --lower-limit 0 --rigid
569
    graph_vlabel microseconds
570
    graph_info Oracle Wait Events Configuration
571
"
572
data_attrs[$key]=" "
573
getfield_func[$key]="getfield_eventwait2 Configuration"
574
getvalue_func[$key]="getvalue_eventwait2 Configuration"
575

  
436 576
key=tablespace
437 577
global_attrs[$key]="
438 578
    graph_title Oracle Table Space Usage
......
466 606
# sqlplus options
467 607
: "${sqlplus:=sqlplus -S -L}"
468 608
sqlplus_variables="
609
    whenever sqlerror exit sql.sqlcode
469 610
    set pagesize 0
470 611
    set feed off
471 612
    set head off
......
484 625
}
485 626

  
486 627
suggest() {
628
    # print hash keys as available module names
487 629
    echo "${!global_attrs[@]}" | tr ' ' '\n' | sort
488 630
}
489 631

  
490 632
config() {
633
    local label_max_length=45
634

  
491 635
    # print global attributes
492 636
    sed -e 's/^  *//' -e '/^$/d' <<< "${global_attrs[$module]}"
493 637

  
......
496 640
    local fields field type draw label
497 641
    while read -r field type draw label
498 642
    do
499
        [ -z "$field" ] && continue
500
        fields="${fields} ${field}"
501

  
502
        echo "${field}.type"  "$type"
503
        echo "${field}.draw"  "$draw"
504
        echo "${field}.label" "$label"
643
        [ -z "${field:-}" ] && continue
644
        fields="${fields:-} ${field}"
645

  
646
        echo "${field}.type ${type}"
647
        echo "${field}.draw ${draw}"
648
        echo "${field}.label ${label:0:${label_max_length}}"
649
        if [ "${type}" = DERIVE ]; then
650
            echo "${field}.min 0"
651
        fi
505 652
    done <<< "${data_attrs[$module]}"
506 653

  
507 654
    echo graph_order "$fields"
......
531 678
    do
532 679
        [ -z "$field" ] && continue
533 680

  
534
        ${sqlplus} "${oracle_auth}" <<EOF
681
        cat <<EOF
535 682
${sqlplus_variables}
536 683
VAR vf VARCHAR2(64)
537 684
VAR vl VARCHAR2(64)
......
544 691
WHERE
545 692
  name = :vl;
546 693
EOF
547
    done <<< "${data_attrs[$module]}"
694
    done <<< "${data_attrs[$module]}" | ${sqlplus} "${oracle_auth}"
548 695
}
549 696

  
550 697
getvalue_sgainfo() {
......
553 700
    do
554 701
        [ -z "$field" ] && continue
555 702

  
556
        ${sqlplus} "${oracle_auth}" <<EOF
703
        cat <<EOF
557 704
${sqlplus_variables}
558 705
VAR vf VARCHAR2(64)
559 706
VAR vl VARCHAR2(64)
......
566 713
WHERE
567 714
  name = :vl;
568 715
EOF
569
    done <<< "${data_attrs[$module]}"
716
    done <<< "${data_attrs[$module]}" | ${sqlplus} "${oracle_auth}"
570 717
}
571 718

  
572 719
getvalue_pgastat() {
......
575 722
    do
576 723
        [ -z "$field" ] && continue
577 724

  
578
        ${sqlplus} "${oracle_auth}" <<EOF
725
        cat <<EOF
579 726
${sqlplus_variables}
580 727
VAR vf VARCHAR2(64)
581 728
VAR vl VARCHAR2(64)
......
588 735
WHERE
589 736
  name = :vl;
590 737
EOF
591
    done <<< "${data_attrs[$module]}"
738
    done <<< "${data_attrs[$module]}" | ${sqlplus} "${oracle_auth}"
592 739
}
593 740

  
594
getvalue_cachehit() {
595
    ${sqlplus} "${oracle_auth}" <<EOF
741
getvalue_cputime() {
742
    local field type draw label
743
    while read -r field type draw label
744
    do
745
        [ -z "$field" ] && continue
746

  
747
        cat <<EOF
596 748
${sqlplus_variables}
749
VAR vf VARCHAR2(64)
750
VAR vl VARCHAR2(64)
751
EXEC :vf := '${field}' 
752
EXEC :vl := '${label}' 
597 753
SELECT
598
  'buf_hitratio.value ' || ROUND( ( 1 - a.value / ( b.value + c.value ) ) * 100 )
754
  :vf || '.value ' || ROUND( value / 1000000 )
599 755
FROM
600
  v\$sysstat a, v\$sysstat b, v\$sysstat c
756
  v\$sys_time_model
601 757
WHERE
602
  a.name = 'physical reads' AND
603
  b.name = 'db block gets' AND
604
  c.name = 'consistent gets'
605
;
758
  stat_name = :vl;
759
EOF
760
    done <<< "${data_attrs[$module]}" | ${sqlplus} "${oracle_auth}"
761
}
762

  
763
getvalue_cachehit() {
764
    ${sqlplus} "${oracle_auth}" <<EOF
765
${sqlplus_variables}
606 766
SELECT
607
  'lib_hitratio.value ' || ROUND( SUM(pins) / ( SUM(pins) + SUM(reloads) ) * 100 )
767
  'buf_physical.value ' || value
608 768
FROM
609
  v\$librarycache
769
  v\$sysstat
770
WHERE
771
  name = 'physical reads cache'
610 772
;
611
SELECT
612
  'dict_hitratio.value ' || ROUND( ( 1 - SUM(getmisses) / SUM(gets) ) * 100 )
613
FROM
614
  v\$rowcache
773
SELECT 
774
  'buf_logical.value ' || ( sd.value + sc.value )
775
FROM 
776
  v\$sysstat sd, v\$sysstat sc 
777
WHERE 
778
  sd.name = 'db block gets from cache' AND sc.name = 'consistent gets from cache'
615 779
;
780
SELECT 'lib_pins.value '    || SUM(pins)    FROM v\$librarycache;
781
SELECT 'lib_reloads.value ' || SUM(reloads) FROM v\$librarycache;
782
SELECT 'dic_gets.value '      || SUM(gets)      FROM v\$rowcache;
783
SELECT 'dic_getmisses.value ' || SUM(getmisses) FROM v\$rowcache;
616 784
EOF
617 785
}
618 786

  
619 787
getfield_sessionuser() {
620
    data_attrs[$module]="$( ${sqlplus} "${oracle_auth}" <<EOF
788
    data_attrs[$module]=$( ${sqlplus} "${oracle_auth}" <<EOF
621 789
${sqlplus_variables}
622 790
SELECT
623 791
  REGEXP_REPLACE( username, '^[^A-Za-z_]|[^A-Za-z0-9_]', '_' ) ||
......
629 797
ORDER BY
630 798
  username;
631 799
EOF
632
)"
800
)
633 801
}
634 802

  
635 803
getvalue_sessionuser() {
......
655 823
}
656 824

  
657 825
getfield_sessionwait() {
658
    data_attrs[$module]="$( ${sqlplus} "${oracle_auth}" <<EOF
826
    data_attrs[$module]=$( ${sqlplus} "${oracle_auth}" <<EOF
659 827
${sqlplus_variables}
828
SELECT 'CPU GAUGE AREASTACK CPU' from dual;
660 829
SELECT
661 830
  REGEXP_REPLACE( wait_class, '^[^A-Za-z_]|[^A-Za-z0-9_]', '_' ) ||
662 831
  ' GAUGE AREASTACK ' || wait_class
......
671 840
SELECT 'Other GAUGE AREASTACK Other' from dual;
672 841
SELECT 'Idle  GAUGE AREASTACK Idle' from dual;
673 842
EOF
674
)"
843
)
675 844
}
676 845

  
677 846
getvalue_sessionwait() {
678 847
    ${sqlplus} "${oracle_auth}" <<EOF
679 848
${sqlplus_variables}
680 849
SELECT
850
  'CPU.value ' || count(wait_class)
851
FROM
852
  v\$session
853
WHERE
854
  wait_time != 0
855
;
856
SELECT
681 857
  REGEXP_REPLACE( en.wait_class, '^[^A-Za-z_]|[^A-Za-z0-9_]', '_' ) || '.value ' ||
682 858
  count(se.wait_class)
683 859
FROM
......
691 867
  LEFT JOIN v\$session se
692 868
ON
693 869
  en.wait_class = se.wait_class AND 
694
  se.username is not null
870
  se.username is not null AND
871
  se.wait_time = 0
695 872
GROUP BY
696
  en.wait_class;
873
  en.wait_class
874
;
697 875
EOF
698 876
}
699 877

  
700 878
getfield_eventwait() {
701
    data_attrs[$module]="$( ${sqlplus} "${oracle_auth}" <<EOF
879
    data_attrs[$module]=$( ${sqlplus} "${oracle_auth}" <<EOF
702 880
${sqlplus_variables}
703 881
SELECT
704 882
  REGEXP_REPLACE( wait_class, '^[^A-Za-z_]|[^A-Za-z0-9_]', '_' ) ||
......
713 891
  wait_class;
714 892
SELECT 'Other DERIVE LINE Other' from dual;
715 893
EOF
716
)"
894
)
717 895
}
718 896

  
719 897
getvalue_eventwait() {
......
743 921
getfield_eventwait2() {
744 922
    local waitclass="$1"
745 923

  
746
    data_attrs[$module]="$( ${sqlplus} "${oracle_auth}" <<EOF
924
    data_attrs[$module]=$( ${sqlplus} "${oracle_auth}" <<EOF
747 925
${sqlplus_variables}
748 926
VAR vl VARCHAR2(64)
749 927
EXEC :vl := '${waitclass}' 
750 928
SELECT
751 929
  REGEXP_REPLACE( name, '^[^A-Za-z_]|[^A-Za-z0-9_]', '_' ) ||
752
  ' DERIVE LINE ' || SUBSTR( name, 1, 45 )
930
  ' DERIVE LINE ' || name
753 931
FROM
754 932
  v\$event_name 
755 933
WHERE
......
757 935
ORDER BY
758 936
  name;
759 937
EOF
760
)"
938
)
761 939
}
762 940

  
763 941
getvalue_eventwait2() {
......
780 958
}
781 959

  
782 960
getfield_tablespace() {
783
    data_attrs[$module]="$( ${sqlplus} "${oracle_auth}" <<EOF
961
    data_attrs[$module]=$( ${sqlplus} "${oracle_auth}" <<EOF
784 962
${sqlplus_variables}
785 963
SELECT
786 964
  REGEXP_REPLACE( tablespace_name, '^[^A-Za-z_]|[^A-Za-z0-9_]', '_' ) ||
......
790 968
ORDER BY
791 969
  tablespace_name;
792 970
EOF
793
)"
971
)
794 972
}
795 973

  
796 974
getvalue_tablespace() {
......
822 1000
}
823 1001

  
824 1002
getfield_asmusage() {
825
    data_attrs[$module]="$( ${sqlplus} "${oracle_auth}" <<EOF
1003
    data_attrs[$module]=$( ${sqlplus} "${oracle_auth}" <<EOF
826 1004
${sqlplus_variables}
827 1005
SELECT
828 1006
  REGEXP_REPLACE( name, '^[^A-Za-z_]|[^A-Za-z0-9_]', '_' ) ||
......
832 1010
ORDER BY
833 1011
  name;
834 1012
EOF
835
)"
1013
)
836 1014
}
837 1015

  
838 1016
getvalue_asmusage() {

Formats disponibles : Unified diff