歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Nagios監控websphere插件安裝

Nagios監控websphere插件安裝

日期:2017/2/28 16:06:11   编辑:Linux教程

Plugin for Nagios which allows monitoring the internals of WebSphere Application Server.

Start here: InitialConfiguration

Currently, the following items are currently possible to monitor:

  • MonitorJvmHeapsize
  • MonitorJdbcConnectionPools
  • MonitorThreadPools
  • MonitorLiveSessions

下載地址:http://code.google.com/p/nagios-was/downloads/detail?name=check_was-0.4-bin.tar.gz&can=2&q=


安裝:

  1. [root@localhost etc]# cd /usr/local/src/tarbag/
  2. [root@localhost tarbag]#tar zxvf check_was-0.4-bin.tar.gz -C /usr/local/nagios/libexec/check_was
  3. [root@localhost tarbag]#cd /usr/local/nagios/libexec/check_was/

修改check_was程序:

  1. [root@localhost check_was]# vi check_was
  2. #!/bin/sh
  3. PLUGIN_HOME=/usr/local/nagios/libexec/check_was
  4. JAVA_HOME=/opt/IBM/WebSphere/AppServer/java \\這個java是websphere的java不是系統的java.
  5. WAS_HOME=/opt/IBM/WebSphere/AppServer
  6. $JAVA_HOME/bin/java -Dplugin.home="$PLUGIN_HOME" -cp $PLUGIN_HOME/check_was-0.4.jar:$WAS_HOME/runtimes/com.ibm.ws.admin.client_6.1.0.jar:$WAS_HOME/runtimes/com.ibm.ws.webservices.thinclient_6.1.0.jar:$WAS_HOME/plugins/com.ibm.ws.security.crypto_6.1.0.jar com.googlecode.nagioswas.Run $* 2> /dev/null

JAVA_HOME指定錯誤的話會報錯:

  1. ERROR - ADMC0053E: 啟用 SOAP 連接器安全性時,系統無法創建連接到端口 8881 上的主機 localhost 的 SOAP 連接器。

修改check_was.servers

  1. [root@localhost check_was]# vi check_was.servers
  2. mtw.hostname=localhost
  3. mtw.port=8881
  4. mtw.username=yaoshi
  5. mtw.password=www.yaoshi.com
  6. mtw.securityenabled=true
  7. mtw.truststore=/opt/IBM/WebSphere/AppServer/profiles/server01/etc/trust.p12
  8. mtw.keystore=/opt/IBM/WebSphere/AppServer/profiles/server01/etc/key.p12
  9. mtw.truststorepassword=WebAS \\這個是默認Key的密碼.
  10. mtw.keystorepassword=WebAS
  11. mtc.hostname=localhost
  12. mtc.port=8882
  13. mtc.username=yaoshi
  14. mtc.password=www.yaoshi.com
  15. mtc.securityenabled=true
  16. mtc.truststore=/opt/IBM/WebSphere/AppServer/profiles/server02/etc/trust.p12
  17. mtc.keystore=/opt/IBM/WebSphere/AppServer/profiles/server02/etc/key.p12
  18. mtc.truststorepassword=WebAS
  19. mtc.keystorepassword=WebAS

測試

  1. [root@localhost check_was]# ./check_was -s connectionpool -w 80 -c 90 -p mtw
  2. OK - connection pool size: Oracle JDBC Driver 1/10 (10.0%)|oraclejdbcdriver=10.0%;80;90;
結合nagios:

