Nagios监控websphere插件安装


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.   
  12. mtc.hostname=localhost  
  13. mtc.port=8882  
  14. mtc.username=yaoshi  
  15. mtc.password=www.yaoshi.com  
  16. mtc.securityenabled=true  
  17. mtc.truststore=/opt/IBM/WebSphere/AppServer/profiles/server02/etc/trust.p12  
  18. mtc.keystore=/opt/IBM/WebSphere/AppServer/profiles/server02/etc/key.p12  
  19. mtc.truststorepassword=WebAS  
  20. 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.   
  11. command[check_mtc_session]=/usr/local/nagios/libexec/check_was/check_was -s sessions -w 200 -c 400 -p mtc -n mtc*  
  12. command[check_mtc_jvm]=/usr/local/nagios/libexec/check_was/check_was -s heapsize -w 80 -c 90 -p mtc  
  13. command[check_mtc_jdbc]=/usr/local/nagios/libexec/check_was/check_was -s connectionpool -w 80 -c 90 -p mtc  
  14. command[check_mtc_threadpool_WebContainer]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtc -n WebContainer  
  15. 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  
  16. command[check_mtc_threadpool_SoapConnectorThreadPool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtc -n SoapConnectorThreadPool  
  17. 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  
  18. command[check_mtc_threadpool_MessageListenerThreadPool]=/usr/local/nagios/libexec/check_was/check_was -s threadpool -w 80 -c 90 -p mtc -n MessageListenerThreadPool  
  19. 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.   
  3. define service{  
  4.         use                             local-service         ; Name of service template to use  
  5.         host_name                       192.168.100.99  
  6.         service_description             WAS_MTW_SESSIONS  
  7.         check_command                   check_nrpe!check_mtw_session  
  8.         notifications_enabled           1  
  9.         }  
  10. define service{  
  11.         use                             local-service         ; Name of service template to use  
  12.         host_name                       192.168.100.99  
  13.         service_description             WAS_MTW_JVM_Memery  
  14.         check_command                   check_nrpe!check_mtw_jvm  
  15.         notifications_enabled           1  
  16.         }  
  17. define service{  
  18.         use                             local-service         ; Name of service template to use  
  19.         host_name                       192.168.100.99  
  20.         service_description             WAS_MTW_JDBC_ConnectionPools  
  21.         check_command                   check_nrpe!check_mtw_jdbc  
  22.         notifications_enabled           1  
  23.         }  
  24. define service{  
  25.         use                             local-service         ; Name of service template to use  
  26.         host_name                       192.168.100.99  
  27.         service_description             WAS_MTW_threadpool_WebContainer  
  28.         check_command                   check_nrpe!check_mtw_threadpool_WebContainer  
  29.         notifications_enabled           1  
  30.         }  
  31. define service{  
  32.         use                             local-service         ; Name of service template to use  
  33.         host_name                       192.168.100.99  
  34.         service_description             WAS_MTW_threadpool_ORB.thread.pool  
  35.         check_command                   check_nrpe!check_mtw_threadpool_ORB.thread.pool  
  36.         notifications_enabled           1  
  37.         }  
  38. define service{  
  39.         use                             local-service         ; Name of service template to use  
  40.         host_name                       192.168.100.99  
  41.         service_description             WAS_MTW_threadpool_SoapConnectorThreadPool  
  42.         check_command                   check_nrpe!check_mtw_threadpool_SoapConnectorThreadPool  
  43.         notifications_enabled           1  
  44.         }  
  45. define service{  
  46.         use                             local-service         ; Name of service template to use  
  47.         host_name                       192.168.100.99  
  48.         service_description             WAS_MTW_threadpool_HAManager.thread.pool  
  49.         check_command                   check_nrpe!check_mtw_threadpool_HAManager.thread.pool  
  50.         notifications_enabled           1  
  51.         }  
  52. define service{  
  53.         use                             local-service         ; Name of service template to use  
  54.         host_name                       192.168.100.99  
  55.         service_description             WAS_MTW_threadpool_MessageListenerThreadPool  
  56.         check_command                   check_nrpe!check_mtw_threadpool_MessageListenerThreadPool  
  57.         notifications_enabled           1  
  58.         }  
  59. define service{  
  60.         use                             local-service         ; Name of service template to use  
  61.         host_name                       192.168.100.99  
  62.         service_description             WAS_MTW_DRSThreadPool  
  63.         check_command                   check_nrpe!check_mtw_threadpool_DRSThreadPool  
  64.         notifications_enabled           1  
  65.         }  
  66. #SERVER02 MTC  
  67. define service{  
  68.         use                             local-service         ; Name of service template to use  
  69.         host_name                       192.168.100.99  
  70.         service_description             WAS_MTC_SESSIONS  
  71.         check_command                   check_nrpe!check_mtc_session  
  72.         notifications_enabled           1  
  73.         }  
  74. define service{  
  75.         use                             local-service         ; Name of service template to use  
  76.         host_name                       192.168.100.99  
  77.         service_description             WAS_MTC_JVM_Memery  
  78.         check_command                   check_nrpe!check_mtc_jvm  
  79.         notifications_enabled           1  
  80.         }  
  81. define service{  
  82.         use                             local-service         ; Name of service template to use  
  83.         host_name                       192.168.100.99  
  84.         service_description             WAS_MTC_JDBC_ConnectionPools  
  85.         check_command                   check_nrpe!check_mtc_jdbc  
  86.         notifications_enabled           1  
  87.         }  
  88. define service{  
  89.         use                             local-service         ; Name of service template to use  
  90.         host_name                       192.168.100.99  
  91.         service_description             WAS_MTC_threadpool_WebContainer  
  92.         check_command                   check_nrpe!check_mtc_threadpool_WebContainer  
  93.         notifications_enabled           1  
  94.         }  
  95. define service{  
  96.         use                             local-service         ; Name of service template to use  
  97.         host_name                       192.168.100.99  
  98.         service_description             WAS_MTC_threadpool_ORB.thread.pool  
  99.         check_command                   check_nrpe!check_mtc_threadpool_ORB.thread.pool  
  100.         notifications_enabled           1  
  101.         }  
  102. define service{  
  103.         use                             local-service         ; Name of service template to use  
  104.         host_name                       192.168.100.99  
  105.         service_description             WAS_MTC_threadpool_SoapConnectorThreadPool  
  106.         check_command                   check_nrpe!check_mtc_threadpool_SoapConnectorThreadPool  
  107.         notifications_enabled           1  
  108.         }  
  109. define service{  
  110.         use                             local-service         ; Name of service template to use  
  111.         host_name                       192.168.100.99  
  112.         service_description             WAS_MTC_threadpool_HAManager.thread.pool  
  113.         check_command                   check_nrpe!check_mtc_threadpool_HAManager.thread.pool  
  114.         notifications_enabled           1  
  115.         }  
  116. define service{  
  117.         use                             local-service         ; Name of service template to use  
  118.         host_name                       192.168.100.99  
  119.         service_description             WAS_MTC_threadpool_MessageListenerThreadPool  
  120.         check_command                   check_nrpe!check_mtc_threadpool_MessageListenerThreadPool  
  121.         notifications_enabled           1  
  122.         }  
  123. define service{  
  124.         use                             local-service         ; Name of service template to use  
  125.         host_name                       192.168.100.99  
  126.         service_description             WAS_MTC_DRSThreadPool  
  127.         check_command                   check_nrpe!check_mtc_threadpool_DRSThreadPool  
  128.         notifications_enabled           1  
  129.         }  

重启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

相关内容