@@ -13,34 +13,175 @@ proc Quit {} {
proc TreePress { tree } {
global host
set cluster [ $tree item [ $tree selection ] - values]
set root [ $tree selection ]
RunCommand $root " i n f o b a s e s u m m a r y l i s t - - c l u s t e r = $ c l u s t e r $ h o s t "
set id [ $tree selection ]
set values [ $tree item [ $tree selection ] - values]
set key [ lindex [ split $id " : : " ] 0 ]
puts " $ k e y , $ i d , $ v a l u e s "
Run : : $key $tree $host $values
# RunCommand $root "infobase summary list --cluster=$cluster $host"
}
namespace eval Run { } { }
proc Run::server { tree host values} {
puts " S e r v e r i n f o $ h o s t $ v a l u e s "
set lst [ RunCommand server::$host " c l u s t e r l i s t $ h o s t " ]
set l [ split $lst " & " ]
foreach i $l {
set cluster_list [ split $i " : " ]
if { [ string trim [ lindex $cluster_list 0 ] ] eq " c l u s t e r " } {
set cluster_id [ string trim [ lindex $cluster_list 1 ] ]
lappend cluster( $cluster_id ) $cluster_id
}
if { [ string trim [ lindex $cluster_list 0 ] ] eq " n a m e " } {
lappend cluster( $cluster_id ) [ string trim [ lindex $cluster_list 1 ] ]
}
}
foreach x [ array names cluster] {
set id [ lindex $cluster ( $x ) 0 ]
if { [ $tree exists " c l u s t e r : : $ i d " ] == 0 } {
$tree insert " s e r v e r : : $ h o s t " end - id " c l u s t e r : : $ i d " - text " [ l i n d e x $ c l u s t e r ( $ x ) 1 ] " - values " $ i d "
InsertClusterItems $tree $id
}
}
}
proc Run::cluster { $tree host values} {
global active_cluster
set active_cluster $values
puts " S e r v e r i n f o $ h o s t $ v a l u e s "
puts [ RunCommand cluster::$values " c l u s t e r i n f o - - c l u s t e r = $ v a l u e s $ h o s t " ]
}
proc Run::infobases { tree host values} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children { } ]
set lst [ RunCommand infobase::$values " i n f o b a s e s u m m a r y - - c l u s t e r = $ a c t i v e _ c l u s t e r l i s t $ h o s t " ]
set l [ split $lst " & " ]
foreach i $l {
set base_list [ split $i " : " ]
if { [ string trim [ lindex $base_list 0 ] ] eq " i n f o b a s e " } {
set base_id [ string trim [ lindex $base_list 1 ] ]
lappend base( $base_id ) $base_id
}
if { [ string trim [ lindex $base_list 0 ] ] eq " n a m e " } {
lappend base( $base_id ) [ string trim [ lindex $base_list 1 ] ]
}
InsertItemsWorkList $base_list
}
foreach x [ array names base] {
set id [ lindex $base ( $x ) 0 ]
if { [ $tree exists " i n f o b a s e : : $ i d " ] == 0 } {
$tree insert " i n f o b a s e s : : $ v a l u e s " end - id " i n f o b a s e : : $ i d " - text " [ l i n d e x $ b a s e ( $ x ) 1 ] " - values " $ i d "
}
InsertBaseItems $tree $id
}
}
proc Run::infobase { tree host values} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children { } ]
set lst [ RunCommand infobase::$values " i n f o b a s e i n f o - - c l u s t e r = $ a c t i v e _ c l u s t e r - - i n f o b a s e = $ v a l u e s $ h o s t " ]
set l [ split $lst " & " ]
foreach i $l {
set base_list [ split $i " : " ]
InsertItemsWorkList $base_list
}
}
proc Run::List:Base { tree host values par} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children { } ]
set lst [ RunCommand infobase::$values " $ p a r l i s t - - c l u s t e r = $ a c t i v e _ c l u s t e r - - i n f o b a s e = $ v a l u e s $ h o s t " ]
set l [ split $lst " & " ]
foreach i $l {
set base_list [ split $i " : " ]
InsertItemsWorkList $base_list
}
}
proc Run::List { tree host values par} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children { } ]
set lst [ RunCommand infobase::$values " $ p a r l i s t - - c l u s t e r = $ a c t i v e _ c l u s t e r $ h o s t " ]
set l [ split $lst " & " ]
foreach i $l {
set base_list [ split $i " : " ]
InsertItemsWorkList $base_list
}
}
proc Run::sessions { tree host values} {
Run : : List:Base $tree $host $values session
}
proc Run::locks { tree host values} {
Run : : List:Base $tree $host $values lock
}
proc Run::connections { tree host values} {
Run : : List:Base $tree $host $values connection
}
proc Run::servers { tree host values} {
Run : : List $tree $host $values server
}
proc Run::profiles { tree host values} {
Run : : List $tree $host $values profile
}
proc Run::processes { tree host values} {
Run : : List $tree $host $values process
}
proc Run::managers { tree host values} {
Run : : List $tree $host $values manager
}
proc Run::admins { tree host values} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children { } ]
set lst [ RunCommand infobase::$values " a g e n t a d m i n l i s t $ h o s t " ]
set l [ split $lst " & " ]
foreach i $l {
set base_list [ split $i " : " ]
InsertItemsWorkList $base_list
}
}
proc InsertItemsWorkList { lst } {
.frm_work.tree_work insert { } end - values $lst
# .frm_work.tree_work insert val end -text [lindex $lst 1] -values [lindex $lst 1]
}
proc RunCommand { root par} {
global dir rac_cmd cluster
set pipe [ open " | $ r a c _ c m d $ p a r " " r " ]
set lst " "
while { [ gets $pipe line] >= 0 } {
puts " $ l i n e "
set str [ split $line " : " ]
set param [ string trim [ lindex $str 0 ] ]
set val [ string trim [ lindex $str 1 ] ]
.frm_work.tree_work insert { } end - text " $ p a r a m " - values " $ v a l "
# .frm_work.tree_work insert {} end -text "$val" -values "$val"
if { $param eq " c l u s t e r " } {
set cluster $val
}
if { $param eq " n a m e " } {
set cluster_name $val
.frm_tree.tree insert $root end - text " $ v a l " - values " $ c l u s t e r "
}
# puts "$line"
append l st "$ l i n e & "
}
close $pipe
return $lst
# fileevent $pipe readable [list DebugInfo .frm_work.tree_work $pipe]
# fconfigure $pipe -buffering none -blocking no
}
proc InsertClusterItems { tree id} {
set parent " c l u s t e r : : $ i d "
$tree insert $parent end - id " i n f o b a s e s : : $ i d " - text " И н ф о р м а ц и о н н ы е б а з ы " - values " $ i d "
$tree insert $parent end - id " s e r v e r s : : $ i d " - text " Р а б о ч и е с е р в е р ы " - values " $ i d "
$tree insert $parent end - id " a d m i n s : : $ i d " - text " А д м и н и с т р а т о р ы " - values " $ i d "
$tree insert $parent end - id " m a n a g e r s : : $ i d " - text " М е н е д ж е р ы к л а с т е р а " - values " m a n a g e r s - a l l "
$tree insert $parent end - id " p r o c e s s e s : : $ i d " - text " Р а б о ч и е п р о ц е с с ы " - values " w o r k p r o c e s s - a l l "
$tree insert $parent end - id " s e s s i o n s : : $ i d " - text " С е а н с ы " - values " s e s s i o n s - a l l "
$tree insert $parent end - id " l o c k s : : $ i d " - text " Б л о к и р о в к и " - values " b l o c k s - a l l "
$tree insert $parent end - id " c o n n e c t i o n s : : $ i d " - text " С о е д и н е н и я " - values " c o n n e c t i o n s - a l l "
$tree insert $parent end - id " p r o f i l e s : : $ i d " - text " П р о ф и л и б е з о п а с н о с т и " - values " s e c u r e p r o f i l e s - a l l "
}
proc InsertBaseItems { tree id} {
set parent " i n f o b a s e : : $ i d "
$tree insert $parent end - id " s e s s i o n s : : $ i d " - text " С е а н с ы " - values " $ i d "
$tree insert $parent end - id " l o c k s : : $ i d " - text " Б л о к и р о в к и " - values " $ i d "
$tree insert $parent end - id " c o n n e c t i o n s : : $ i d " - text " С о е д и н е н и я " - values " $ i d "
}
proc DebugInfo { widget f} {
if { [ eof $f ] } {
catch [ close $f ] msg
@@ -55,6 +196,5 @@ proc DebugInfo {widget f} {
puts " $ l i n e "
$widget insert { } end - text " $ l i n e " - values " $ l i n e "
}
}