Projet

Général

Profil

Révision d0c8e0b0

IDd0c8e0b0a8b68f1f2d70defb38f902d71e6dea22
Parent 442bc06d
Enfant cb868b07

Ajouté par K.Cima il y a plus de 8 ans

Fix to work autoconf. Cleanup code.

Voir les différences:

plugins/oracle/oracle_sysstat
459 459
getvalue_func[$key]=getvalue_cputime
460 460

  
461 461
key=cachehit
462
# buf_hitratio = 1 - physical_reads / ( db_block_gets + consistent_gets )
463
# lib_hitratio = 1 - reloads / pins
464
# dict_hitratio = ( gets - misses ) / gets
465
field_info=$( for field in buf_physical buf_logical lib_pins lib_reloads dict_gets dict_getmisses
466
   do
467
       echo "${field}.graph no"
468
       echo "${field}.type DERIVE"
469
       echo "${field}.min 0"
470
       echo "${field}.label ${field}"
471
   done
472
)
473 462
global_attrs[$key]="
474 463
    graph_title Oracle$db_name Cache Hit Ratio
475 464
    graph_category db
......
478 467
    graph_info Oracle Cache Hit Ratio - The graph shows cache hit ratio between munin-update intervals (5 minutes in most cases).
479 468
    graph_scale no
480 469

  
481
    ${field_info}
482 470
    buf_hitratio.cdef 100,1,buf_physical,buf_logical,/,-,*
483 471
    lib_hitratio.cdef 100,1,lib_reloads,lib_pins,/,-,*
484 472
    dict_hitratio.cdef 100,dict_gets,dict_getmisses,-,dict_gets,/,*
485 473
"
474
    # Note:
475
    #   buf_hitratio = 1 - physical_reads / ( db_block_gets + consistent_gets )
476
    #   lib_hitratio = 1 - reloads / pins
477
    #   dict_hitratio = ( gets - misses ) / gets
486 478
data_attrs[$key]="
487
    buf_hitratio GAUGE LINE Buffer Cache Hit Ratio
488
    lib_hitratio GAUGE LINE Library Cache Hit Ratio
489
    dict_hitratio GAUGE LINE Dictionary Cache Hit Ratio
479
    buf_physical   DERIVE LINE dummy
480
    buf_logical    DERIVE LINE dummy
481
    lib_pins       DERIVE LINE dummy
482
    lib_reloads    DERIVE LINE dummy
483
    dict_gets      DERIVE LINE dummy
484
    dict_getmisses DERIVE LINE dummy
485
    buf_hitratio   GAUGE  LINE Buffer Cache Hit Ratio
486
    lib_hitratio   GAUGE  LINE Library Cache Hit Ratio
487
    dict_hitratio  GAUGE  LINE Dictionary Cache Hit Ratio
490 488
"
491 489
getvalue_func[$key]=getvalue_cachehit
492 490

  
......
558 556
    graph_vlabel microseconds
559 557
    graph_info Oracle Wait Events Concurrency
560 558
"
561
data_attrs[$key]=" "
559
data_attrs[$key]=""
562 560
getfield_func[$key]="getfield_eventwait2 Concurrency"
563 561
getvalue_func[$key]="getvalue_eventwait2 Concurrency"
564 562

  
......
582 580
    graph_vlabel microseconds
583 581
    graph_info Oracle Wait Events System I/O
584 582
"
585
data_attrs[$key]="
586
"
583
data_attrs[$key]=""
587 584
getfield_func[$key]="getfield_eventwait2 System I/O"
588 585
getvalue_func[$key]="getvalue_eventwait2 System I/O"
589 586

  
......
595 592
    graph_vlabel microseconds
596 593
    graph_info Oracle Wait Events Cluster
597 594
"
598
data_attrs[$key]=" "
595
data_attrs[$key]=""
599 596
getfield_func[$key]="getfield_eventwait2 Cluster"
600 597
getvalue_func[$key]="getvalue_eventwait2 Cluster"
601 598

  
......
607 604
    graph_vlabel microseconds
608 605
    graph_info Oracle Wait Events Administrative
609 606
"
610
data_attrs[$key]=" "
607
data_attrs[$key]=""
611 608
getfield_func[$key]="getfield_eventwait2 Administrative"
612 609
getvalue_func[$key]="getvalue_eventwait2 Administrative"
613 610

  
......
619 616
    graph_vlabel microseconds
620 617
    graph_info Oracle Wait Events Configuration
621 618
"
622
data_attrs[$key]=" "
619
data_attrs[$key]=""
623 620
getfield_func[$key]="getfield_eventwait2 Configuration"
624 621
getvalue_func[$key]="getvalue_eventwait2 Configuration"
625 622

  
......
667 664
# Functions 
668 665

  
669 666
autoconf() {
670
    if [ -x "$( which "${sqlplus}" )" ]; then
667
    if which sqlplus >/dev/null ; then
671 668
        echo yes
672 669
    else
673 670
        echo "no (failed to find executable 'sqlplus')"
......
690 687

  
691 688
do_config() {
692 689
    local label_max_length=45
690
    local field type draw label
691
    local fields= 
693 692

  
694 693
    getfield
695 694
    echo "multigraph ${plugin_name}_${module}"
696 695

  
697 696
    # print global attributes
698
    sed -e 's/^  *//' -e '/^$/d' <<< "${global_attrs[$module]}"
697
    echo "${global_attrs[$module]}" | sed -e 's/^  *//' -e '/^$/d'
699 698

  
700 699
    # print data source attributes
701 700
    # split line into field,type,draw,label 
702
    local fields field type draw label
703
    fields=
704 701
    while read -r field type draw label
705 702
    do
706 703
        [ -z "$field" ] && continue
......
709 706
        echo "${field}.type ${type}"
710 707
        echo "${field}.draw ${draw}"
711 708
        echo "${field}.label ${label:0:${label_max_length}}"
712
        if [ "${type}" = DERIVE ]; then
709
        if [ "$type" = 'DERIVE' ]; then
713 710
            echo "${field}.min 0"
714 711
        fi
712
        if [ "$label" = 'dummy' ]; then
713
            echo "${field}.graph no"
714
        fi
715 715
    done <<< "${data_attrs[$module]}"
716 716

  
717 717
    echo graph_order "$fields"

Formats disponibles : Unified diff