К основному контенту

Weblogic Diagnostic Framework Run Bash Script (reboot managed server) - (bad practices)

Вообщем переодически сервер дохнет по: The WebLogic Server encountered a critical failure java.lang.OutOfMemoryError: Metaspace Reason: There is a panic condition in the server. The server is configured to exit on panic И хотя это гавно пишет типа  Reason: There is a panic condition in the server. The server is configured to exit on panic чёт ни хуя он ни куда не exit.... Вообщем т.к разбираться с тем чем он жрётся нет ни времени ни желания (оно обязательно появится)... как вариант можно приделать костыль... костыль будет заключаться в ребуте сервера при возникновении этой ошибки. Что значит для этого надо... Желания и понимание что так жить нельзя, и вообще... Делаем новый модуль называем скажем:  Reboot-OOMMetaSpace Идём в в новый модуль делаем Policy: Называем его OOM-Metaspace и говорит что это Server log: Жмём next в Configuration Policy пишем: log.logMessage.contains('java.lang.OutOfMemoryError: Metaspace'...

OEM (Oracle Cloud Control) emcli delete old targets/refresh weblogic domain

Короче есть домен в который переодически деполятся новые приложения, удаляются старые и происходит прочая вакханалия...
Grid очень хуёво реагирует на все эти вещи, т.е помечает старые приложения как Down...
В связи с этим было принято волевое решение написать скрипт который будет сам удалять и обновлять после этого домен.

Собственно саму установку emcli и прочую херню писать в падлу , будем считать что это уже сделано...

1. Начнём с удаления:
emcli refresh_wls -input_file=domain_refresh_file:/opt/oracle/maint/mid/grid/domains_remove_old.csv -debug

[oracle@ grid]$ cat domains_remove_old.csv

/Statistics_statistics_domain/statistics_domain,R

Посмотреть список доменов можно командой
./emcli get_targets -noheader -script|grep weblogic_domain

Вообщем то чё делает эта херня вызывает функцию refresh_wls в качестве input_file ей передаётся domains_remove_old.csv с выше описанным содержимым.
всё что туда можно засунуть можно почитать по ссылке https://docs.oracle.com/cd/E24628_01/em.121/e17786/cli_verb_ref.htm#EMCLI1247
input_file
Fully-qualified path of the CSV(Comma-Separated Values) file that contains multiple lines of the Target name and Refresh action (Enable/Disable refresh of the WLS domains/farms to be refreshed).
Note the following advisory information about the format of domain_refresh_file:
  • The target name should be the fully-qualified name of the domain target.
  • Every target is treated as type weblogic_domain.
  • Valid values of the refresh option are "E", "D", and "R". "E" enables a refresh for the WLS Domain, "D" disables the refresh for the WLS Domain, and "R" removes targets that are deleted from the WebLogic Domain.
  • A comma ( , ) is used as the delimiter.
  • The total number of tokens in each line is fixed, and should be equal to 2.
  • The order of parameters is fixed. You must provide the parameters in the same order as specified below in the sample file structure for domain_refresh_file:
       /Farm01_base_domain/base_domain,D
            /Farm02_base_domain/base_domain,E
            /Farm03_base_domain/base_domain,R
    
    The first entry disables the refresh for target /Farm01_base_domain/base_domain, the second entry enables a refresh for target /Farm02_base_domain/base_domain, and the third entry removes targets from Enterprise Manager that are deleted from /Farm03_base_domain/base_domain.
    For more information about the input_file parameter, see Section 5.2, "-input_file Syntax Guidelines".
Попробум выполнить команду:
emcli refresh_wls -input_file=domain_refresh_file:/opt/oracle/maint/mid/grid/domains_remove_old.csv -debug


Checking Domain Refresh file for Syntax errors...
domain_refresh_file - Correct format is:  
<target name>,<refresh action>

No errors found in Domain Refresh file. Refresh for the given targets will now commence...

========================================================================

Starting Refresh (Remove Targets) for /Statistics_statistics_domain/statistics_domain

Deleting Target /Statistics_statistics_domain/statistics_domain/lalal-6.0 (Domain Application Deployment)
Error while deleting Target /Statistics_statistics_domain/statistics_domain/lalal-6.0 (Domain Application Deployment): ORA-20233: Target /Statistics_statistics_domain/statistics_domain/lalal-6.0:j2ee_application_domain is not a composite target: delete_members cannot be set
ORA-06512: at "SYSMAN.MGMT_ADMIN", line 1041
ORA-06512: at "SYSMAN.MGMT_ADMIN", line 1156
ORA-06512: at "SYSMAN.EMD_MNTR_IAS", line 1166
ORA-06512: at line 1
.
Error while deleting Target /Statistics_statistics_domain/statistics_domain/matrix-6.0 (Domain Application Deployment): ORA-20233: Target /Statistics_statistics_domain/statistics_domain/lalal-6.0:j2ee_application_domain is not a composite target: delete_members cannot be set
ORA-06512: at "SYSMAN.MGMT_ADMIN", line 1041
ORA-06512: at "SYSMAN.MGMT_ADMIN", line 1156
ORA-06512: at "SYSMAN.EMD_MNTR_IAS", line 1166
ORA-06512: at line 1
.
Deleting Target /Statistics_statistics_domain/statistics_domain/app1_server/lalala-6.0 (Application Deployment)
Target /Statistics_statistics_domain/statistics_domain/app1_server/lalala-6.0 (Application Deployment) has been deleted

Deleting Target /Statistics_statistics_domain/statistics_domain/app2_server/lalala-6.0 (Application Deployment)
Target /Statistics_statistics_domain/statistics_domain/app2_server/lalalal-6.0 (Application Deployment) has been deleted


Finished Refresh (Remove Targets) for /Statistics_statistics_domain/statistics_domain


========================================================================


Вообщем хуй его знает, но не смотря на ошибку чёт успешно уебалось.... ура епты...



2. Обновление:
emcli discover_wls -input_file=domain_discovery_file:/opt/oracle/maint/mid/grid/domains_info.csv -debug

[oracle@ grid]$ cat domains_info.csv

12,app-statistics.moscow.sportmaster.ru,7001,weblogic,LALAL1,,,,,app-statistics,false,false

Вообщем то чё делает эта херня выдывает функцию discover_wls в качестве input_file ей передаётся domains_info.csv с выше описанным содержимым.
всё что туда можно засунуть можно почитать по ссылке https://docs.oracle.com/cd/E24628_01/em.121/e17786/cli_verb_ref.htm#EMCLI1247
domain_discovery_file for WebLogic Server versions 9.x, 10.x and 12.x
This example shows the structure of a sample domain_discovery_file for WebLogic Server versions 9.x, 10.x, and 12.x. OPT signifies an optional parameter. The last entry shows the format when optional parameters External Parameters, JMX Protocol, JMX Service URL, and Management Agent URL are not provided.
<WebLogic Server version>,
<Administration Server host machine name>,
<Administration Server listen port>,
<Administration Server username>,
<Administration Server password>,
<External Parameters - optional>,
<JMX Protocol - Required only if SSL enabled>,
<JMX Service URL - Required only if SSL enabled>,
<Unique Domain Identifier>,
<Agent URL/>,
<Discover Down Servers - optional - Default if not specified is false 
   (starting with the Fusion Middleware Plug-in 12.1.0.3 release. Before this, the
    default was true)>,
<Use Credential Store - optional - Default if not specified is false>
<Enable Refresh Job - optional - Default if not specified is false>
<Use Host Name in Service URL - optional - Default if not specified is false>
For example:
10,mco01.mycompany.com,7001,weblogic,welcome1,,,,my_farm_01,https://mco01.mycompany.com:3872/emd/main/,false,false
Попробум выполнить команду:
emcli discover_wls -input_file=domain_discovery_file:/opt/oracle/maint/mid/grid/domains_info.csv -debug
===============================================================================

Successful: Discovery (Version: 12) --> lalall, 7001 as user - weblogic
Discovery successfully. All targets were discovered and saved to EM agents.
WLS Domain input parameters
Administration Server host - lalalal
Administration Server port - 7001
Administration Server username - weblogic
Administration Server password - *****
External Parameters - 
JMX Protocol - 
JMX Service URL - 
Unique Domain Identifier - Statistics
Agent URL - 
Discover Down Servers - false
Use Credential Store - false
Discover Application Versions - true
Enable Automatic Refresh - false
Use Host Name In Service URL - false
Create Incident for Discovery Failure - false

NOTE:
1) Discovery Agent URL has not been provided therefor Default Agent will be used if available.
2) External parameters were not provided. They might be needed to tune JVM.
===============================================================================

