2018-05-24 08:37:34 +00:00
|
|
|
|
###########################################
|
|
|
|
|
# Rac GUI
|
|
|
|
|
# Distributed under GNU Public License
|
2018-05-16 11:17:27 +00:00
|
|
|
|
# Author: Sergey Kalinin svk@nuk-svk.ru
|
|
|
|
|
# Copyright (c) "http://nuk-svk.ru", 2018
|
|
|
|
|
# https://bitbucket.org/svk28/rac-gui
|
2018-05-24 08:37:34 +00:00
|
|
|
|
###########################################
|
2018-05-16 11:17:27 +00:00
|
|
|
|
|
|
|
|
|
proc Quit {} {
|
|
|
|
|
exit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proc TreePress {tree} {
|
|
|
|
|
global host
|
2018-05-20 15:03:02 +00:00
|
|
|
|
|
2018-05-17 08:16:14 +00:00
|
|
|
|
set id [$tree selection]
|
|
|
|
|
set values [$tree item [$tree selection] -values]
|
|
|
|
|
set key [lindex [split $id "::"] 0]
|
2018-05-20 15:03:02 +00:00
|
|
|
|
if {$key eq "server"} {
|
|
|
|
|
set host $values
|
2018-05-23 10:17:15 +00:00
|
|
|
|
} elseif {$key eq ""} {
|
|
|
|
|
return
|
|
|
|
|
}
|
2018-05-24 08:37:34 +00:00
|
|
|
|
puts "$id $host $values"
|
2018-05-17 08:16:14 +00:00
|
|
|
|
Run::$key $tree $host $values
|
|
|
|
|
#RunCommand $root "infobase summary list --cluster=$cluster $host"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace eval Run {} {}
|
2018-05-18 09:13:43 +00:00
|
|
|
|
# Получение данных по кластерам
|
2018-05-17 08:16:14 +00:00
|
|
|
|
proc Run::server {tree host values} {
|
|
|
|
|
set lst [RunCommand server::$host "cluster list $host"]
|
|
|
|
|
set l [split $lst "&"]
|
|
|
|
|
foreach i $l {
|
|
|
|
|
set cluster_list [split $i ":"]
|
|
|
|
|
if {[string trim [lindex $cluster_list 0]] eq "cluster"} {
|
|
|
|
|
set cluster_id [string trim [lindex $cluster_list 1]]
|
|
|
|
|
lappend cluster($cluster_id) $cluster_id
|
|
|
|
|
}
|
|
|
|
|
if {[string trim [lindex $cluster_list 0]] eq "name"} {
|
|
|
|
|
lappend cluster($cluster_id) [string trim [lindex $cluster_list 1]]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
foreach x [array names cluster] {
|
|
|
|
|
set id [lindex $cluster($x) 0]
|
|
|
|
|
if { [$tree exists "cluster::$id"] == 0 } {
|
|
|
|
|
$tree insert "server::$host" end -id "cluster::$id" -text "[lindex $cluster($x) 1]" -values "$id"
|
|
|
|
|
InsertClusterItems $tree $id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
proc Run::cluster {$tree host values} {
|
|
|
|
|
global active_cluster
|
|
|
|
|
set active_cluster $values
|
2018-05-22 09:39:17 +00:00
|
|
|
|
RunCommand cluster::$values "cluster info --cluster=$values $host"
|
2018-05-17 08:16:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proc Run::infobases {tree host values} {
|
|
|
|
|
global active_cluster
|
|
|
|
|
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
|
|
|
|
|
|
|
|
|
set lst [RunCommand infobase::$values "infobase summary --cluster=$active_cluster list $host"]
|
|
|
|
|
set l [split $lst "&"]
|
|
|
|
|
foreach i $l {
|
|
|
|
|
set base_list [split $i ":"]
|
|
|
|
|
if {[string trim [lindex $base_list 0]] eq "infobase"} {
|
|
|
|
|
set base_id [string trim [lindex $base_list 1]]
|
|
|
|
|
lappend base($base_id) $base_id
|
|
|
|
|
}
|
|
|
|
|
if {[string trim [lindex $base_list 0]] eq "name"} {
|
|
|
|
|
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 "infobase::$id"] == 0 } {
|
|
|
|
|
$tree insert "infobases::$values" end -id "infobase::$id" -text "[lindex $base($x) 1]" -values "$id"
|
|
|
|
|
}
|
|
|
|
|
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 "infobase info --cluster=$active_cluster --infobase=$values $host"]
|
|
|
|
|
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 "$par list --cluster=$active_cluster --infobase=$values $host"]
|
|
|
|
|
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 "$par list --cluster=$active_cluster $host"]
|
|
|
|
|
set l [split $lst "&"]
|
|
|
|
|
foreach i $l {
|
|
|
|
|
set base_list [split $i ":"]
|
|
|
|
|
InsertItemsWorkList $base_list
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-16 11:17:27 +00:00
|
|
|
|
|
2018-05-17 08:16:14 +00:00
|
|
|
|
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} {
|
2018-05-18 09:13:43 +00:00
|
|
|
|
global active_cluster
|
|
|
|
|
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
|
|
|
|
set lst [RunCommand infobase::$values "server list --cluster=$active_cluster $host"]
|
|
|
|
|
set l [split $lst "&"]
|
|
|
|
|
foreach i $l {
|
|
|
|
|
set server_list [split $i ":"]
|
|
|
|
|
#InsertItemsWorkList $server_list
|
|
|
|
|
if {[string trim [lindex $server_list 0]] eq "server"} {
|
|
|
|
|
set server_id [string trim [lindex $server_list 1]]
|
|
|
|
|
lappend server($server_id) $server_id
|
|
|
|
|
}
|
|
|
|
|
if {[string trim [lindex $server_list 0]] eq "name"} {
|
|
|
|
|
lappend server($server_id) [string trim [lindex $server_list 1]]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
foreach x [array names server] {
|
|
|
|
|
set id [lindex $server($x) 0]
|
|
|
|
|
if { [$tree exists "work_server::$id"] == 0 } {
|
|
|
|
|
$tree insert "servers::$values" end -id "work_server::$id" -text "[lindex $server($x) 1]" -values "$id"
|
|
|
|
|
}
|
|
|
|
|
#InsertServerItems $tree $id
|
|
|
|
|
}
|
|
|
|
|
#Run::List $tree $host $values server
|
|
|
|
|
}
|
|
|
|
|
proc Run::work_server {tree host values} {
|
|
|
|
|
global active_cluster
|
|
|
|
|
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
|
|
|
|
set lst [RunCommand infobase::$values "server info --cluster=$active_cluster --server=$values $host"]
|
|
|
|
|
set l [split $lst "&"]
|
|
|
|
|
foreach i $l {
|
|
|
|
|
set base_list [split $i ":"]
|
|
|
|
|
InsertItemsWorkList $base_list
|
|
|
|
|
}
|
|
|
|
|
#Run::List $tree $host $values server
|
2018-05-17 08:16:14 +00:00
|
|
|
|
}
|
|
|
|
|
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 "agent admin list $host"]
|
|
|
|
|
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]
|
2018-05-16 11:17:27 +00:00
|
|
|
|
}
|
|
|
|
|
proc RunCommand {root par} {
|
|
|
|
|
global dir rac_cmd cluster
|
|
|
|
|
set pipe [open "|$rac_cmd $par" "r"]
|
2018-05-17 08:16:14 +00:00
|
|
|
|
set lst ""
|
|
|
|
|
while {[gets $pipe line]>=0} {
|
|
|
|
|
#puts "$line"
|
|
|
|
|
append lst "$line&"
|
2018-05-16 11:17:27 +00:00
|
|
|
|
}
|
2018-05-17 08:16:14 +00:00
|
|
|
|
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 "cluster::$id"
|
|
|
|
|
$tree insert $parent end -id "infobases::$id" -text "Информационные базы" -values "$id"
|
|
|
|
|
$tree insert $parent end -id "servers::$id" -text "Рабочие серверы" -values "$id"
|
|
|
|
|
$tree insert $parent end -id "admins::$id" -text "Администраторы" -values "$id"
|
|
|
|
|
$tree insert $parent end -id "managers::$id" -text "Менеджеры кластера" -values "managers-all"
|
|
|
|
|
$tree insert $parent end -id "processes::$id" -text "Рабочие процессы" -values "workprocess-all"
|
|
|
|
|
$tree insert $parent end -id "sessions::$id" -text "Сеансы" -values "sessions-all"
|
|
|
|
|
$tree insert $parent end -id "locks::$id" -text "Блокировки" -values "blocks-all"
|
|
|
|
|
$tree insert $parent end -id "connections::$id" -text "Соединения" -values "connections-all"
|
|
|
|
|
$tree insert $parent end -id "profiles::$id" -text "Профили безопасности" -values "secureprofiles-all"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proc InsertBaseItems {tree id} {
|
|
|
|
|
set parent "infobase::$id"
|
2018-05-18 06:05:27 +00:00
|
|
|
|
if { [$tree exists "sessions::$id"] == 0 } {
|
|
|
|
|
$tree insert $parent end -id "sessions::$id" -text "Сеансы" -values "$id"
|
|
|
|
|
}
|
|
|
|
|
if { [$tree exists "locks::$id"] == 0 } {
|
|
|
|
|
$tree insert $parent end -id "locks::$id" -text "Блокировки" -values "$id"
|
|
|
|
|
}
|
|
|
|
|
if { [$tree exists "connections::$id"] == 0 } {
|
|
|
|
|
$tree insert $parent end -id "connections::$id" -text "Соединения" -values "$id"
|
|
|
|
|
}
|
2018-05-16 11:17:27 +00:00
|
|
|
|
}
|
2018-05-18 09:13:43 +00:00
|
|
|
|
proc InsertServerstems {tree id} {
|
|
|
|
|
set parent "infobase::$id"
|
|
|
|
|
if { [$tree exists "sessions::$id"] == 0 } {
|
|
|
|
|
$tree insert $parent end -id "sessions::$id" -text "Сеансы" -values "$id"
|
|
|
|
|
}
|
|
|
|
|
if { [$tree exists "locks::$id"] == 0 } {
|
|
|
|
|
$tree insert $parent end -id "locks::$id" -text "Блокировки" -values "$id"
|
|
|
|
|
}
|
|
|
|
|
if { [$tree exists "connections::$id"] == 0 } {
|
|
|
|
|
$tree insert $parent end -id "connections::$id" -text "Соединения" -values "$id"
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-16 11:17:27 +00:00
|
|
|
|
|
|
|
|
|
proc DebugInfo {widget f} {
|
2018-05-17 08:16:14 +00:00
|
|
|
|
if {[eof $f]} {
|
2018-05-16 11:17:27 +00:00
|
|
|
|
catch [close $f] msg
|
|
|
|
|
if {$msg != ""} {
|
|
|
|
|
puts $msg
|
|
|
|
|
} else {
|
|
|
|
|
puts $msg
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-17 08:16:14 +00:00
|
|
|
|
|
2018-05-16 11:17:27 +00:00
|
|
|
|
while {[gets $f line]>=0} {
|
|
|
|
|
puts "$line"
|
|
|
|
|
$widget insert {} end -text "$line" -values "$line"
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-17 08:16:14 +00:00
|
|
|
|
|
2018-05-18 09:13:43 +00:00
|
|
|
|
proc Del {} {
|
|
|
|
|
global active_cluster host
|
|
|
|
|
set id [.frm_tree.tree selection]
|
|
|
|
|
set values [.frm_tree.tree item [.frm_tree.tree selection] -values]
|
|
|
|
|
set key [lindex [split $id "::"] 0]
|
|
|
|
|
Del::$key .frm_tree.tree $host $values
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-22 09:39:17 +00:00
|
|
|
|
namespace eval Del {} {}
|
|
|
|
|
proc Del::work_server {tree host values} {
|
|
|
|
|
global active_cluster
|
|
|
|
|
set answer [tk_messageBox -message "Удалить рабочий сервер $values?" \
|
|
|
|
|
-icon question -type yesno ]
|
|
|
|
|
switch -- $answer {
|
|
|
|
|
yes {
|
|
|
|
|
set lst [RunCommand infobase::$values "server remove --cluster=$active_cluster --server=$values $host"]
|
|
|
|
|
$tree delete "work_server::$values"
|
|
|
|
|
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
2018-05-20 15:03:02 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
no {return}
|
2018-05-20 15:03:02 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
}
|
|
|
|
|
proc Del::cluster {tree host values} {
|
|
|
|
|
set answer [tk_messageBox -message "Удалить кластер $values?" \
|
|
|
|
|
-icon question -type yesno ]
|
|
|
|
|
switch -- $answer {
|
|
|
|
|
yes {
|
|
|
|
|
set lst [RunCommand infobase::$values "cluster remove --cluster=$values $host"]
|
|
|
|
|
$tree delete "cluster::$values"
|
|
|
|
|
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
2018-05-20 15:03:02 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
no {return}
|
2018-05-20 15:03:02 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
}
|
|
|
|
|
proc Del::infobase {tree host values} {
|
|
|
|
|
global active_cluster
|
|
|
|
|
set answer [tk_messageBox -message "Удалить информационную базу $values?" \
|
|
|
|
|
-icon question -type yesno ]
|
|
|
|
|
switch -- $answer {
|
|
|
|
|
yes {
|
|
|
|
|
set lst [RunCommand infobase::$values "infobase drop --infobase=$values --cluster=$active_cluster $host"]
|
|
|
|
|
$tree delete "infobase::$values"
|
|
|
|
|
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
2018-05-18 09:13:43 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
no {return}
|
2018-05-19 13:53:48 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
}
|
|
|
|
|
proc Del::server {tree host values} {
|
|
|
|
|
global dir
|
|
|
|
|
set answer [tk_messageBox -message "Удалить сервер $values?" \
|
|
|
|
|
-icon question -type yesno ]
|
|
|
|
|
switch -- $answer {
|
|
|
|
|
yes {
|
|
|
|
|
#set lst [RunCommand infobase::$values "cluster remove --cluster=$values $host"]
|
|
|
|
|
file copy [file join $dir(work) 1c_srv.cfg] [file join $dir(work) 1c_srv.cfg.bak]
|
|
|
|
|
set orig_file [open [file join $dir(work) 1c_srv.cfg.bak] "r"]
|
|
|
|
|
set file [open [file join $dir(work) 1c_srv.cfg] "w"]
|
|
|
|
|
while {[gets $orig_file line] >=0 } {
|
|
|
|
|
puts $line
|
|
|
|
|
if { $line ne "" && $line ne "$values"} {
|
|
|
|
|
puts $file $line
|
2018-05-20 15:03:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
close $file
|
|
|
|
|
close $orig_file
|
|
|
|
|
#return "$host:$port"
|
|
|
|
|
$tree delete "server::$values"
|
|
|
|
|
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
|
|
|
|
file delete [file join $dir(work) 1c_srv.cfg.bak]
|
2018-05-20 15:03:02 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
no {return}
|
2018-05-20 15:03:02 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
}
|
2018-05-19 13:53:48 +00:00
|
|
|
|
proc Add {} {
|
|
|
|
|
global active_cluster host
|
|
|
|
|
set id [.frm_tree.tree selection]
|
|
|
|
|
set values [.frm_tree.tree item [.frm_tree.tree selection] -values]
|
|
|
|
|
set key [lindex [split $id "::"] 0]
|
2018-05-20 15:03:02 +00:00
|
|
|
|
if {$key eq "" || $key eq "server"} {
|
|
|
|
|
set host [ Add::server ]
|
|
|
|
|
}
|
2018-05-19 13:53:48 +00:00
|
|
|
|
puts "$key, $id , $values"
|
|
|
|
|
Add::$key .frm_tree.tree $host $values
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-22 09:39:17 +00:00
|
|
|
|
namespace eval Add {} {}
|
|
|
|
|
proc Add::server {} {
|
|
|
|
|
global default
|
|
|
|
|
toplevel .add
|
2018-05-27 12:40:36 +00:00
|
|
|
|
|
2018-05-22 09:39:17 +00:00
|
|
|
|
set frm [ttk::labelframe .add.frm -text "Добавление основного сервера" -labelanchor nw]
|
|
|
|
|
|
|
|
|
|
label $frm.lbl_host -text "Адрес сервера"
|
|
|
|
|
entry $frm.ent_host
|
|
|
|
|
label $frm.lbl_port -text "Порт"
|
|
|
|
|
entry $frm.ent_port
|
|
|
|
|
$frm.ent_port insert end $default(port)
|
|
|
|
|
grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_host -row 0 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_port -row 1 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_port -row 1 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid columnconfigure $frm 0 -weight 1
|
|
|
|
|
grid rowconfigure $frm 0 -weight 1
|
|
|
|
|
set frm_btn [frame .add.frm_btn -border 0]
|
2018-05-27 12:40:36 +00:00
|
|
|
|
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command {
|
2018-05-22 09:39:17 +00:00
|
|
|
|
set host [SaveMainServer [.add.frm.ent_host get] [.add.frm.ent_port get]]
|
|
|
|
|
.frm_tree.tree insert {} end -id "server::$host" -text "$host" -values "$host"
|
|
|
|
|
destroy .add
|
|
|
|
|
return $host
|
2018-05-19 13:53:48 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
|
|
|
|
|
pack $frm $frm_btn -padx 5 -pady 5 -expand true -fill x
|
|
|
|
|
pack $frm_btn.btn_cancel -side right
|
|
|
|
|
pack $frm_btn.btn_ok -side right -padx 10
|
|
|
|
|
}
|
|
|
|
|
proc Add::servers {tree host values} {
|
|
|
|
|
global default dedicate_manager using_central_server
|
|
|
|
|
set dedicate_manager "none"
|
|
|
|
|
set using_central_server "normal"
|
2018-05-24 08:37:34 +00:00
|
|
|
|
#set active_cluster $values
|
2018-05-22 09:39:17 +00:00
|
|
|
|
toplevel .add
|
|
|
|
|
wm title .add "Добавление рабочего сервера"
|
2018-05-27 12:40:36 +00:00
|
|
|
|
#wm iconphoto .add server_grey_64
|
2018-05-22 09:39:17 +00:00
|
|
|
|
ttk::label .add.lbl -image server_grey_64
|
|
|
|
|
set frm [ttk::labelframe .add.frm -text "Добавление рабочего сервера" -labelanchor nw]
|
|
|
|
|
label $frm.lbl_server_desc -text "Описание сервера"
|
|
|
|
|
entry $frm.ent_server_desc
|
|
|
|
|
label $frm.lbl_host -text "Адрес сервера"
|
|
|
|
|
entry $frm.ent_host
|
|
|
|
|
label $frm.lbl_port -text "Порт"
|
|
|
|
|
entry $frm.ent_port
|
|
|
|
|
$frm.ent_port insert end $default(port)
|
|
|
|
|
label $frm.lbl_ports_range -text "Диапазон портов"
|
|
|
|
|
entry $frm.ent_ports_range
|
|
|
|
|
$frm.ent_ports_range insert end $default(ports_range)
|
|
|
|
|
label $frm.lbl_ram_max -text "Максимальный объём памяти раб. процессов"
|
|
|
|
|
entry $frm.ent_ram_max
|
|
|
|
|
$frm.ent_ram_max insert end $default(ram_max)
|
|
|
|
|
label $frm.lbl_ram_sec -text "Безопасный расход памяти за вызов"
|
|
|
|
|
entry $frm.ent_ram_sec
|
|
|
|
|
$frm.ent_ram_sec insert end $default(ram_sec)
|
|
|
|
|
label $frm.lbl_ram_work -text "Объём памяти рабочих процессов"
|
|
|
|
|
entry $frm.ent_ram_work
|
|
|
|
|
$frm.ent_ram_work insert end $default(ram_work)
|
|
|
|
|
label $frm.lbl_base_on_process -text "Количество ИБ на процесс"
|
|
|
|
|
entry $frm.ent_base_on_process
|
|
|
|
|
$frm.ent_base_on_process insert end $default(base_on_process)
|
|
|
|
|
label $frm.lbl_connection_on_process -text "Количество соединений на процесс"
|
|
|
|
|
entry $frm.ent_connection_on_process
|
|
|
|
|
$frm.ent_connection_on_process insert end $default(connection_on_process)
|
|
|
|
|
label $frm.lbl_manager_port -text "Порт главного менеджера кластера"
|
|
|
|
|
entry $frm.ent_manager_port
|
|
|
|
|
$frm.ent_manager_port insert end $default(port)
|
|
|
|
|
label $frm.lbl_manager_each_service -text "Менеджер под каждый сервис"
|
|
|
|
|
checkbutton $frm.ent_manager_each_service -variable dedicate_manager -onvalue all -offvalue none
|
|
|
|
|
label $frm.lbl_central_server -text "Центральный сервер"
|
|
|
|
|
checkbutton $frm.ent_central_server -variable using_central_server -onvalue main -offvalue normal
|
|
|
|
|
|
|
|
|
|
grid $frm.lbl_server_desc -row 0 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_server_desc -row 0 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_host -row 1 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_host -row 1 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_port -row 2 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_port -row 2 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_ports_range -row 3 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_ports_range -row 3 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_ram_max -row 4 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_ram_max -row 4 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_ram_sec -row 5 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_ram_sec -row 5 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_ram_work -row 6 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_ram_work -row 6 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_base_on_process -row 7 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_base_on_process -row 7 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_connection_on_process -row 8 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_connection_on_process -row 8 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_manager_port -row 9 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_manager_port -row 9 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_manager_each_service -row 10 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_manager_each_service -row 10 -column 1 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_central_server -row 11 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_central_server -row 11 -column 1 -sticky nw -padx 5 -pady 5
|
|
|
|
|
|
|
|
|
|
#grid $frm.btn_ok -row 2 -column 1 -sticky nw -padx 5 -pady 5
|
|
|
|
|
#grid $frm.btn_cancel -row 2 -column 1 -sticky se -padx 5 -pady 5
|
|
|
|
|
grid columnconfigure $frm 0 -weight 1
|
|
|
|
|
grid rowconfigure $frm 0 -weight 1
|
|
|
|
|
set frm_btn [frame .add.frm_btn -border 0]
|
2018-05-27 12:40:36 +00:00
|
|
|
|
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command {
|
2018-05-22 09:39:17 +00:00
|
|
|
|
RunCommand "" "server insert \
|
|
|
|
|
--agent-host=[.add.frm.ent_host get] \
|
|
|
|
|
--agent-port=[.add.frm.ent_port get] \
|
|
|
|
|
--port-range=[.add.frm.ent_ports_range get] \
|
|
|
|
|
--name=[.add.frm.ent_server_desc get] \
|
|
|
|
|
--using=$using_central_server \
|
|
|
|
|
--infobases-limit=[.add.frm.ent_base_on_process get] \
|
|
|
|
|
--memory-limit=[.add.frm.ent_ram_work get] \
|
|
|
|
|
--connections-limit=[.add.frm.ent_connection_on_process get] \
|
|
|
|
|
--cluster-port=[.add.frm.ent_manager_port get] \
|
|
|
|
|
--dedicate-managers=$dedicate_manager \
|
|
|
|
|
--safe-working-processes-memory-limit=[.add.frm.ent_ram_max get] \
|
|
|
|
|
--safe-call-memory-limit=[.add.frm.ent_ram_sec get] \
|
|
|
|
|
--cluster=$active_cluster $host"
|
|
|
|
|
Run::servers $tree $host $active_cluster
|
|
|
|
|
destroy .add
|
2018-05-19 13:53:48 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
|
|
|
|
|
grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
|
|
|
|
|
grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
|
|
|
|
|
pack $frm_btn.btn_cancel -side right
|
|
|
|
|
pack $frm_btn.btn_ok -side right -padx 10
|
|
|
|
|
}
|
|
|
|
|
proc Add::work_server {tree host values} {
|
|
|
|
|
Add::servers $tree $host $values
|
|
|
|
|
}
|
|
|
|
|
proc Add::infobase {tree host values} {
|
|
|
|
|
Add::infobases $tree $host $values
|
|
|
|
|
}
|
|
|
|
|
proc Add::infobases {tree host values} {
|
|
|
|
|
global default active_cluster
|
2018-05-23 10:17:15 +00:00
|
|
|
|
global secure_level dbms block_shedule create_db license_distribution date_offset db_create
|
2018-05-24 08:37:34 +00:00
|
|
|
|
#set active_cluster $values
|
2018-05-23 10:17:15 +00:00
|
|
|
|
# установка значений по умолчанию
|
|
|
|
|
set license_distribution deny
|
|
|
|
|
set secure_level [lindex $default(secure_level) 0]
|
|
|
|
|
set date_offset [lindex $default(date_offset) 0]
|
|
|
|
|
set dbms [lindex $default(dbms) 0]
|
|
|
|
|
set block_shedule on
|
|
|
|
|
|
2018-05-22 09:39:17 +00:00
|
|
|
|
toplevel .add
|
|
|
|
|
wm title .add "Добавление информационной базы"
|
2018-05-27 12:40:36 +00:00
|
|
|
|
ttk::label .add.lbl -image database_grey_64
|
2018-05-22 09:39:17 +00:00
|
|
|
|
set frm [ttk::labelframe .add.frm -text "Добавление информационной базы" -labelanchor nw]
|
2018-05-23 10:17:15 +00:00
|
|
|
|
label $frm.lbl_infobase_name -text "Имя информационной базы"
|
|
|
|
|
entry $frm.ent_infobase_name
|
|
|
|
|
label $frm.lbl_infobase_descr -text "Описание"
|
|
|
|
|
entry $frm.ent_infobase_descr
|
|
|
|
|
label $frm.lbl_secure_connect -text "Защищённое соединение"
|
|
|
|
|
set combo_secure_level [ttk::combobox $frm.cb_secure_level\
|
|
|
|
|
-textvariable secure_level -values $default(secure_level)]]
|
|
|
|
|
label $frm.lbl_host -text "Адрес сервера баз данных"
|
|
|
|
|
entry $frm.ent_host
|
|
|
|
|
label $frm.lbl_base_type -text "Тип СУБД"
|
|
|
|
|
ttk::combobox $frm.cb_base_type -textvariable dbms -values $default(dbms)]
|
|
|
|
|
label $frm.lbl_base_name -text "База данных"
|
|
|
|
|
entry $frm.ent_base_name
|
|
|
|
|
label $frm.lbl_db_user -text "Имя пользователя базы данных"
|
|
|
|
|
entry $frm.ent_db_user
|
2018-05-22 09:39:17 +00:00
|
|
|
|
label $frm.lbl_db_pass -text "Пароль"
|
2018-05-23 10:17:15 +00:00
|
|
|
|
entry $frm.ent_db_pass
|
2018-05-22 09:39:17 +00:00
|
|
|
|
#$frm.ent_host insert end $host
|
|
|
|
|
label $frm.lbl_locale -text "Язык базы данных"
|
|
|
|
|
entry $frm.ent_locale
|
|
|
|
|
$frm.ent_locale insert end $default(locale)
|
2018-05-23 10:17:15 +00:00
|
|
|
|
label $frm.lbl_date_offset -text "Смещение дат"
|
|
|
|
|
set combo_date_offset [ttk::combobox $frm.cb_date_offset \
|
|
|
|
|
-textvariable date_offset -values $default(date_offset)]]
|
|
|
|
|
label $frm.lbl_license_distribution -justify left -anchor nw -text "Разрешить выдачу лицензий\nсервером 1С"
|
|
|
|
|
checkbutton $frm.cb_license_distribution -variable license_distribution -onvalue allow -offvalue deny
|
|
|
|
|
label $frm.lbl_create_db -text "Создать БД в случае её отсутствия"
|
|
|
|
|
checkbutton $frm.cb_create_db -variable create_db -onvalue true -offvalue false
|
|
|
|
|
label $frm.lbl_block_shedule -text "Блокировка регламентных заданий"
|
|
|
|
|
checkbutton $frm.cb_block_shedule -variable block_shedule -onvalue on -offvalue off
|
|
|
|
|
|
|
|
|
|
grid $frm.lbl_infobase_name -row 0 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_infobase_name -row 0 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_infobase_descr -row 1 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_infobase_descr -row 1 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_secure_connect -row 2 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.cb_secure_level -row 2 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_host -row 3 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_host -row 3 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_base_type -row 4 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.cb_base_type -row 4 -column 1 -sticky nsew -padx 5 -pady 5
|
2018-05-22 09:39:17 +00:00
|
|
|
|
grid $frm.lbl_base_name -row 5 -column 0 -sticky nw -padx 5 -pady 5
|
2018-05-23 10:17:15 +00:00
|
|
|
|
grid $frm.ent_base_name -row 5 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_db_user -row 6 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_db_user -row 6 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_db_pass -row 7 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_db_pass -row 7 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_locale -row 8 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_locale -row 8 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_date_offset -row 9 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.cb_date_offset -row 9 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_license_distribution -row 10 -column 0 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.cb_license_distribution -row 10 -column 1 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_create_db -row 11 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.cb_create_db -row 11 -column 1 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_block_shedule -row 12 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.cb_block_shedule -row 12 -column 1 -sticky nw -padx 5 -pady 5
|
|
|
|
|
|
2018-05-22 09:39:17 +00:00
|
|
|
|
grid columnconfigure $frm 0 -weight 1
|
|
|
|
|
grid rowconfigure $frm 0 -weight 1
|
|
|
|
|
|
2018-05-24 08:37:34 +00:00
|
|
|
|
#set active_cluster $values
|
2018-05-23 10:17:15 +00:00
|
|
|
|
# Проверяем значение чекбокса и выставляем соответсвющую опцию
|
|
|
|
|
if {$create_db eq "true"} {
|
|
|
|
|
set db_create "--create-database"
|
|
|
|
|
} else {
|
|
|
|
|
set db_create ""
|
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
|
|
|
|
|
set frm_btn [frame .add.frm_btn -border 0]
|
2018-05-27 12:40:36 +00:00
|
|
|
|
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command {
|
2018-05-23 10:17:15 +00:00
|
|
|
|
RunCommand "" "infobase create $db_create \
|
2018-05-22 09:39:17 +00:00
|
|
|
|
--name=[.add.frm.ent_infobase_name get] \
|
|
|
|
|
--dbms=$dbms \
|
|
|
|
|
--db-server=[.add.frm.ent_host get] \
|
|
|
|
|
--db-name=[.add.frm.ent_base_name get] \
|
|
|
|
|
--locale=[.add.frm.ent_locale get] \
|
|
|
|
|
--db-user=[.add.frm.ent_db_user get] \
|
|
|
|
|
--db-pwd=[.add.frm.ent_db_pass get] \
|
2018-05-23 10:17:15 +00:00
|
|
|
|
--descr=[.add.frm.ent_infobase_descr get] \
|
|
|
|
|
--date-offset=$date_offset
|
|
|
|
|
--security-level=$secure_level
|
|
|
|
|
--scheduled-jobs-deny=$block_shedule
|
|
|
|
|
--license-distribution=$license_distribution
|
2018-05-22 09:39:17 +00:00
|
|
|
|
--cluster=$active_cluster $host"
|
2018-05-23 10:17:15 +00:00
|
|
|
|
Run::infobases $tree $host $active_cluster
|
2018-05-22 09:39:17 +00:00
|
|
|
|
destroy .add
|
2018-05-20 15:03:02 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
|
|
|
|
|
grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
|
|
|
|
|
grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
|
|
|
|
|
pack $frm_btn.btn_cancel -side right
|
|
|
|
|
pack $frm_btn.btn_ok -side right -padx 10
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proc Add::cluster {tree host values} {
|
|
|
|
|
global default
|
|
|
|
|
toplevel .add
|
|
|
|
|
wm title .add "Добавление кластера"
|
|
|
|
|
ttk::label .add.lbl -image cluster_grey_64
|
|
|
|
|
set frm [ttk::labelframe .add.frm -text "Добавление кластера" -labelanchor nw]
|
2018-05-20 15:03:02 +00:00
|
|
|
|
|
2018-05-22 09:39:17 +00:00
|
|
|
|
label $frm.lbl_host -text "Адрес основного сервера"
|
|
|
|
|
entry $frm.ent_host
|
|
|
|
|
#$frm.ent_host insert end $host
|
|
|
|
|
label $frm.lbl_port -text "Порт"
|
|
|
|
|
entry $frm.ent_port
|
|
|
|
|
$frm.ent_port insert end $default(port)
|
|
|
|
|
label $frm.lbl_cluster_name -text "Название кластера"
|
|
|
|
|
entry $frm.ent_cluster_name
|
|
|
|
|
|
|
|
|
|
grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_host -row 0 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_port -row 1 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_port -row 1 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
grid $frm.lbl_cluster_name -row 2 -column 0 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm.ent_cluster_name -row 2 -column 1 -sticky nsew -padx 5 -pady 5
|
|
|
|
|
|
|
|
|
|
grid columnconfigure $frm 0 -weight 1
|
|
|
|
|
grid rowconfigure $frm 0 -weight 1
|
|
|
|
|
set frm_btn [frame .add.frm_btn -border 0]
|
2018-05-27 12:40:36 +00:00
|
|
|
|
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command {
|
2018-05-22 09:39:17 +00:00
|
|
|
|
RunCommand "" "cluster insert \
|
|
|
|
|
--host=[.add.frm.ent_host get] \
|
|
|
|
|
--port=[.add.frm.ent_port get] \
|
2018-05-24 08:37:34 +00:00
|
|
|
|
--name=[.add.frm.ent_cluster_name get] $host"
|
2018-05-22 09:39:17 +00:00
|
|
|
|
destroy .add
|
2018-05-18 09:13:43 +00:00
|
|
|
|
}
|
2018-05-22 09:39:17 +00:00
|
|
|
|
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
|
|
|
|
|
grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
|
|
|
|
|
grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
|
|
|
|
|
grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
|
|
|
|
|
pack $frm_btn.btn_cancel -side right
|
|
|
|
|
pack $frm_btn.btn_ok -side right -padx 10
|
2018-05-18 09:13:43 +00:00
|
|
|
|
}
|
2018-05-20 15:03:02 +00:00
|
|
|
|
proc SaveMainServer {host port} {
|
|
|
|
|
global dir
|
|
|
|
|
set file [open [file join $dir(work) 1c_srv.cfg] "a+"]
|
|
|
|
|
puts $file "$host:$port"
|
|
|
|
|
close $file
|
|
|
|
|
return "$host:$port"
|
|
|
|
|
}
|
2018-05-23 10:17:15 +00:00
|
|
|
|
|
2018-05-24 08:37:34 +00:00
|
|
|
|
|
|
|
|
|
|
2018-05-27 12:40:36 +00:00
|
|
|
|
|