From 3fde9aa85e6068803a0989faf7d620ed3f05f856 Mon Sep 17 00:00:00 2001 From: Sergey Kalinin Date: Tue, 12 Jun 2018 19:14:52 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D0=B4=D1=83=D1=80?= =?UTF-8?q?=D1=8B=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=B0,=20=D0=BA=D0=BB=D0=B0=D1=81=D1=82=D0=B5=D1=80?= =?UTF-8?q?=D0=B0=20=D0=B8=20=D0=B1=D0=B0=D0=B7=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README | 5 +- lib/function.tcl | 400 ++++++++++++++++++++++++++++++++++++----------- lib/gui.tcl | 10 +- lib/images.tcl | 85 +++++++++- rac_gui.cfg | 30 ++-- 5 files changed, 424 insertions(+), 106 deletions(-) diff --git a/README b/README index 446bdad..5b42f9e 100644 --- a/README +++ b/README @@ -7,4 +7,7 @@ ###################################################### "Rac GUI" - это графическая оболочка для утилиты управления кластером серверов 1С. -Для работы требуется Tcl/Tk не ниже 8.6 версии и пакет 1c-server куда входит утилита rac. \ No newline at end of file +Для работы требуется Tcl/Tk не ниже 8.6 версии и пакет 1c-server куда входит утилита rac. + + +Иконки взяты с сайта https://www.iconsdb.com/royal-blue-icons/ diff --git a/lib/function.tcl b/lib/function.tcl index 1c13f31..5bf4247 100644 --- a/lib/function.tcl +++ b/lib/function.tcl @@ -23,7 +23,7 @@ proc TreePress {tree} { } elseif {$key eq "work_server"} { set server $values } - puts "$id $host $values" + #puts "$id $host $values" Run::$key $tree $host $values #RunCommand $root "infobase summary list --cluster=$cluster $host" } @@ -34,7 +34,10 @@ namespace eval Run {} {} proc Run::server {tree host values} { set lst [RunCommand server::$host "cluster list $host"] set l [lindex $lst 0] + #puts $lst + .frm_work.tree_work delete [ .frm_work.tree_work children {}] foreach cluster_list $lst { + InsertItemsWorkList $cluster_list foreach i $cluster_list { puts $i set cluster_list [split $i ":"] @@ -634,6 +637,7 @@ proc Add::server {} { destroy .add return $host } + return $frm } proc Add::servers {tree host values} { global default dedicate_manager using_central_server @@ -727,7 +731,7 @@ proc Add::infobase {tree host values} { } proc Add::infobases {tree host values} { global default active_cluster - global secure_level dbms block_shedule create_db license_distribution date_offset db_create + global security_level dbms sheduled_jobs_deny create_db license_distribution date_offset db_create #set active_cluster $values # установка значений по умолчанию set license_distribution deny @@ -738,19 +742,18 @@ proc Add::infobases {tree host values} { set frm [AddToplevel "Добавление информационной базы" database_grey_64] - 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_name -text "Имя информационной базы" + entry $frm.ent_name + label $frm.lbl_descr -text "Описание" + entry $frm.ent_descr + label $frm.lbl_security_level -text "Защищённое соединение" + ttk::combobox $frm.cb_security_level -textvariable security_level -values $default(secure_level) + label $frm.lbl_db_server -text "Адрес сервера баз данных" + entry $frm.ent_db_server + label $frm.lbl_dbms -text "Тип СУБД" + ttk::combobox $frm.cb_dbms -textvariable dbms -values $default(dbms) + label $frm.lbl_db_name -text "База данных" + entry $frm.ent_db_name label $frm.lbl_db_user -text "Имя пользователя базы данных" entry $frm.ent_db_user label $frm.lbl_db_pass -text "Пароль" @@ -760,41 +763,40 @@ proc Add::infobases {tree host values} { entry $frm.ent_locale $frm.ent_locale insert end $default(locale) label $frm.lbl_date_offset -text "Смещение дат" - set combo_date_offset [ttk::combobox $frm.cb_date_offset \ - -textvariable date_offset -values $default(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 + label $frm.lbl_sheduled_jobs_deny -text "Блокировка регламентных заданий" + checkbutton $frm.cb_sheduled_jobs_deny -variable sheduled_jobs_deny -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 - grid $frm.lbl_base_name -row 5 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_base_name -row 5 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_name -row 0 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_name -row 0 -column 1 -sticky new -padx 5 -pady 5 + grid $frm.lbl_descr -row 1 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_descr -row 1 -column 1 -sticky new -padx 5 -pady 5 + grid $frm.lbl_security_level -row 2 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.cb_security_level -row 2 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_db_server -row 3 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_db_server -row 3 -column 1 -sticky new -padx 5 -pady 5 + grid $frm.lbl_dbms -row 4 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.cb_dbms -row 4 -column 1 -sticky new -padx 5 -pady 5 + grid $frm.lbl_db_name -row 5 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_db_name -row 5 -column 1 -sticky new -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.ent_db_user -row 6 -column 1 -sticky new -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.ent_db_pass -row 7 -column 1 -sticky new -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.ent_locale -row 8 -column 1 -sticky new -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.cb_date_offset -row 9 -column 1 -sticky nw -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 + grid $frm.lbl_sheduled_jobs_deny -row 12 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.cb_sheduled_jobs_deny -row 12 -column 1 -sticky nw -padx 5 -pady 5 #set active_cluster $values # Проверяем значение чекбокса и выставляем соответсвющую опцию @@ -807,26 +809,40 @@ proc Add::infobases {tree host values} { } RunCommand "" "infobase create $db_create \ - --name=[.add.frm.ent_infobase_name get] \ + --name=[.add.frm.ent_name get] \ --dbms=$dbms \ - --db-server=[.add.frm.ent_host get] \ - --db-name=[.add.frm.ent_base_name get] \ + --db-server=[.add.frm.ent_db_server get] \ + --db-name=[.add.frm.ent_db_name get] \ --locale=[.add.frm.ent_locale get] \ --db-user=[.add.frm.ent_db_user get] \ --db-pwd=[.add.frm.ent_db_pass get] \ - --descr=\"[.add.frm.ent_infobase_descr get]\" \ + --descr=\"[.add.frm.ent_descr get]\" \ --date-offset=$date_offset \ - --security-level=$secure_level \ - --scheduled-jobs-deny=$block_shedule \ + --security-level=$security_level \ + --scheduled-jobs-deny=$sheduled_jobs \ --license-distribution=$license_distribution \ --cluster=$active_cluster $host" Run::infobases $tree $host $active_cluster destroy .add } + return $frm } proc Add::cluster {tree host values} { - global default + global default lifetime_limit expiration_timeout session_fault_tolerance_level + global max_memory_size max_memory_time_limit errors_count_threshold security_level + global load_balancing_mode kill_problem_processes + + puts "$tree $host $values" + + set lifetime_limit $default(lifetime_limit) + set expiration_timeout $default(expiration_timeout) + set session_fault_tolerance_level $default(session_fault_tolerance_level) + set max_memory_size $default(max_memory_size) + set max_memory_time_limit $default(max_memory_time_limit) + set errors_count_threshold $default(errors_count_threshold) + set secure_level [lindex $default(secure_level) 0] + set load_balancing_mode [lindex $default(load_balancing_mode) 0] set frm [AddToplevel "Добавление кластера" cluster_grey_64] @@ -835,69 +851,74 @@ proc Add::cluster {tree host values} { 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 + label $frm.lbl_name -text "Название кластера" + entry $frm.ent_name label $frm.lbl_secure_connect -text "Защищённое соединение" - set combo_secure_level [ttk::combobox $frm.cb_secure_connect\ - -textvariable secure_level -values $default(secure_level)] - label $frm.lbl_process_off_time -text "Останавливать выключенные процессы через:" - entry $frm.ent_process_off_time - label $frm.lbl_level -text "Уровень отказоустойчивости" - entry $frm.ent_level - label $frm.lbl_load_balancing -text "Режим распределения нагрузки" - set combo_load_balancing [ttk::combobox $frm.cb_load_balancing\ - -textvariable load_balancing -values $default(load_balancing)] + ttk::combobox $frm.cb_security_level -textvariable security_level -values $default(secure_level) + label $frm.lbl_expiration_timeout -text "Останавливать выключенные процессы через:" + entry $frm.ent_expiration_timeout -textvariable expiration_timeout + label $frm.lbl_session_fault_tolerance_level -text "Уровень отказоустойчивости" + entry $frm.ent_session_fault_tolerance_level -textvariable session_fault_tolerance_level + label $frm.lbl_load_balancing_mode -text "Режим распределения нагрузки" + ttk::combobox $frm.cb_load_balancing_mode -textvariable load_balancing_mode \ + -values $default(load_balancing_mode) + label $frm.lbl_errors_count_threshold -text "Допустимое отклонение количества ошибок сервера, %" + entry $frm.ent_errors_count_threshold -textvariable errors_count_threshold label $frm.lbl_processes -text "Рабочие процессы:" - label $frm.lbl_interval -text "Интервал перезапуска, сек." - entry $frm.ent_interval - label $frm.lbl_memory -text "Допустимый объём памяти, КБ" - entry $frm.ent_memory - label $frm.lbl_memory_interval -text "Интервал превышения допустимого объёма памяти, сек." - entry $frm.ent_memory_interval - label $frm.lbl_errors -text "Допустимое отклонение количества ошибок сервера, %" - entry $frm.ent_errors - label $frm.lbl_process -justify left -anchor nw -text "Принудительно завершать проблемные процессы" - checkbutton $frm.cb_process -variable license_distribution -onvalue allow -offvalue deny + label $frm.lbl_lifetime_limit -text "Период перезапуска, сек." + entry $frm.ent_lifetime_limit -textvariable lifetime_limit + label $frm.lbl_max_memory_size -text "Допустимый объём памяти, КБ" + entry $frm.ent_max_memory_size -textvariable max_memory_size + label $frm.lbl_max_memory_time_limit -text "Интервал превышения допустимого объёма памяти, сек." + entry $frm.ent_max_memory_time_limit -textvariable max_memory_time_limit + label $frm.lbl_kill_problem_processes -justify left -anchor nw -text "Принудительно завершать проблемные процессы" + checkbutton $frm.check_kill_problem_processes -variable kill_problem_processes -onvalue yes -offvalue no 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 $frm.lbl_name -row 2 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_name -row 2 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.lbl_secure_connect -row 3 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.cb_secure_connect -row 3 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_process_off_time -row 4 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_process_off_time -row 4 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_level -row 5 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_level -row 5 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_load_balancing -row 6 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.cb_load_balancing -row 6 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_processes -row 7 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.lbl_interval -row 8 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_interval -row 8 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_memory -row 9 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_memory -row 9 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_memory_interval -row 10 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_memory_interval -row 10 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_process -row 11 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.cb_process -row 11 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.cb_security_level -row 3 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_expiration_timeout -row 4 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_expiration_timeout -row 4 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_session_fault_tolerance_level -row 5 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_session_fault_tolerance_level -row 5 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_load_balancing_mode -row 6 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.cb_load_balancing_mode -row 6 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_errors_count_threshold -row 7 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_errors_count_threshold -row 7 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_processes -row 8 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_lifetime_limit -row 9 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_lifetime_limit -row 9 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_max_memory_size -row 10 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_max_memory_size -row 10 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_max_memory_time_limit -row 11 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_max_memory_time_limit -row 11 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_kill_problem_processes -row 12 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.check_kill_problem_processes -row 12 -column 1 -sticky nw -padx 5 -pady 5 .add.frm_btn.btn_ok configure -command { RunCommand "" "cluster insert \ --host=[.add.frm.ent_host get] \ --port=[.add.frm.ent_port get] \ - --name=[.add.frm.ent_cluster_name get] $host" + --name=[.add.frm.ent_name get] \ + --expiration-timeout=$expiration_timeout \ + --lifetime-limit=$lifetime_limit \ + --max-memory-size=$max_memory_size \ + --max-memory-time-limit=$max_memory_time_limit \ + --security-level=$security_level \ + --session-fault-tolerance-level=$session_fault_tolerance_level \ + --load-balancing-mode=$load_balancing_mode \ + --errors-count-threshold=$errors_count_threshold \ + --kill-problem-processes=$kill_problem_processes \ + $host" Run::server $tree $host "" destroy .add } - # 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::rule {tree host values} { @@ -972,5 +993,204 @@ proc SaveMainServer {host port} { return "$host:$port" } +proc Edit {} { + global active_cluster host + set tree .frm_tree.tree + set id [.frm_tree.tree selection] + set values [.frm_tree.tree item $id -values] + set key [lindex [split $id "::"] 0] + + Edit::$key $tree $host $values +} +namespace eval Edit {} {} +proc Edit::server {tree host value} { + global dir prev_address + + set frm [Add::server] + $frm configure -text "Редактирование основного сервера" + set lst [split $value ":"] + set prev_address $value + .add.frm.ent_host delete 0 end + .add.frm.ent_port delete 0 end + .add.frm.ent_host insert end [lindex $lst 0] + .add.frm.ent_port insert end [lindex $lst 1] + .add.frm_btn.btn_ok configure -command { + set host "[.add.frm.ent_host get]:[.add.frm.ent_port get]" + .frm_tree.tree delete "server::$prev_address" + .frm_work.tree_work delete [ .frm_work.tree_work children {}] + .frm_tree.tree insert {} end -id "server::$host" -text "$host" -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 } { + if { $line eq "$prev_address"} { + puts $file $host + } else { + puts $file $line + } + } + close $file + close $orig_file + #return "$host:$port" + file delete [file join $dir(work) 1c_srv.cfg.bak] + destroy .add + return $host + } +} + +proc Edit::cluster {tree host values} { + global default lifetime_limit expiration_timeout session_fault_tolerance_level + global max_memory_size max_memory_time_limit errors_count_threshold security_level + global load_balancing_mode kill_problem_processes active_cluster + + Add::cluster $tree $host $values + set active_cluster $values + set lst [RunCommand cluster::$values "cluster info --cluster=$active_cluster $host"] + foreach i [lindex $lst 0] { + if [regexp -nocase -all -- {(\D+)(\s*?|)(:)(\s*?|)(.*)} $i match param v2 v3 v4 value] { + regsub -all -- "-" [string trim $param] "_" entry_name + if [winfo exists .add.frm.ent_$entry_name] { + .add.frm.ent_$entry_name delete 0 end + .add.frm.ent_$entry_name insert end [string trim $value "\""] + } + if [winfo exists .add.frm.cb_$entry_name] { + set $entry_name [string trim $value "\""] + } + if [winfo exists .add.frm.check_$entry_name] { + if {$value eq "0"} { + set $entry_name no + } elseif {$value eq "1"} { + set $entry_name yes + } + } + } + } + .add.frm.ent_host configure -state disable + .add.frm.ent_port configure -state disable + + .add.frm_btn.btn_ok configure -command { + RunCommand "" "cluster update \ + --cluster=$active_cluster \ + --name=[.add.frm.ent_name get] \ + --expiration-timeout=$expiration_timeout \ + --lifetime-limit=$lifetime_limit \ + --max-memory-size=$max_memory_size \ + --max-memory-time-limit=$max_memory_time_limit \ + --security-level=$security_level \ + --session-fault-tolerance-level=$session_fault_tolerance_level \ + --load-balancing-mode=$load_balancing_mode \ + --errors-count-threshold=$errors_count_threshold \ + --kill-problem-processes=$kill_problem_processes \ + $host" + $tree delete "cluster::$active_cluster" + Run::server $tree $host "" + destroy .add + } +} +proc Edit::infobase {tree host values} { + global default active_cluster + global secure_level dbms sheduled_jobs_deny create_db license_distribution date_offset db_create + + set frm [Add::infobases $tree $host $values] + $frm configure -text "Редактирование информационной базы" + #set active_cluster $values + label $frm.lbl_denied_from -text "Начало интервала времени действия\nрежима блокировки сеансов" \ + -justify left -anchor nw + entry $frm.ent_denied_from + label $frm.lbl_denied_message -text "Cообщение, при попытке нарушения\nблокировки сеансов" \ + -justify left -anchor nw + entry $frm.ent_denied_message + label $frm.lbl_denied_parameter -text "Параметр блокировки сеансов" + entry $frm.ent_denied_parameter + label $frm.lbl_denied_to -text "Конец интервала времени действия\nрежима блокировки сеансов" \ + -justify left -anchor nw + entry $frm.ent_denied_to + label $frm.lbl_permission_code -text "Код разрешения начала сеанса\nвопреки блокировке сеансов" \ + -justify left -anchor nw + entry $frm.ent_permission_code + label $frm.lbl_sessions_deny -text "Режим блокировки сеансов" + checkbutton $frm.cb_sessions_deny -variable sessions_deny -onvalue on -offvalue off + label $frm.lbl_external_session_manager_connection_string \ + -text "Параметры внешнего управления сеансами" + checkbutton $frm.cb_external_session_manager_connection_string \ + -variable external_session_manager_connection_string -onvalue yes -offvalue no + label $frm.lbl_external_session_manager_required -text "Внешнее управление сеансами" + checkbutton $frm.cb_external_session_manager_required \ + -variable external_session_manager_required -onvalue yes -offvalue no + label $frm.lbl_security_profile -text "Профиль безопасности информационной базы" + entry $frm.ent_security_profile + label $frm.lbl_safe_mode_security_profile -text "Профиль безопасности внешнего кода" + entry $frm.ent_safe_mode_security_profile + + grid $frm.lbl_denied_from -row 0 -column 2 -sticky nsw -padx 5 -pady 5 + grid $frm.ent_denied_from -row 0 -column 3 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_denied_message -row 1 -column 2 -sticky nsw -padx 5 -pady 5 + grid $frm.ent_denied_message -row 1 -column 3 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_denied_parameter -row 2 -column 2 -sticky nw -padx 5 -pady 5 + grid $frm.ent_denied_parameter -row 2 -column 3 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_denied_to -row 3 -column 2 -sticky nsw -padx 5 -pady 5 + grid $frm.ent_denied_to -row 3 -column 3 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_permission_code -row 4 -column 2 -sticky nsw -padx 5 -pady 5 + grid $frm.ent_permission_code -row 4 -column 3 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_sessions_deny -row 5 -column 2 -sticky nw -padx 5 -pady 5 + grid $frm.cb_sessions_deny -row 5 -column 3 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_external_session_manager_required -row 6 -column 2 -sticky nw -padx 5 -pady 5 + grid $frm.cb_external_session_manager_required -row 6 -column 3 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_external_session_manager_connection_string \ + -row 7 -column 2 -sticky nw -padx 5 -pady 5 + grid $frm.cb_external_session_manager_connection_string \ + -row 7 -column 3 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_security_profile -row 8 -column 2 -sticky nw -padx 5 -pady 5 + grid $frm.ent_security_profile -row 8 -column 3 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_safe_mode_security_profile -row 9 -column 2 -sticky nw -padx 5 -pady 5 + grid $frm.ent_safe_mode_security_profile -row 9 -column 3 -sticky nw -padx 5 -pady 5 + + set lst [RunCommand infobase::$values "infobase info --cluster=$active_cluster --infobase=$values $host"] + puts $lst + foreach i [lindex $lst 0] { + if [regexp -nocase -all -- {(\D+)(\s*?|)(:)(\s*?|)(.*)} $i match param v2 v3 v4 value] { + regsub -all -- "-" [string trim $param] "_" entry_name + if [winfo exists .add.frm.ent_$entry_name] { + .add.frm.ent_$entry_name delete 0 end + .add.frm.ent_$entry_name insert end [string trim $value "\""] + } + if [winfo exists .add.frm.cb_$entry_name] { + set $entry_name [string trim $value "\""] + } + if [winfo exists .add.frm.check_$entry_name] { + if {$value eq "0"} { + set $entry_name no + } elseif {$value eq "1"} { + set $entry_name yes + } + } + } + } + + .add.frm_btn.btn_ok configure -command { + if {$create_db eq "true"} { + set db_create "--create-database" + } else { + set db_create "" + } + + RunCommand "" "infobase create $db_create \ + --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] \ + --descr=\"[.add.frm.ent_infobase_descr get]\" \ + --date-offset=$date_offset \ + --security-level=$secure_level \ + --scheduled-jobs-deny=$block_shedule \ + --license-distribution=$license_distribution \ + --cluster=$active_cluster $host" + Run::infobases $tree $host $active_cluster + destroy .add + } +} diff --git a/lib/gui.tcl b/lib/gui.tcl index 8614c93..6a19fbb 100644 --- a/lib/gui.tcl +++ b/lib/gui.tcl @@ -40,10 +40,13 @@ ttk::style theme use clam ttk::button $frm_tool.btn_add -command Add -image add_grey_32 ttk::button $frm_tool.btn_del -command Del -image del_grey_32 +ttk::button $frm_tool.btn_edit -command Edit -image edit_grey_32 ttk::button $frm_tool.btn_quit -command Quit -image quit_grey_32 -pack $frm_tool.btn_add $frm_tool.btn_del $frm_tool.btn_quit -side top -padx 5 -pady 5 - +pack $frm_tool.btn_add $frm_tool.btn_del $frm_tool.btn_edit -side top -padx 5 -pady 5 +#label $frm_tool.lbl_logo -image tcl +pack $frm_tool.btn_quit -side bottom -padx 5 -pady 5 +#pack $frm_tool.lbl_logo -side bottom -padx 5 -pady 5 set frm_tree [frame .frm_tree] ttk::scrollbar $frm_tree.hsb1 -orient horizontal -command [list $frm_tree.tree xview] @@ -92,6 +95,3 @@ pack $frm_tree $frm_work -side left -expand true -fill both .panel add $frm_tree -weight 1 .panel add $frm_work -weight 1 - - - diff --git a/lib/images.tcl b/lib/images.tcl index 9fa1668..c5456c1 100644 --- a/lib/images.tcl +++ b/lib/images.tcl @@ -7,7 +7,7 @@ ###################################################### # # Base64 Images library -# +# Icons from https://www.iconsdb.com/royal-blue-icons/ ###################################################### image create photo del_color_32 -data { @@ -345,3 +345,86 @@ image create photo functional_grey_64 -data { URC98ZfkYi/JPMaP1CLx7eFWlrGUi2Skp1VbB+EnslnNA7JDChnDJLE00h9h/wOGHvYXgTBjIgAA AABJRU5ErkJggg== } +image create photo tcl -data { + iVBORw0KGgoAAAANSUhEUgAAACAAAAB1CAQAAACFMCs7AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAA + CxMAAAsTAQCanBgAAAAHdElNRQfiBgoICTJgo76cAAAAHWlUWHRDb21tZW50AAAAAABDcmVhdGVk + IHdpdGggR0lNUGQuZQcAAAzbSURBVFjDnZl/dFXVlcc/59z7XpKX3wkQQmIsEBwMASuo+BttrVbH + apFhtDoCTqcy2s5ylLajLh1rV0c6g2tNdcTlr7X6Y43WUdQRLVh/BEvRKkOwElRAQRPIb/LzJe/X + veec+ePde999IcQZblaSd989e5/v3vu799nnXMGU1zYu5tfN4p3usuy97c65o/nRtaolGCGnEt/M + xfzu7sG2zjL/G8f+9OF3723hrWCMOL74Vi5n082HHjcITOh7ycK7vvnzP3LB1Ao+YgEvnN2+3YlM + fGIojJ+0aMUXU5pgWMDRut43MpFjnwkypamfweMAWJMrGOXZwi3/PTTveADHFt3btuKTKRD8Ozu/ + NnT+8R2kabvbRKeMwtjzasoIpU99bu5xFAwAz63vjokpGeLGIn8FZvIobD9pd2t6Ol9ylcZvLZsE + QSfQeWXmS8UF8dIXr5xEQR0wslF/mTwG6L/RTFRggE2P9AvBl18aZ+nWKjkR2HvTu5YX/B/mNxgS + 1aO19sRHHUvSs8wkAgo7NHdWgVOcbshD0AakN6hJZnQCcY1CobL/hVmap2AhHcu6msWkCixP2KAw + aDQGj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qo + EH0lI3QjcKhnlnJWHEz3njapgkXsq9ly8eZ1smvlPQV7HOUf+/kLTIQ5fLhzdvTttcPdvoydf3r3 + 6aD1wdjhsn2fjJ87WMFTFIeaiiQXsoubTKbqosehk7rJ3i90MQunKJJ8+Jkj3ylmLjvpIkEZaRwq + qaSGr/Y0n3fyIY73imQWXY1t33tp5/xDjZcNmT+QZBF1ZJDAMF1UkV6eHoTjKuhj1meLH15+Vkes + 7Ndnv1ifVuyiB+MdTjTCP53R8Uo8LDHhBcUGP5wtavjAiljVYumSIUkEh1qstoYDyrn+02d4Yeq3 + PD0Ix2y+aIPd/y5RyrGBKGm3ruOkf7xoG1x/fBOy10ze5fSeok1NegmGOAqDoKa9ZolcITK35I21 + Jz87P5fPmD2wf77zqn2hi0OKCDNilT9ctq2VJRNO46e4Oqf1X9Iueq5yrtuOoOma+17ixK6myHWd + K836hyd7NsWLmFy4H42YAUPn+fn945cqqAo+LUtXxdOMn2Zmi/+PgpCj1Kz3HdLykcWcmAK4cIvF + KF3nnbCCZW/WoYif8V8Rc2IKwPrQor+BSnGiCgq2CjL2bpsTVVD5GdhinjlhBeWb5x4+46Xv9k78 + /n8Bmm0zuuQCHF0AAAAASUVORK5CYII= +} +image create photo edit_grey_32 -data { + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAA + CxMAAAsTAQCanBgAAAAHdElNRQfiBgwJNwW9cjUFAAADdElEQVRIx33VbWjWVRzG8c/+biFjyRxT + xGKMpUglKuVDkA+pzdJWtL2KnIalxpElhoiV2ciRS5coIR6cFjHKDCoy0KBcYvZy5ZACXT6MISoy + dOzFWsuHXuzmdve9e503/xfn973O+f0P1/XLk2OFfHNVekyFYolendqdcDz2D6/NGwaXesNqE3Po + 9mjRFC//j0BIrNOg2Mir304fxIGcAqHYl55NFx53wlm9EmOUW2CJMam931XHrmECYbxWU8ENTZrj + jazWitTa4kFwWWU8myEQip00DXzr9didgRYo0htvE4rssA5c8WTsTAuExBFVoD5uy4AXOuKOf/RY + HU9BWOkT+ThjTuwnAWtT+NZMHC0+tFSRNkfDF2EcscVr7mCa+tQNQrELSvBdrM7qe7d5cWb4RhKr + wzjX/eDFOEDYbQMGPBwvJqhTgl4hC58uqAkLVVqOJW6ZbDJ4Wyfus5kkJNaAPfFaBj7KJntil3dt + jH3hfh9b4aD3IfYPftWGosRMZbhlf1b30822PTynxOfYpC0eVuZqavewbhSqSjwFfo1XsgQ+tT/2 + OqAp/h1KrVIXyizTOLgZ+30PFiceB61Z/QelcVfY41o8hG2Oxr/s1TLkmBNgRr5ycD4Dn6jR0vCQ + tWYQZlulPNSY65UhRR2gPElZpz/DUhv1qXHM3tgR8hxS76Zma+PNDFtBfn4OxxWa7ZIHnBFCgatu + x53hPWfi17nsma8XjM6weIFl8QZhis02WBRKrfB8FjlIDCQ6waQMgTsKIZ6zRrMqW7U6lyUwSHQl + fgMLMwTy3E091237rbZcU7ybJTBItCd+BvPDhIzrrUxb+RnUxwtZz3yfFwafP9GmE/lDnJAnz/Zw + gLDIJVWesG/Yv3vJePQ5lkd4SyN6TInXIYz1i6m4rFhD3JkjtUf7UwU+i6sS7NONYjFdMQoc82gu + HI0qMKCRhNhrC6gJ74DEWKc9Yt296Mw4f6X1Kf92pM6addock7B41r9tp2YVOB/Xt3W33c2J1zoo + H394ue3WvVAtcTKVycNCdQhcqFGdBFfMixczY32Cn9KxvkNz7BkG19qiLJXJi7NiPXWLrzydtsqP + WnXow2gVFliWHiztqgcjPddoq9OQLsw92j7SMMJoS0+oN71q/AjDdVf2y+SNMN7nqzRDhRKJHl3a + teYe7/8B1Twh8S2jaPYAAAAASUVORK5CYII= +} diff --git a/rac_gui.cfg b/rac_gui.cfg index 96ab939..7ff275e 100644 --- a/rac_gui.cfg +++ b/rac_gui.cfg @@ -76,19 +76,30 @@ set default(type) { } # Приоритет set default(priority) 0 -# Интервал перезапуска рабочих процессов -set default(interval) 0 -# максимальный объем виртуального адресного пространства (в килобайтах), -# занятого рабочим процессом -set default(memory) 0 -# Интервал превышения допустимого объема памяти (сек.) -set default(memory_interval) 0 + +# Период перезапуска рабочих процессов кластера в секундах +set default(lifetime_limit) 0 + +# Период принудительного завершения процесса в секундах +set default(expiration_timeout) 0 + +# максимальный объем виртуального адресного пространства +# занятого рабочим процессом в килобайтах +set default(max_memory_size) 0 + +# Интервал превышения допустимого объема памяти в секундах +set default(max_memory_time_limit) 0 + # Допустимое отклонение количества ошибок сервера (%) -set default(errors_threshold) 0 +set default(errors_count_threshold) 0 + +# Уровень отказоустойчивости +set default(session_fault_tolerance_level) 0 + # режим распределения нагрузки # performance - приоритет по производительности # memory - приоритет по памяти -set default(load_balancing) { +set default(load_balancing_mode) { performance memory } @@ -98,3 +109,4 @@ set color(dark_table_bg) "#e2e2e2" set color(light_table_bg) "#ffffff" +