Не знаю на сколько полноценное решение тут описанно, потыкать кнопки в oem12 конечно явно работает как то логичнее и правильнее, чем писать в открытом виде пароль в файле.
Тем не менее при частом обновлении приложений приходится пользоваться скриптом. В случае каких либо изменений и т.д напишу сюда еще чё нить.
P.S
Возможно ошибка вида:
Error: Session expired. Run emcli login to establish a session.
В этом случае надо залогиниться заново:
./emcli login -username=sysman


P.S emcli create everydate blackout for 10 min
emcli create_blackout -name="NotificationBlackout-Reboot" -notification_only -add_targets="/domain/lala_domain/portal:weblogic_j2eeserver" -reason="reboot" -schedule="frequency:interval;start_time:2017-06-30 00:30;duration:00:10;repeat:1d"









Комментарии

Популярные сообщения из этого блога

Oracle SOA email notification или какого х.. оно не работает.

От делать нех задокументируем.... Вообщем то всё рассписанно по ссылке: http://www.rubiconred.com/blog/email-notification-with-soa-suite-11g/ Ссылка походу сдохла!!! Придётся на всякий случай записать пока не забыл... Собственно основные настройки делаются на этой странице: Тут будет текст дабы не плодить картинок: MailAccessProtocol : POP3 RetryLimit : -1 MailDelFreq : 600 AutoDelete : not check Debug : not check CheckMailFreq : 30 ReceiveFolder: INBOX OutgoingMailServer :  mail4.ru OutgoingMailServerPort : 25 OutgoingMailServerSecurity : None OutgoingDefaultFromAddr :  pklmn@mail.ru OutgoingPassword: вроде ни чё не трогал... IncomingMailServer: mail3.ru IncomingMailServerPort: 110 IncomingMailServerSSL: not check IncomingMailIDs: pklmn@mail.ru IncomingUserIDs: pklmn IncomingUserPasswords: тут настраиваем пароль При настройке рекомендуется обращать внимания на всплывающие подсказки например: Sender Address должен выглядеть как E...