修改websphere主機的nrpe.cfg

  1. command[check_mtw_session]=/usr/local/nagios/libexec/check_was/check_was -s sessions -w 200 -c 400 -p mtw -n mtw*
  2. command[check_mtw_jvm]=/usr/local/nagios/libexec/check_was/check_was -s heapsize -w 80 -c 90 -p mtw
  3. command[check_mtw_jdbc]=/usr/local/nagios/libexec/check_was/check_was -s connectionpool -w 80 -c 90 -p mtw
  4. command[check_mtw_threadpool_WebContainer]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtw -n WebContainer
  5. command[check_mtw_threadpool_ORB.thread.pool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtw -n ORB.thread.pool
  6. command[check_mtw_threadpool_SoapConnectorThreadPool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtw -n SoapConnectorThreadPool
  7. command[check_mtw_threadpool_HAManager.thread.pool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtw -n HAManager.thread.pool
  8. command[check_mtw_threadpool_MessageListenerThreadPool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtw -n MessageListenerThreadPool
  9. command[check_mtw_threadpool_DRSThreadPool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtw -n DRSThreadPool
  10. command[check_mtc_session]=/usr/local/nagios/libexec/check_was/check_was -s sessions -w 200 -c 400 -p mtc -n mtc*
  11. command[check_mtc_jvm]=/usr/local/nagios/libexec/check_was/check_was -s heapsize -w 80 -c 90 -p mtc
  12. command[check_mtc_jdbc]=/usr/local/nagios/libexec/check_was/check_was -s connectionpool -w 80 -c 90 -p mtc
  13. command[check_mtc_threadpool_WebContainer]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtc -n WebContainer
  14. command[check_mtc_threadpool_ORB.thread.pool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtc -n ORB.thread.pool
  15. command[check_mtc_threadpool_SoapConnectorThreadPool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtc -n SoapConnectorThreadPool
  16. command[check_mtc_threadpool_HAManager.thread.pool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtc -n HAManager.thread.pool
  17. command[check_mtc_threadpool_MessageListenerThreadPool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtc -n MessageListenerThreadPool
  18. command[check_mtc_threadpool_DRSThreadPool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtc -n DRSThreadPool

修改Nagios 對應websphere的cfg文件:

  1. #SERVER01 MTC
  2. define service{
  3. use local-service ; Name of service template to use
  4. host_name 192.168.100.99
  5. service_description WAS_MTW_SESSIONS
  6. check_command check_nrpe!check_mtw_session
  7. notifications_enabled 1
  8. }
  9. define service{
  10. use local-service ; Name of service template to use
  11. host_name 192.168.100.99
  12. service_description WAS_MTW_JVM_Memery
  13. check_command check_nrpe!check_mtw_jvm
  14. notifications_enabled 1
  15. }
  16. define service{
  17. use local-service ; Name of service template to use
  18. host_name 192.168.100.99
  19. service_description WAS_MTW_JDBC_ConnectionPools
  20. check_command check_nrpe!check_mtw_jdbc
  21. notifications_enabled 1
  22. }
  23. define service{
  24. use local-service ; Name of service template to use
  25. host_name 192.168.100.99
  26. service_description WAS_MTW_threadpool_WebContainer
  27. check_command check_nrpe!check_mtw_threadpool_WebContainer
  28. notifications_enabled 1
  29. }
  30. define service{
  31. use local-service ; Name of service template to use
  32. host_name 192.168.100.99
  33. service_description WAS_MTW_threadpool_ORB.thread.pool
  34. check_command check_nrpe!check_mtw_threadpool_ORB.thread.pool
  35. notifications_enabled 1
  36. }
  37. define service{
  38. use local-service ; Name of service template to use
  39. host_name 192.168.100.99
  40. service_description WAS_MTW_threadpool_SoapConnectorThreadPool
  41. check_command check_nrpe!check_mtw_threadpool_SoapConnectorThreadPool
  42. notifications_enabled 1
  43. }
  44. define service{
  45. use local-service ; Name of service template to use
  46. host_name 192.168.100.99
  47. service_description WAS_MTW_threadpool_HAManager.thread.pool
  48. check_command check_nrpe!check_mtw_threadpool_HAManager.thread.pool
  49. notifications_enabled 1
  50. }
  51. define service{
  52. use local-service ; Name of service template to use
  53. host_name 192.168.100.99
  54. service_description WAS_MTW_threadpool_MessageListenerThreadPool
  55. check_command check_nrpe!check_mtw_threadpool_MessageListenerThreadPool
  56. notifications_enabled 1
  57. }
  58. define service{
  59. use local-service ; Name of service template to use
  60. host_name 192.168.100.99
  61. service_description WAS_MTW_DRSThreadPool
  62. check_command check_nrpe!check_mtw_threadpool_DRSThreadPool
  63. notifications_enabled 1
  64. }
  65. #SERVER02 MTC
  66. define service{
  67. use local-service ; Name of service template to use
  68. host_name 192.168.100.99
  69. service_description WAS_MTC_SESSIONS
  70. check_command check_nrpe!check_mtc_session
  71. notifications_enabled 1
  72. }
  73. define service{
  74. use local-service ; Name of service template to use
  75. host_name 192.168.100.99
  76. service_description WAS_MTC_JVM_Memery
  77. check_command check_nrpe!check_mtc_jvm
  78. notifications_enabled 1
  79. }
  80. define service{
  81. use local-service ; Name of service template to use
  82. host_name 192.168.100.99
  83. service_description WAS_MTC_JDBC_ConnectionPools
  84. check_command check_nrpe!check_mtc_jdbc
  85. notifications_enabled 1
  86. }
  87. define service{
  88. use local-service ; Name of service template to use
  89. host_name 192.168.100.99
  90. service_description WAS_MTC_threadpool_WebContainer
  91. check_command check_nrpe!check_mtc_threadpool_WebContainer
  92. notifications_enabled 1
  93. }
  94. define service{
  95. use local-service ; Name of service template to use
  96. host_name 192.168.100.99
  97. service_description WAS_MTC_threadpool_ORB.thread.pool
  98. check_command check_nrpe!check_mtc_threadpool_ORB.thread.pool
  99. notifications_enabled 1
  100. }
  101. define service{
  102. use local-service ; Name of service template to use
  103. host_name 192.168.100.99
  104. service_description WAS_MTC_threadpool_SoapConnectorThreadPool
  105. check_command check_nrpe!check_mtc_threadpool_SoapConnectorThreadPool
  106. notifications_enabled 1
  107. }
  108. define service{
  109. use local-service ; Name of service template to use
  110. host_name 192.168.100.99
  111. service_description WAS_MTC_threadpool_HAManager.thread.pool
  112. check_command check_nrpe!check_mtc_threadpool_HAManager.thread.pool
  113. notifications_enabled 1
  114. }
  115. define service{
  116. use local-service ; Name of service template to use
  117. host_name 192.168.100.99
  118. service_description WAS_MTC_threadpool_MessageListenerThreadPool
  119. check_command check_nrpe!check_mtc_threadpool_MessageListenerThreadPool
  120. notifications_enabled 1
  121. }
  122. define service{
  123. use local-service ; Name of service template to use
  124. host_name 192.168.100.99
  125. service_description WAS_MTC_DRSThreadPool
  126. check_command check_nrpe!check_mtc_threadpool_DRSThreadPool
  127. notifications_enabled 1
  128. }

重啟nagios跟nrpe客戶端



check_was可以監控的內容:

MonitorLiveSessions:
check_was -s sessions -w 200 -c 400 -p <server name> -n <host name>
可以查看某一個JVM的全部sessions也可以指定某一個應用的session 加上-n 應用名

MonitorJvmHeapsize:
check_was -s heapsize -w 80 -c 90 -p <server name>

MonitorJdbcConnectionPools 數據庫連接池:
check_was -s connectionpool -w 80 -c 90 -p <server name> -n <connection pool name>

MonitorThreadPools : 線程:
check_was -s threadpool -w 80 -c 90 -p <server name> -n <thread pool name>
線程池數據
WebContainer
ORB.thread.pool
MessageListenerThreadPool
SoapConnectorThreadPool
WebContainer
HAManager.thread.pool
DRSThreadPool

Copyright © Linux教程網 All Rights Reserved