免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8100 | 回复: 7
打印 上一主题 下一主题

[其他] check_mssql_health [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-05-15 15:18 |只看该作者 |倒序浏览
有些话不好说,看图吧

这只是一个例子,有好多SQL是没问题,但是这样测试就有问题,真是百思不得其姐。

论坛徽章:
7
荣誉版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07狮子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10双子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
2 [报告]
发表于 2014-05-15 15:48 |只看该作者
官网上的例子,试试有木有好使的
  1. nagios$ check_oracle_health --connect bba --mode tnsping
  2. OK - connection established to bba.

  3. nagios$ check_oracle_health --mode connection-time
  4. OK - 0.17 seconds to connect  |
  5.   connection_time=0.1740;1;5

  6. nagios$ check_oracle_health --mode sga-data-buffer-hit-ratio
  7. CRITICAL - SGA data buffer hit ratio 0.99%  |
  8.   sga_data_buffer_hit_ratio=0.99%;98:;95:

  9. nagios$ check_oracle_health --mode sga-library-cache-hit-ratio
  10. OK - SGA library cache hit ratio 98.75%  |
  11.   sga_library_cache_hit_ratio=98.75%;98:;95:

  12. nagios$ check_oracle_health --mode sga-latches-hit-ratio
  13. OK - SGA latches hit ratio 100.00%  |
  14.   sga_latches_hit_ratio=100.00%;98:;95:

  15. nagios$ check_oracle_health --mode sga-shared-pool-reloads
  16. OK - SGA shared pool reloads 0.28%  |
  17.   sga_shared_pool_reloads=0.28%;1;10

  18. nagios$ check_oracle_health --mode sga-shared-pool-free
  19. WARNING - SGA shared pool free 8.91%  |
  20.   sga_shared_pool_free=8.91%;10:;5:

  21. nagios$ check_oracle_health --mode pga-in-memory-sort-ratio
  22. OK - PGA in-memory sort ratio 100.00%  |
  23.   pga_in_memory_sort_ratio=100.00;99:;90:

  24. nagios$ check_oracle_health --mode invalid-objects
  25. OK - no invalid objects found  |
  26.   invalid_ind_partitions=0 invalid_indexes=0
  27.   invalid_objects=0 unrecoverable_datafiles=0

  28. nagios$ check_oracle_health --mode switch-interval
  29. OK - Last redo log file switch interval was 18 minutes |
  30.     redo_log_file_switch_interval=1090s;600:;60:

  31. nagios$ check_oracle_health --mode switch-interval --connect rac1
  32. OK - Last redo log file switch interval was 32 minutes (thread 1)|
  33.     redo_log_file_switch_interval=1938s;600:;60:

  34. nagios$ check_oracle_health --mode tablespace-usage
  35. CRITICAL - tbs SYSTEM usage is 99.33%
  36. tbs SYSAUX usage is 93.73%
  37. tbs USERS usage is 8.75%
  38. tbs UNDOTBS1 usage is 6.65% | 'tbs_users_usage_pct'=8%;90;98
  39. 'tbs_users_usage'=0MB;4;4;0;5
  40. 'tbs_undotbs1_usage_pct'=6%;90;98
  41. 'tbs_undotbs1_usage'=11MB;153;166;0;170
  42. 'tbs_system_usage_pct'=99%;90;98
  43. 'tbs_system_usage'=695MB;630;686;0;700
  44. 'tbs_sysaux_usage_pct'=93%;90;98
  45. 'tbs_sysaux_usage'=802MB;770;839;0;856

  46. nagios$ check_oracle_health --mode tablespace-usage
  47.     --tablespace USERS
  48. OK - tbs USERS usage is 8.75% |
  49.   'tbs_users_usage_pct'=8%;90;98
  50.   'tbs_users_usage'=0MB;4;4;0;5

  51. nagios$ check_oracle_health --mode tablespace-usage
  52.     --name USERS
  53. OK - tbs USERS usage is 8.75% |
  54.   'tbs_users_usage_pct'=8%;90;98
  55.   'tbs_users_usage'=0MB;4;4;0;5

  56. nagios$ check_oracle_health --mode tablespace-free
  57.     --name TEST
  58. OK - tbs TEST has 97.91% free space left |
  59.     'tbs_test_free_pct'=97.91%;5:;2:
  60.     'tbs_test_free'=32083MB;1638.40:;655.36:;0.00;32767.98

  61. nagios$ check_oracle_health --mode tablespace-free
  62.     --name TEST --units MB --warning 100: --critical 50:
  63. OK - tbs TEST has 32083.61MB free space left |
  64.     'tbs_test_free_pct'=97.91%;0.31:;0.15:
  65.     'tbs_test_free'=32083.61MB;100.00:;50.00:;0;32767.98

  66. nagios$ check_oracle_health --mode tablespace-free
  67.     --name TEST --warning 10: --critical 5:
  68. OK - tbs TEST has 97.91% free space left |
  69.     'tbs_test_free_pct'=97.91%;10:;5:
  70.     'tbs_test_free'=32083MB;3276.80:;1638.40:;0.00;32767.98

  71. nagios$ check_oracle_health --mode tablespace-remaining-time
  72.     --tablespace ARUSERS --lookback 7
  73. WARNING - tablespace ARUSERS will be full in 78 days |
  74.   'tbs_arusers_days_until_full'=78;90:;30:

  75. nagios$ check_oracle_health --mode flash-recovery-area-free
  76. OK - flra /u00/app/oracle/flash_recovery_area has 100.00% free space left |
  77.     'flra_free_pct'=100.00%;5:;2:
  78.     'flra_free'=2048MB;102.40:;40.96:;0;2048.00

  79. nagios$ check_oracle_health --mode flash-recovery-area-free
  80.     --units KB --warning 1000: --critical 500:
  81. OK - flra /u00/app/oracle/flash_recovery_area has 2097152.00KB free space left |     'flra_free_pct'=100.00%;0.05:;0.02:
  82.     'flra_free'=2097152.00KB;1000.00:;500.00:;0;2097152.00

  83. nagios$ check_oracle_health --mode datafile-io-traffic
  84.   --datafile users01.dbf
  85. WARNING - users01.dbf: 1049.83 IO Operations per Second |
  86.   'dbf_users01.dbf_io_total_per_sec'=1049.83;1000;5000

  87. nagios$ check_oracle_health --mode latch-contention
  88.   --name 214
  89. OK - SGA latch library cache (214) contention 0.08% |
  90. 'latch_214_contention'=0.08%;1;2
  91. 'latch_214_sleep_share'=0.00% 'latch_214_gets'=49995

  92. nagios$ check_oracle_health --mode latch-contention
  93.   --name 'library cache'
  94. OK - SGA latch library cache (214) contention 0.08% |
  95. 'latch_214_contention'=0.08%;1;2
  96. 'latch_214_sleep_share'=0.00% 'latch_214_gets'=49937

  97. nagios$ check_oracle_health --mode enqueue-contention --name TC
  98. CRITICAL - enqueue TC: 19.90% of the requests must wait |
  99. 'TC_contention'=19.90%;1;10
  100. 'TC_requests'=2015 'TC_waits'=401

  101. nagios$ check_oracle_health --mode latch-contention
  102.   --name 'messages'
  103. OK - SGA latch messages (17) contention 0.02% |
  104. 'latch_17_contention'=0.02%;1;2 'latch_17_gets'=4867

  105. nagios$ check_oracle_health --mode latch-waiting
  106.   --name 'user lock'
  107. OK - SGA latch user lock (205) sleeping 0.000841% of the time |
  108. 'latch_205_sleep_share'=0.000841%

  109. nagios$ check_oracle_health --mode event-waits
  110.   --name 'log file sync'
  111. OK - log file sync : 1.839511 waits/sec |
  112. 'log file sync_waits_per_sec'=1.839511;10;100

  113. nagios$ check_oracle_health --mode event-waiting
  114.   --name 'Log file parallel write'
  115. OK - log file parallel write waits 0.045843% of the time |
  116. rarr 'log file parallel write_percent_waited'=0.045843%;0.1;0.5

  117. nagios$ check_oracle_health --mode sysstat
  118.   --name 'transaction rollbacks'
  119. OK - 0.000003 transaction rollbacks/sec |
  120. 'transaction rollbacks_per_sec'=0.000003;10;100
  121. 'transaction rollbacks'=4

  122. nagios$ check_oracle_health --mode sql
  123.   --name 'select count(*) from v$session' --name2 sessions
  124. CRITICAL - sessions: 21 | 'sessions'=21;1;5

  125. nagios$ check_oracle_health --mode sql
  126.   --name 'select 12 from dual' --name2 twelve --units MB
  127. CRITICAL - twelfe: 12MB | 'twelfe'=12MB;1;5

  128. nagios$ check_oracle_health --mode sql
  129.   --name 'select 200,300,1000 from dual'
  130.   --name2 'kaspar melchior balthasar'
  131.   --warning 180 --critical 500
  132. WARNING - kaspar melchior balthasar: 200 300 1000 |
  133. 'kaspar'=200;180;500 'melchior'=300;; 'balthasar'=1000;;

  134. nagios$ check_oracle_health --mode sql
  135.   --name "select 'abc123' from dual" --name2 \\d
  136.   --regexp
  137. OK - output abc123 matches pattern \d
复制代码

论坛徽章:
0
3 [报告]
发表于 2014-05-15 16:09 |只看该作者
回复 2# r2007


    这些例子是固定的,我想自定义sql。其实我大概知道原因了,得到的结果要数值型的,如10,12.3等等,但是像dbversion=select * from v$version这种就不好办了。

论坛徽章:
7
荣誉版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07狮子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10双子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
4 [报告]
发表于 2014-05-15 16:15 |只看该作者
回复 3# cherish2004

倒数第5个例子不就是你想测的那个吗?
  1. nagios$ check_oracle_health --mode sql
  2.   --name 'select count(*) from v$session' --name2 sessions
  3. CRITICAL - sessions: 21 | 'sessions'=21;1;5
复制代码

论坛徽章:
7
荣誉版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07狮子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10双子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
5 [报告]
发表于 2014-05-15 16:17 |只看该作者
明白你的意思了,没有数值无法确定状态。

论坛徽章:
7
荣誉版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07狮子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10双子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
6 [报告]
发表于 2014-05-15 16:22 |只看该作者
mode=sql的用法
  1. Result of any SQL-Statement that returns a number. The statement itself is passed over with the parameter –name. A Label for the performance data output can be passed over with the parameter –name2.
复制代码

论坛徽章:
0
7 [报告]
发表于 2014-05-15 16:27 |只看该作者
回复 6# r2007


    是这样的,可是我现在想得到一些字符串类型的结果,不过我发现你给的代码最后一个例子好像是得到字符串,不太明白用法。

  1. [oracle@oraclerhel libexec]$ ./check_oracle_health --connect=prod --username=system --password=oracle --mode=sql --name="select%20%27abc123%27%20from%20dual" --name2=r--name2 \\d --regexp
  2. OK - output abc123 matches pattern \d
复制代码

论坛徽章:
7
荣誉版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07狮子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10双子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
8 [报告]
发表于 2014-05-15 17:07 |只看该作者
用name2的正则匹配select的结果,如果匹配成功就ok,不成功估计会显示CRITICAL
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP