搜索
查看: 1405|回复: 0

【DB2】db2生产应用监控

[复制链接]

202

主题

6

回帖

885

积分

高级会员

积分
885
发表于 2014-10-29 17:16:11 | 显示全部楼层 |阅读模式
  1. #!/bin/ksh
  2. #monitor db2 -----------------------------------------------------
  3. v_dbname=spshis

  4. mo_run(){
  5. # run db2pd
  6. start_or_not=`db2 -x "select count(*) from sysibmadm.SNAPAPPL where uow_stop_time is null and current timestamp- uow_start_time >5 with ur"`
  7. start_or_not1=`uptime|awk -F"," '{print $6}'`
  8. start_or_not2=`db2pd -d sample -lock wait|wc -l`

  9. date >> monitor_log

  10. if [ $start_or_not -gt 0 ];then
  11. v_f=`date +%y%m%H%M%S`

  12. start_or_not4=`db2 -x "select count(*) from sysibmadm.SNAPAPPL where uow_stop_time is null and current timestamp- uow_start_time >200 with ur"`

  13. if [ $start_or_not4 -gt 0 ];then
  14. db2pd -d $v_dbname -tran -dyn -lock wait -app >monitor_log"$v_f"
  15. fi

  16. db2 -x "select a.agent_id ,c.tpmon_client_wkstn ,b.stmt_text, current timestamp- a.uow_start_time used_time
  17. from sysibmadm.SNAPAPPL a ,sysibmadm.SNAPSTMT b,sysibmadm.SNAPAPPL_INFO c
  18. where a.agent_id=b.agent_id
  19. and a.agent_id=c.agent_id
  20. and a.uow_stop_time is null
  21. and current timestamp- a.uow_start_time >5 with ur" >> monitor_log"$v_f"

  22. #rmove wuxiao---
  23. sh hj_file

  24. sleep 20
  25. return
  26. fi

  27. if [[ $start_or_not1 > 30 ]];then
  28. v_f=`date +%d%m%H%M%S`
  29. db2pd -d $v_dbname -tran -dyn -lock wait -app -latch>>monitor_log"$v_f"

  30. sleep 20
  31. return
  32. fi

  33. if [ $start_or_not2 -gt 5 ];then
  34. v_f=`date +%d%m%H%M%S`
  35. db2pd -d $v_dbname -tran -dyn -lock wait -app >>monitor_log"$v_f"
  36. sleep 20
  37. return
  38. fi

  39. }

  40. db2 connect to $v_dbname > /dev/null

  41. # run ever 20 second
  42. second=0
  43. while true
  44. do
  45. echo 'start-------------------'
  46. mo_run
  47. sleep 5
  48. let second=${second}+5
  49. if [ ${second} -gt 7200 ];then
  50. break
  51. fi
  52. done
  53. db2 terminate
复制代码
----如果发现新的功能 会更新该文件
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

 
 
大数据行业交流
大数据行业交流
大数据求职招聘
大数据求职招聘
站长电话:
15010106923
微信联系:
hb-0310
站长邮箱:
ab12-120@163.com
大数据中国微信

QQ   

版权所有: Discuz! © 2001-2013 大数据.

GMT+8, 2024-5-5 03:26 , Processed in 0.062818 second(s), 24 queries .

快速回复 返回顶部 返回列表