Weblogic Diagnostic Framework Run Bash Script (reboot managed server) - (bad practices)

Вообщем переодически сервер дохнет по: The WebLogic Server encountered a critical failure java.lang.OutOfMemoryError: Metaspace Reason: There is a panic condition in the server. The server is configured to exit on panic И хотя это гавно пишет типа  Reason: There is a panic condition in the server. The server is configured to exit on panic чёт ни хуя он ни куда не exit.... Вообщем т.к разбираться с тем чем он жрётся нет ни времени ни желания (оно обязательно появится)... как вариант можно приделать костыль... костыль будет заключаться в ребуте сервера при возникновении этой ошибки. Что значит для этого надо... Желания и понимание что так жить нельзя, и вообще... Делаем новый модуль называем скажем:  Reboot-OOMMetaSpace Идём в в новый модуль делаем Policy: Называем его OOM-Metaspace и говорит что это Server log: Жмём next в Configuration Policy пишем: log.logMessage.contains('java.lang.OutOfMemoryError: Metaspace'...

Weblogic Kerberos

Weblogic установлен на сервере budwf Домен контролер wcctst.wcc.local Клиентская винда XZ 1. Генерим keytab ktpass -princ HTTP/srv_budwf@WCC.LOCAL -mapuser srv_budwf -kvno 0 -crypto AES128-SHA1 -ptype KRB5_NT_PRINCIPAL -pass lalal_1 -out c:\temp\budwf.keytab Т.е в данном случае principal name в keytab полностью соответствует ожиданиям... C:\Users\Administrator>ktpass -princ HTTP/srv_budwf@WCC.LOCAL -mapuser srv_budwf -kv no 0 -crypto AES128-SHA1 -ptype KRB5_NT_PRINCIPAL -pass lalal_1 -out c:\temp\b udwf.keytab Targeting domain controller: wcctst.wcc.local Successfully mapped HTTP/budwf to srv_budwf. Password succesfully set! Key created. Output keytab to c:\temp\budwf.keytab: Keytab version: 0x502 keysize 55 HTTP/budwf@WCC.LOCAL ptype 1 (KRB5_NT_PRINCIPAL) vno 0 etype 0x11 (AE S128-SHA1) keylength 16 (0xbf005ae14d58153abe3eab57cf5a8260) C:\Users\Administrator>setspn -L srv_budwf Registered ServicePrincipalNames for CN=srv_budwf,CN=Users,DC=wcc,DC=local: ...