ãŸããã
å€ãã®å ŽåãããŒã¿ããŒã¹ïŒããŒã¿ããŒã¹ïŒã«é¢é£ããåé¡ã«ã€ããŠã管çè ã«ãªã¢ã«ã¿ã€ã ã§å ±åããå¿ èŠããããŸãã
ãã®èšäºã§ã¯ãMS SQL ServerããŒã¿ããŒã¹ãç£èŠããããã«Zabbixã§èšå®ããå¿ èŠããããã®ã«ã€ããŠèª¬æããŸãã
ãããã®èšå®æ¹æ³ã«é¢ãã詳现ã¯ãªãããšã«æ³šæããŠãã ããããã ããåŒãšäžè¬çãªæšå¥šäºé ãããã³ã¹ãã¢ãããã·ãŒãžã£ãä»ãããŠãŒã¶ãŒããŒã¿èŠçŽ ã®è¿œå ã®è©³çŽ°ãªèª¬æã¯ããã®èšäºã§èª¬æããŸãã
ãŸããããã§ã¯åºæ¬çãªããã©ãŒãã³ã¹ã«ãŠã³ã¿ãŒã®ã¿ãæ€èšããŸãã
解決ç
æåã«ãå¿ èŠãªãã¹ãŠã®ããã©ãŒãã³ã¹ã«ãŠã³ã¿ãŒãïŒZabbixã®ããŒã¿èŠçŽ ãä»ããŠïŒèª¬æããŸãã
- è«çãã£ã¹ã¯
- å¹³åãã£ã¹ã¯ç§/èªã¿åã
ãã£ã¹ã¯ããããŒã¿ãèªã¿åãå¹³åæéãç§åäœã§è¡šç€ºããŸãã å¹³åããã©ãŒãã³ã¹ã«ãŠã³ã¿ãŒå¹³åã Disk sec / Readã¯10ããªç§ãè¶ ããŠã¯ãªããŸããã Avgããã©ãŒãã³ã¹ã«ãŠã³ã¿ãŒã®æ倧å€ã Disk sec / Readã¯50ããªç§ãè¶ ããŠã¯ãªããŸããã
Zabbix ïŒperf_counter [\ LogicalDiskïŒ_TotalïŒ\ Avgã Disk sec / Read]ãç®çã®ãã©ã€ãã远跡ããããšãéèŠã§ããããšãã°ãperf_counter [\ LogicalDiskïŒC :) \ Avgã ãã£ã¹ã¯ç§/èªã¿åã]
ããªã¬ãŒã®äŸ ïŒ
{ããŒãåïŒperf_counter [\ LogicalDiskïŒ_TotalïŒ\ Avgã ãã£ã¹ã¯ç§/èªã¿åã] .lastïŒïŒ}> 0.005ãã¬ãã«é«
ãããŠ
{ããŒãåïŒperf_counter [\ LogicalDiskïŒ_TotalïŒ\ Avgã ãã£ã¹ã¯ç§/èªã¿åã] .lastïŒïŒ}> 0.0025ãäžéã¬ãã«
- å¹³åãã£ã¹ã¯ç§/æžã蟌ã¿
ãã£ã¹ã¯ã«ããŒã¿ãæžã蟌ãå¹³åæéãç§åäœã§è¡šç€ºããŸãã å¹³åããã©ãŒãã³ã¹ã«ãŠã³ã¿ãŒå¹³åã ãã£ã¹ã¯ç§/æžã蟌ã¿ã¯10ããªç§ãè¶ ããŠã¯ãªããŸããã Avgããã©ãŒãã³ã¹ã«ãŠã³ã¿ãŒã®æ倧å€ã ãã£ã¹ã¯ç§/æžã蟌ã¿ã¯50ããªç§ãè¶ ããŠã¯ãªããŸããã
Zabbix ïŒperf_counter [\ LogicalDiskïŒ_TotalïŒ\ Avgã Disk sec / Write]ãç®çã®ãã©ã€ãã远跡ããããšãéèŠã§ããããšãã°ãperf_counter [\ LogicalDiskïŒC :) \ Avgã ãã£ã¹ã¯ç§/æžã蟌ã¿]
ããªã¬ãŒã®äŸ ïŒ
{ããŒãåïŒperf_counter [\ LogicalDiskïŒ_TotalïŒ\ Avgã ãã£ã¹ã¯ç§/æžã蟌ã¿] .lastïŒïŒ}> 0.005ãé«ã¬ãã«
ãããŠ
{ããŒãåïŒperf_counter [\ LogicalDiskïŒ_TotalïŒ\ Avgã ãã£ã¹ã¯ç§/æžã蟌ã¿] .lastïŒïŒ}> 0.0025ãäžéã¬ãã« - å¹³åãã£ã¹ã¯ãã¥ãŒã®é·ã
ãã£ã¹ã¯èŠæ±ãã¥ãŒã®å¹³åé·ã ç¹å®ã®æéééäžã«åŠçãåŸ æ©ããŠãããã£ã¹ã¯èŠæ±ã®æ°ã衚瀺ããŸãã åäžãã£ã¹ã¯ã®ãã¥ãŒã2以äžã§ããå Žåã¯ãæ£åžžãšèŠãªãããŸãã ãã¥ãŒã«3ã€ä»¥äžã®èŠæ±ãããå Žåããããããã£ã¹ã¯ãéè² è·ã«ãªããçä¿¡èŠæ±ãåŠçããæéããããŸããã Avgã«ãŠã³ã¿ãŒã䜿çšããŠããã£ã¹ã¯ãåŠçã§ããªãæäœãæå®ã§ããŸãã ãã£ã¹ã¯èªã¿åããã¥ãŒã®é·ããšå¹³å ãã£ã¹ã¯ã©ã€ããã¥ãŒã®é·ãã
å¹³åå€ã ãã£ã¹ã¯ãã¥ãŒã®é·ãã¯æž¬å®ãããŸããããæ°åŠçãªãã¥ãŒã€ã³ã°çè«ãããªãã«ã®æ³åã«åŸã£ãŠèšç®ãããŸãã ãã®æ³åŸã«ããã°ãåŠçãä¿çããŠãããªã¯ãšã¹ãã®æ°ã¯ãå¹³åããŠãªã¯ãšã¹ãã®åä¿¡é »åºŠã«ãªã¯ãšã¹ãã®åŠçæéãæãããã®ã«çãããªããŸãã ããªãã¡ ç§ãã¡ã®å Žåãå¹³å ãã£ã¹ã¯ãã¥ãŒã®é·ã=ïŒãã£ã¹ã¯è»¢é/ç§ïŒ*ïŒå¹³åãã£ã¹ã¯ç§/転éïŒã
å¹³å ãã£ã¹ã¯ãã¥ãŒã®é·ãã¯ããã£ã¹ã¯ãµãã·ã¹ãã ã®è² è·ã決å®ããããã®äž»èŠãªã«ãŠã³ã¿ãŒã®1ã€ãšããŠäžããããŸãããé©åãªè©äŸ¡ãè¡ãã«ã¯ãã¹ãã¬ãŒãžã·ã¹ãã ã®ç©çæ§é ãæ£ç¢ºã«è¡šãå¿ èŠããããŸãã ããšãã°ãåäžã®ããŒããã£ã¹ã¯ã®å Žåã2ãã倧ããå€ã¯éèŠãšèŠãªããããã£ã¹ã¯ã4ã€ã®ãã£ã¹ã¯ã®RAIDã¢ã¬ã€äžã«ããå Žåãå€ã4 * 2 = 8ãã倧ãããã©ãããå¿é ããå¿ èŠããããŸãã
Zabbix ïŒperf_counter [\ LogicalDiskïŒ_TotalïŒ\ Avgã ãã£ã¹ã¯ãã¥ãŒã®é·ã]ãããã³ç®çã®ãã£ã¹ã¯ã远跡ããããšãéèŠã§ããããšãã°ãperf_counter [\ LogicalDiskïŒC :) \ Avgã ãã£ã¹ã¯ãã¥ãŒã®é·ã]
- å¹³åãã£ã¹ã¯ç§/èªã¿åã
- èšæ¶
- ããŒãž/ç§
ã¢ã¯ã»ã¹æã«RAMã«ããŒããããªãã£ãã¡ã¢ãªã®ããŒãžãžã®ã¢ã¯ã»ã¹ãèš±å¯ããããã«ãSQL Serverããã£ã¹ã¯ããèªã¿åããŸãã¯ãã£ã¹ã¯ã«æžã蟌ãã ããŒãžæ°ã瀺ããŸãã ãã®å€ã¯ãããŒãžå ¥å/ç§ããã³ããŒãžåºå/ç§ã®å€ã®åèšã§ãããã¢ããªã±ãŒã·ã§ã³ããŒã¿ãã¡ã€ã«ã«ã¢ã¯ã»ã¹ããããã®ã·ã¹ãã ãã£ãã·ã¥ã®ããŒãžäº€æïŒã¹ã¯ãã/ã¹ã¯ããïŒãèæ ®ããŸãã ããã«ãããã«ã¯ãã¡ã¢ãªã«çŽæ¥ããããããéãã£ãã·ã¥ãã¡ã€ã«ã®ã¹ã¯ããã³ã°ãå«ãŸããŸãã ããã¯ãã¡ã¢ãªäœ¿çšéãšé¢é£ããéå°ãªããŒãžäº€æã«å€§ããªè² è·ãããå Žåã«ç£èŠããå¿ èŠãããã¡ã€ã³ã«ãŠã³ã¿ã§ãã ãã®ã«ãŠã³ã¿ãŒã¯ã¹ã¯ããå€ãç¹åŸŽä»ãããã®éåžžïŒéããŒã¯ïŒå€ã¯ãŒãã«è¿ãã¯ãã§ãã ã¹ã¯ããã®å¢å ã¯ãRAMãå¢ãããããµãŒããŒã§å®è¡ãããã¢ããªã±ãŒã·ã§ã³ã®æ°ãæžããå¿ èŠãããããšã瀺ããŸãã
Zabbix ïŒperf_counter [\ã¡ã¢ãª\ããŒãž/ç§]
ããªã¬ãŒã®äŸ ïŒ
{ããŒãåïŒperf_counter [\ã¡ã¢ãª\ããŒãž/ç§] .minïŒ5mïŒ}> 1000ãã¬ãã«æ å ± - ããŒãžãã©ãŒã«ã/ç§
ããã¯ãããŒãžãšã©ãŒã«ãŠã³ã¿ãŒã®å€ã§ãã ããã»ã¹ãRAMã®ã¯ãŒãã³ã°ã»ããã«ãªãä»®æ³ã¡ã¢ãªããŒãžãåç §ãããšãããŒãžãšã©ãŒãçºçããŸãã ãã®ã«ãŠã³ã¿ãŒã¯ããã£ã¹ã¯ãžã®ã¢ã¯ã»ã¹ãå¿ èŠãšããããŒãžãšã©ãŒãšãRAMã®ã¯ãŒãã³ã°ã»ããã®å€åŽã«ããããŒãžã«ãã£ãŠåŒãèµ·ãããããšã©ãŒã®äž¡æ¹ãèæ ®ããŸãã ã»ãšãã©ã®ããã»ããµã¯ã2çªç®ã®ã¿ã€ãã®ããŒãžãšã©ãŒã倧ããªé 延ãªãåŠçã§ããŸãã ãã ãããã£ã¹ã¯ã¢ã¯ã»ã¹ãå¿ èŠãšããæåã®ã¿ã€ãã®ããŒãžã®ãšã©ãŒåŠçã«ãããå€§å¹ ãªé 延ãçºçããå¯èœæ§ããããŸãã
Zabbix ïŒperf_counter [\ã¡ã¢ãª\ããŒãžãã©ãŒã«ã/ç§]
ããªã¬ãŒã®äŸ ïŒ
{ããŒãåïŒperf_counter [\ã¡ã¢ãª\ããŒãžãã©ãŒã«ã/ç§] .minïŒ5mïŒ}> 1000ãã¬ãã«æ å ± - å©çšå¯èœãªãã€ã
ããŸããŸãªããã»ã¹ã§äœ¿çšå¯èœãªã¡ã¢ãªã®éããã€ãåäœã§ç£èŠããŸãã äœã枬å®å€ã¯ã¡ã¢ãªäžè¶³ãæå³ããŸãã 解決çã¯ãã¡ã¢ãªãå¢ããããšã§ãã ã»ãšãã©ã®å Žåããã®ã«ãŠã³ã¿ã¯åžžã«5000 kWãè¶ ããŠããå¿ èŠããããŸãã
次ã®çç±ã«ãããAvailable Mbytesã®ãããå€ãæåã§èšå®ããããšã¯çã«ããªã£ãŠããŸãã
â¢50ïŒ ã®ç©ºãã¡ã¢ãªãå©çšå¯èœ=ãã°ããã
â¢å©çšå¯èœãªã¡ã¢ãªã®25ïŒ =泚æãå¿ èŠ
â¢10ïŒ ç¡æ=èããããåé¡
â¢äœ¿çšå¯èœãªã¡ã¢ãªã®5ïŒ æªæº=é床ã«éèŠãªãããä»å ¥ããå¿ èŠããããŸãã
Zabbix ïŒperf_counter [\ã¡ã¢ãª\å©çšå¯èœãªãã€ã]
- ããŒãž/ç§
- ããã»ããµãŒïŒåèšïŒïŒïŒ
Processor Time
ãã®ã«ãŠã³ã¿ã¯ãããã»ããµãéã¢ã€ãã«ã¹ã¬ããã®æäœã®å®è¡ã§ããžãŒã§ãã£ãæéã®å²åã瀺ããŸãã ãã®å€ã¯ãæçšãªäœæ¥ã®å®è£ ã«èµ·å ããæéã®ã»ãã®äžéšãšèŠãªãããšãã§ããŸãã åããã»ããµã¯ãä»ã®ã¹ã¬ããã«ãã£ãŠäœ¿çšãããªãéçç£çãªããã»ããµãµã€ã¯ã«ãæ¶è²»ããã¢ã€ãã«ã¹ã¬ããã«å²ãåœãŠãããšãã§ããŸãã ãã®ã«ãŠã³ã¿ãŒã¯ã100ïŒ ã«éããå¯èœæ§ã®ããçãããŒã¯ã«ãã£ãŠç¹åŸŽä»ããããŸãã ãã ããããã»ããµãŒäœ¿çšçã80ïŒ ãè¶ ããæéãé·ãå Žåãããå€ãã®ããã»ããµãŒã䜿çšãããšã·ã¹ãã ã®å¹çãåäžããŸãã
Zabbix ïŒperf_counter [\ ProcessorïŒ_TotalïŒ\ïŒ Processor Time]ãã«ãŒãã«ãåºåããå ŽæããããŸã
ããªã¬ãŒã®äŸ ïŒ
{ããŒãåïŒperf_counter [\ ProcessorïŒ_TotalïŒ\ïŒ Processor Time] .minïŒ5mïŒ}> 80ãlevel-info
- ãããã¯ãŒã¯ã€ã³ã¿ãŒãã§ã€ã¹ïŒ*ïŒïŒåèšãã€ãæ°/ç§
ãã¹ãŠã®ã€ã³ã¿ãŒãã§ãŒã¹ã§1ç§éã«éåä¿¡ãããåèšãã€ãæ°ã ããã¯ãã€ã³ã¿ãŒãã§ãŒã¹åž¯åå¹ ïŒãã€ãåäœïŒã§ãã ãã®ã«ãŠã³ã¿ã®å€ããããã¯ãŒã¯ã«ãŒãã®æ倧垯åå¹ ãšæ¯èŒããå¿ èŠããããŸãã éåžžããã®ã«ãŠã³ã¿ãŒã¯ããããã¯ãŒã¯ã¢ããã¿ãŒã®åž¯åå¹ ã®äœ¿çšçã50ïŒ ãè¶ ããªãããã«ããå¿ èŠããããŸãã
Zabbix ïŒperf_counter [\ãããã¯ãŒã¯ã€ã³ã¿ãŒãã§ãŒã¹ïŒ*ïŒ\éä¿¡ãã€ã/ç§]
- MS SQL ServerïŒã¢ã¯ã»ã¹æ¹æ³
SQL Serverã®ã¢ã¯ã»ã¹ã¡ãœãããªããžã§ã¯ãã¯ãããŒã¿ããŒã¹å ã®è«çããŒã¿ãžã®ã¢ã¯ã»ã¹ãç£èŠããã®ã«åœ¹ç«ã€ã«ãŠã³ã¿ãŒãæäŸããŸãã ãã£ã¹ã¯äžã®ããŒã¿ããŒã¹ããŒãžãžã®ç©çã¢ã¯ã»ã¹ã¯ããããã¡ãŒãããŒãžã£ãŒã«ãŠã³ã¿ãŒã䜿çšããŠå¶åŸ¡ãããŸãã ããŒã¿ããŒã¹ã¢ã¯ã»ã¹æ¹æ³ã®ç£èŠã¯ãã€ã³ããã¯ã¹ã®è¿œå ãŸãã¯å€æŽãã»ã¯ã·ã§ã³ã®è¿œå ãŸãã¯ç§»åããã¡ã€ã«ãŸãã¯ãã¡ã€ã«ã°ã«ãŒãã®è¿œå ãã€ã³ããã¯ã¹ã®æé©åããŸãã¯ã¯ãšãªã®ããã¹ãã®å€æŽã«ãã£ãŠãã¯ãšãªã®ããã©ãŒãã³ã¹ãæ¹åã§ãããã©ãããå€æããã®ã«åœ¹ç«ã¡ãŸãã ããã«ãã¢ã¯ã»ã¹æ¹æ³ãªããžã§ã¯ãã«ãŠã³ã¿ãŒã䜿çšããŠãããŒã¿ã®ãµã€ãºãã€ã³ããã¯ã¹ãããã³ããŒã¿ããŒã¹å ã®ç©ºãé åãç£èŠããåãµãŒããŒã€ã³ã¹ã¿ã³ã¹ã®ããªã¥ãŒã ãšæçåãå¶åŸ¡ã§ããŸãã ã€ã³ããã¯ã¹ã®æçåãå€ããããšãããã©ãŒãã³ã¹ãå€§å¹ ã«äœäžããå¯èœæ§ããããŸãã
- ããŒãžåå²/ç§
ã€ã³ããã¯ã¹ããŒãžã®ãªãŒããŒãããŒã«èµ·å ãã1ç§ãããã®æ¹ããŒãžã®æ°ã ãã®ã€ã³ãžã±ãŒã¿ãŒã®é«ãå€ã¯ãããŒã¿ãæ¿å ¥ããã³å€æŽããæäœãå®è¡ãããšãã«ãSQL Serverã倧éã®ãªãœãŒã¹ãæ¶è²»ããæäœãå®è¡ããŠããŒãžãåå²ããæ¢åã®ããŒãžã®äžéšãæ°ããå Žæã«ç§»åããå¿ èŠãããããšãæå³ããŸãã ãã®ãããªæäœã¯å¯èœãªéãåé¿ããå¿ èŠããããŸãã 次ã®2ã€ã®æ¹æ³ã§åé¡ã解決ã§ããŸãã
-èªåã€ã³ã¯ãªã¡ã³ãåã®ã¯ã©ã¹ã¿ãŒåã€ã³ããã¯ã¹ãäœæããŸãã ãã®å Žåãæ°ããã¬ã³ãŒãã¯æ¢ã«ããŒã¿ãå æããŠããããŒãžå ã«ã¯é 眮ãããŸããããåžžã«æ°ããããŒãžãå æããŸãã
-Fillfactorãã©ã¡ãŒã¿ãŒã®å€ãå¢ãããŠã€ã³ããã¯ã¹ãåæ§ç¯ããŸãã ãã®ãã©ã¡ãŒã¿ãŒã䜿çšãããšãããŒãžåå²æäœãå®è¡ããããšãªããæ°ããããŒã¿ãé 眮ããããã«äœ¿çšãããã€ã³ããã¯ã¹ããŒãžã®ç©ºãé åãäºçŽã§ããŸãã
Zabbix ïŒperf_counter ["\ MSSQL $ã€ã³ã¹ã¿ã³ã¹åïŒã¢ã¯ã»ã¹æ¹æ³\ããŒãžåå²/ç§"ã30]
ããªã¬ãŒã®äŸ ïŒ{ããŒãåïŒperf_counter ["\ MSSQL $ã€ã³ã¹ã¿ã³ã¹åïŒAccess Methods \ Page Splits / sec"ã30] .lastïŒïŒ}> {ããŒãåïŒperf_counter ["\ MSSQL $ã€ã³ã¹ã¿ã³ã¹åïŒSQL Statistics \ Batch Requests ã30] .lastïŒïŒ} / 5ãã¬ãã«æ å ±
- ãã«ã¹ãã£ã³/ç§
1ç§ãããã®ç¡å¶éã®ãã«ã¹ãã£ã³æäœã®æ°ã ãã®ãããªæäœã«ã¯ãã¡ã€ã³ããŒãã«ã®ã¹ãã£ã³ãšãã«ã€ã³ããã¯ã¹ã¹ãã£ã³ãå«ãŸããŸãã ãã®ææšã®å®å®ããå¢å ã¯ãã·ã¹ãã ã®å£åïŒå¿ èŠãªã€ã³ããã¯ã¹ã®æ¬ åŠããã®åŒ·åãªæçåãæ¢åã®ã€ã³ããã¯ã¹ã®ãªããã£ãã€ã¶ã«ããäžäœ¿çšãæªäœ¿çšã®ã€ã³ããã¯ã¹ã®ååšïŒã瀺ããŠããå ŽåããããŸãã ãã ããããŒãã«å šäœãRAMã«é 眮ãããšããã«ã¹ãã£ã³ãé«éã«ãªããããå°ããªããŒãã«ã§ã®ãã«ã¹ãã£ã³ãå¿ ãããæªãããã§ã¯ãªãããšã«æ³šæããŠãã ããã ãã ããã»ãšãã©ã®å Žåããã®ã«ãŠã³ã¿ã®ã€ã³ãžã±ãŒã¿ã®çå®ãªå¢å ã¯ãã·ã¹ãã ã®å£åã瀺ããŸãã ããã¯ãã¹ãŠOLTPã·ã¹ãã ã«ã®ã¿é©çšãããŸãã OLAPã·ã¹ãã ã§ã¯ãåžžæãã«ã¹ãã£ã³ãæ£åžžã§ãã
Zabbix ïŒperf_counter ["\ MSSQL $ã€ã³ã¹ã¿ã³ã¹åïŒã¢ã¯ã»ã¹æ¹æ³\ãã«ã¹ãã£ã³/ç§"ã30]
- ããŒãžåå²/ç§
- MS SQL ServerïŒãããã¡ãŒãããŒãžã£ãŒ
Buffer Managerãªããžã§ã¯ãã¯ãSQL Serverã次ã®ãªãœãŒã¹ãã©ã®ããã«äœ¿çšããããç£èŠããã«ãŠã³ã¿ãŒãæäŸããŸãã
-ããŒã¿ããŒãžãä¿åããããã®ã¡ã¢ãªã
-SQL ServerãããŒã¿ããŒã¹ããŒãžãèªã¿æžããããšãã«ç©çI / Oãç£èŠããããã«äœ¿çšãããã«ãŠã³ã¿ãŒã
-ãœãªããã¹ããŒããã©ã€ãïŒSSDïŒãªã©ã®é«éãªäžæ®çºæ§ã¡ã¢ãªã䜿çšããŠãããã¡ãã£ãã·ã¥ãæ¡åŒµããããã®ãããã¡ããŒã«ã®æ¡åŒµã
-SQL Serverã䜿çšããã¡ã¢ãªãšã«ãŠã³ã¿ãç£èŠãããšã次ã®æ å ±ãååŸã§ããŸãã
-ç©çã¡ã¢ãªã®äžè¶³ãåå ã§ããã«ããã¯ããããŸããã é »ç¹ã«äœ¿çšãããããŒã¿ããã£ãã·ã¥ã§ããªãå ŽåãSQL Serverã¯ãã®ããŒã¿ããã£ã¹ã¯ãã匷å¶çã«èªã¿åããŸãã
-ã¡ã¢ãªã®éãå¢ããããããŒã¿ã®ãã£ãã·ã¥ãå éšSQL Serveræ§é ã®ä¿åã«è¿œå ã®ã¡ã¢ãªãå²ãåœãŠãããšã§ãã¯ãšãªå®è¡ã®å¹çãäžããããšã¯å¯èœã§ããïŒ
-SQL Serverããã£ã¹ã¯ããããŒã¿ãèªã¿åãé »åºŠã ã¡ã¢ãªãžã®ã¢ã¯ã»ã¹ãªã©ã®ä»ã®æäœãšæ¯èŒãããšãç©çI / Oã«ã¯æéãããããŸãã I / Oãæžãããšãã¯ãšãªã®ããã©ãŒãã³ã¹ãåäžããŸãã
- ãããã¡ãã£ãã·ã¥ãããã©ãžãª
SQL Serverããã£ãã·ã¥ãããã¡ãŒã«ããŒã¿ãå®å šã«å²ãåœãŠãããšãã§ããæ¹æ³ã瀺ããŸãã ãã®å€ãé«ãã»ã©è¯ã SQLãµãŒããŒã®ããŒã¿ããŒãžã«å¹æçã«ã¢ã¯ã»ã¹ããã«ã¯ããããããã£ãã·ã¥ãããã¡ãŒã«ååšããç©çI / OïŒI / OïŒæäœãååšããªãå¿ èŠããããŸãã ãã®ã«ãŠã³ã¿ãŒã®å¹³åå€ã®çå®ãªæžå°ã芳å¯ãããå Žåã¯ãRAMã®è¿œå ãæ€èšããŠãã ããã ãã®ã€ã³ãžã±ãŒã¿ã¯ãOLTPã·ã¹ãã ã§ã¯åžžã«90ïŒ ãè¶ ããOLAPã·ã¹ãã ã§ã¯50ïŒ ãè¶ ããå¿ èŠããããŸãã
Zabbix ïŒperf_counter ["\ MSSQL $ã€ã³ã¹ã¿ã³ã¹åïŒãããã¡ãããŒãžã£\ãããã¡ãã£ãã·ã¥ãããç"ã30]
ããªã¬ãŒã®äŸ ïŒ{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒBuffer Manager \ Buffer cache hit ratio"ã30] .lastïŒïŒ} <70ãlevel-high
ãããŠ
{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒãããã¡ãŒãããŒãžã£ãŒ\ãããã¡ãŒãã£ãã·ã¥ãããç"ã30] .lastïŒïŒ} <80ãã¬ãã«å¹³å
- ããŒãžã®å¹³å寿åœ
çŸåšã®ç¶æ ã§ããŒãžãã¡ã¢ãªå ã«æ®ãæéã瀺ããŸãã å€ã絶ããäœäžããŠããå Žåãããã¯ã·ã¹ãã ããããã¡ããŒã«ãä¹±çšããŠããããšãæå³ããŸãã ãããã£ãŠãæœåšçã«ã¡ã¢ãªã®ããã©ãŒãã³ã¹ãåå ã§åé¡ãçºçããããã©ãŒãã³ã¹ãäœäžããå¯èœæ§ããããŸãã ã·ã¹ãã ããããã¡ããŒã«ãæªçšããŠããããšãæ確ã«å€æã§ããæ®éçãªã€ã³ãžã±ãŒã¿ã¯ãããŸããïŒ300ç§ã®ã€ã³ãžã±ãŒã¿ã¯MS SQL Server 2012以éå»æ¢ãããŠããŸãïŒã
Zabbix ïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒãããã¡ãŒãããŒãžã£ãŒ\ããŒãžã®å¹³å寿åœ"ã30]
ããªã¬ãŒã®äŸ ïŒ{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒBuffer Manager \ Page life expectancy"ã30] .lastïŒïŒ} <5ãã¬ãã«æ å ±
- ãããã¡ãã£ãã·ã¥ãããã©ãžãª
- MS SQL ServerïŒäžè¬çµ±èš
SQL Serverã®äžè¬çµ±èšãªããžã§ã¯ãã¯ãåææ¥ç¶ã®æ°ããSQL Serverã®ã€ã³ã¹ã¿ã³ã¹ãå®è¡ãããŠããã³ã³ãã¥ãŒã¿ãŒã«æ¥ç¶ãŸãã¯åæãã1ç§ãããã®ãŠãŒã¶ãŒæ°ãªã©ããµãŒããŒå šäœã®ã¢ã¯ãã£ããã£ãç£èŠã§ããã«ãŠã³ã¿ãŒãæäŸããŸãã ãããã®ã¡ããªãã¯ã¯ãå€æ°ã®ã¯ã©ã€ã¢ã³ããSQL Serverã®ã€ã³ã¹ã¿ã³ã¹ã«åžžææ¥ç¶ããã³åæããŠãã倧èŠæš¡ãªãªã³ã©ã€ã³ãã©ã³ã¶ã¯ã·ã§ã³åŠçïŒOLTPïŒã·ã¹ãã ã§åœ¹ç«ã¡ãŸãã
- ãããã¯ãããããã»ã¹
çŸåšãããã¯ãããŠããããã»ã¹ã®æ°ã
Zabbix ïŒperf_counter ["\ MSSQL $ã€ã³ã¹ã¿ã³ã¹åïŒäžè¬çµ±èš\ããã»ã¹ãããã¯"ã30]
ããªã¬ãŒã®äŸ ïŒïŒ{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒGeneral Statistics \ Processes blocked"ã30] .minïŒ2mã0ïŒ}> = 0ïŒ
ããã³ïŒ{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒGeneral Statistics \ Processes block"ã30] .timeïŒ0ïŒ}> = 50000ïŒ
ããã³ïŒ{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒGeneral Statistics \ Processes blocked"ã30] .timeïŒ0ïŒ} <= 230000ïŒãã¬ãã«æ å ±ïŒ05:00ãã23:00ãŸã§ã®ã¢ã©ãŒã å¶éããããŸãïŒ ïŒ
- ãŠãŒã¶ãŒæ¥ç¶
çŸåšSQL Serverã«æ¥ç¶ããŠãããŠãŒã¶ãŒã®æ°ã
Zabbix ïŒperf_counter ["\ MSSQL $ INSTANCE NAMEïŒGeneral Statistics \ User Connections"ã30]
- ãããã¯ãããããã»ã¹
- MS SQL ServerïŒããã¯
Microsoft SQL Serverã®Locksãªããžã§ã¯ãã¯ãåã ã®ãªãœãŒã¹ã¿ã€ãã«å¯ŸããŠååŸãããSQL Serverããã¯ã«é¢ããæ å ±ãæäŸããŸãã è€æ°ã®ãã©ã³ã¶ã¯ã·ã§ã³ããªãœãŒã¹ãåæã«äœ¿çšããããšãé²ãããã«ããã©ã³ã¶ã¯ã·ã§ã³ã«ãã£ãŠèªã¿åãããè¡ãå€æŽãããè¡ãªã©ã®SQL ServerãªãœãŒã¹ã«å¯ŸããŠããã¯ãçºè¡ãããŸãã ããšãã°ãããŒãã«ã®è¡ã®ãã©ã³ã¶ã¯ã·ã§ã³ãæä»ïŒXïŒããã¯ãåãåã£ãå Žåãä»ã®ãã©ã³ã¶ã¯ã·ã§ã³ã¯ããã¯ã解é€ããããŸã§ãã®è¡ãå€æŽã§ããŸããã ããã¯ã®äœ¿çšãæå°éã«ãããšãåæå®è¡æ§ãåäžããå šäœçãªããã©ãŒãã³ã¹ãåäžããŸãã Locksãªããžã§ã¯ãã®è€æ°ã®ã€ã³ã¹ã¿ã³ã¹ãåæã«è¿œè·¡ã§ããŸããåã€ã³ã¹ã¿ã³ã¹ã¯ãåå¥ã®ã¿ã€ãã®ãªãœãŒã¹ã®ããã¯ã«ãªããŸãã
- å¹³ååŸ
æ©æéïŒããªç§ïŒ
åŸ æ©ãå¿ èŠãªãã¹ãŠã®ããã¯èŠæ±ã®å¹³ååŸ æ©æéïŒããªç§ïŒã ãã®ã«ãŠã³ã¿ã¯ããªãœãŒã¹ãããã¯ããããã«ããŠãŒã¶ãŒããã»ã¹ãå¹³åããŠã©ãã ããã¥ãŒã«å ¥ããå¿ èŠããããã瀺ããŸãã ãã®ã«ãŠã³ã¿ãŒã®æ倧蚱容å€ã¯ã¿ã¹ã¯ã«å®å šã«äŸåããŸããããã§ãã¹ãŠã®ã¢ããªã±ãŒã·ã§ã³ã®å¹³åå€ã決å®ããããšã¯å°é£ã§ãã ãã®ã«ãŠã³ã¿ã®èšå®ãé«ããããšãããŒã¿ããŒã¹ã®ããã¯ã«åé¡ãããå¯èœæ§ããããŸãã
Zabbix ïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒããã¯ïŒ_TotalïŒ\å¹³ååŸ æ©æéïŒmsïŒ"ã30]
ããªã¬ãŒã®äŸ ïŒ{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒLocksïŒ_TotalïŒ\ Average Wait TimeïŒmsïŒ"ã30] .lastïŒïŒ}> = 500ãã¬ãã«æ å ±
- ããã¯åŸ
æ©æéïŒããªç§ïŒ
æåŸã®1ç§éã®åèšããã¯åŸ æ©æéïŒããªç§ïŒã
Zabbix ïŒperf_counter ["\ MSSQL $ã€ã³ã¹ã¿ã³ã¹åïŒããã¯ïŒ_TotalïŒ\ããã¯åŸ æ©æéïŒmsïŒ"ã30] - ããã¯åŸ
æ©/ç§
ããã¯èŠæ±ã«é¢é£ããŠã¹ã¬ãããåŸ æ©ããå¿ èŠããã£ãæåŸã®1ç§éã®ã±ãŒã¹ã®æ°ã
Zabbix ïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒLocksïŒ_TotalïŒ\ Lock Waits / sec"ã30] - ããã¯ã¿ã€ã ã¢ãŠã/ç§
ãµã€ã¯ãªãã¯ã¢ã¯ã»ã¹ã§ããã¯ãååŸã§ããªãå Žåã®ç¹°ãè¿ãåæ°ã SQL Serverã¹ãã³ã«ãŠã³ã¿ãŒæ§æãã©ã¡ãŒã¿ãŒã®å€ã¯ãã¿ã€ã ã¢ãŠããæéåãã«ãªããã¹ã¬ãããéã¢ã¯ãã£ãç¶æ ã«ãªããŸã§ã®ã¹ã¬ããã®ãã¹ãã³ãã®æ°ã決å®ããŸãã
Zabbix ïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒLocksïŒ_TotalïŒ\ Lock Timeouts / sec"ã30]
ããªã¬ãŒã®äŸ ïŒ{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒLocksïŒ_TotalïŒ\ LocksïŒ_TotalïŒ\ Lock Timeouts / sec"ã30] .lastïŒïŒ}> 1000ãã¬ãã«æ å ± - ããã¯èŠæ±/ç§
æå®ãããããã¯ã¿ã€ãã®1ç§ãããã®ãªã¯ãšã¹ãæ°ã
Zabbix ïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒLocksïŒ_TotalïŒ\ Lock Requests / sec"ã30]
ããªã¬ãŒã®äŸ ïŒ{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒLocksïŒ_TotalïŒ\ Lock Requests / sec"ã30] .lastïŒïŒ}> 500000ãã¬ãã«æ å ± - ãããããã¯ã®ããã¯æ°/ç§
ãããããã¯ã«ã€ãªãã1ç§ãããã®ããã¯èŠæ±ã®æ°ã ãããããã¯ã®ååšã¯ãå ±æãªãœãŒã¹ããããã¯ããäžé©åã«æ§ç¯ãããã¯ãšãªã瀺ããŸãã
Zabbix ïŒperf_counter ["\ MSSQL $ã€ã³ã¹ã¿ã³ã¹åïŒãããããã¯æ°/ç§"ã30]
ããªã¬ãŒã®äŸ ïŒ{NODE_NAMEïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒLocksïŒ_TotalïŒ\ Number of Deadlocks / sec"ã30] .lastïŒïŒ}> 1ãlevel-high
- å¹³ååŸ
æ©æéïŒããªç§ïŒ
- MS SQL ServerïŒã¡ã¢ãªãããŒãžã£ãŒ
Microsoft SQL Serverã®ã¡ã¢ãªãããŒãžã£ãŒãªããžã§ã¯ãã¯ããµãŒããŒå šäœã®ã¡ã¢ãªäœ¿çšéãç£èŠããããã®ã«ãŠã³ã¿ãŒãæäŸããŸãã ãµãŒããŒå šäœã®ã¡ã¢ãªäœ¿çšéãç£èŠããŠãŠãŒã¶ãŒã¢ã¯ãã£ããã£ãšãªãœãŒã¹äœ¿çšçãè©äŸ¡ãããšãããã©ãŒãã³ã¹ã®äœäžãç¹å®ããã®ã«åœ¹ç«ã¡ãŸãã SQL Serverã®ã€ã³ã¹ã¿ã³ã¹ã§äœ¿çšãããã¡ã¢ãªå¶åŸ¡ã¯ã以äžã決å®ããã®ã«åœ¹ç«ã¡ãŸãã
-é »ç¹ã«äœ¿çšãããããŒã¿ããã£ãã·ã¥ã«ä¿åããã®ã«äžååãªç©çã¡ã¢ãªã«ã®ã£ããããããŸããã ååãªã¡ã¢ãªããªãå ŽåãSQL Serverã¯ãã£ã¹ã¯ããããŒã¿ãååŸããå¿ èŠããããŸãã
-ã¡ã¢ãªãè¿œå ããå ŽåããŸãã¯ããŒã¿ãŸãã¯å éšSQL Serveræ§é ããã£ãã·ã¥ããããã«äœ¿çšå¯èœãªã¡ã¢ãªã®éãå¢ãããå Žåãã¯ãšãªã®ããã©ãŒãã³ã¹ãåäžããŸãã
- ã¡ã¢ãªèš±å¯
ã¯ãŒã¯ã¹ããŒã¹ã¡ã¢ãªãæ£åžžã«åä¿¡ããããã»ã¹ã®ç·æ°ã瀺ããŸãã ã€ã³ãã£ã±ãŒã¿ãŒãå®å®ããŠäœäžããå ŽåãRAMãå¢ããå¿ èŠããããŸãã
Zabbix ïŒperf_counter ["\ MSSQL $ INSTANCE NAMEïŒã¡ã¢ãªãããŒãžã£ãŒ\ã¡ã¢ãªèš±å¯æªè§£æ±º"ã30]
- ã¡ã¢ãªèš±å¯
äœæ¥ã¡ã¢ãªã®æäŸãåŸ æ©ããŠããããã»ã¹ã®ç·æ°ã瀺ããŸãã å®å®ããæé·çã§ã¯ãRAMãå¢ããå¿ èŠããããŸãã
Zabbix ïŒperf_counter ["\ MSSQL $ INSTANCE NAMEïŒã¡ã¢ãªãããŒãžã£ãŒ\ã¡ã¢ãªèš±å¯ä¿çäž"ã30]
- ã¡ã¢ãªèš±å¯
- MS SQL ServerïŒçµ±èš
Microsoft SQL Serverã®Statisticsãªããžã§ã¯ãã¯ãSQL Serverã®ã€ã³ã¹ã¿ã³ã¹ã«éä¿¡ãããã¯ãšãªã®ã³ã³ãã€ã«ãšçš®é¡ãç£èŠããããã®ã«ãŠã³ã¿ãŒãæäŸããŸãã ã¯ãšãªã®ã³ã³ãã€ã«ãšåã³ã³ãã€ã«ã®æ°ãããã³SQL Serverã®ã€ã³ã¹ã¿ã³ã¹ãåä¿¡ããããã±ãŒãžã®æ°ãç£èŠãããšãSQL ServerããŠãŒã¶ãŒã¯ãšãªãå®è¡ããé床ãšãã¯ãšãªãªããã£ãã€ã¶ãŒãããããå¹ççã«åŠçããæ¹æ³ãããããŸãã
- ããããªã¯ãšã¹ã/ç§
1ç§ãããã«åä¿¡ããTransact-SQLã³ãã³ããã±ããã®æ°ã ãããã®çµ±èšã¯ãå¶éïŒå ¥å/åºåããŠãŒã¶ãŒæ°ããã£ãã·ã¥ãµã€ãºãã¯ãšãªã®è€éããªã©ïŒã®åœ±é¿ãåããŸãã 倧éã®ãã±ããèŠæ±ã¯ãé«ãã¹ã«ãŒãããã瀺ããŸãã
Zabbix ïŒperf_counter ["\ MSSQL $ INSTANCE_NAMEïŒSQL Statistics \ Batch Requests / sec"ã30]
- ããããªã¯ãšã¹ã/ç§
äžèšã®ãã¹ãŠã«å ããŠãä»ã®ããŒã¿èŠçŽ ãæ§æããããšãã§ããŸãïŒããã«ãåŸç¶ã®éç¥ã§ãããã®ããªã¬ãŒãäœæããŸãïŒã
1ïŒç©ºããã£ã¹ã¯å®¹é
2ïŒããŒã¿ããŒã¹ããŒã¿ãã¡ã€ã«ãšãã°ãã°ã®ãµã€ãº
ãªã©
ãã ãããããã®ã€ã³ãžã±ãŒã¿ã¯ãã¹ãŠãã¯ãšãªã®åé¡ããªã¢ã«ã¿ã€ã ã§è¡šç€ºããããã§ã¯ãããŸããã
ãããè¡ãã«ã¯ãç¬èªã®ç¹å¥ãªã«ãŠã³ã¿ãŒãäœæããŸãã
ãã©ã€ãã·ãŒãèæ ®ããŠããã®ãããªã«ãŠã³ã¿ãŒã®äŸã¯ç€ºããŸããã ããã«ãã·ã¹ãã ããšã«äžæã«æ§æãããŸãã ãã ãã1CãNAVãCRMãªã©ã®ã·ã¹ãã ã§ã¯ã察å¿ããéçºè ãšäžç·ã«å°çšã®ã«ãŠã³ã¿ãŒãäœæã§ããããšã«æ³šæããŠãã ããã
åæç¹ã§å®è¡ãããŠããèŠæ±ã®æ°ãšå®è¡ãåŸ æ©ããŠããèŠæ±ïŒäžæãŸãã¯ãããã¯ãããŠããïŒã®æ°ã瀺ãäžè¬çãªã€ã³ãžã±ãŒã¿ãŒãäœæããäŸã瀺ããŸãã
ãããè¡ãã«ã¯ãã¹ãã¢ãããã·ãŒãžã£ãäœæããŸãã
ã³ãŒã
USE [__] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [nav].[ZabbixGetCountRequestStatus] @Status nvarchar(255) AS BEGIN /* - */ SET NOCOUNT ON; select count(*) as [Count] from sys.dm_exec_requests ER with(readuncommitted) where [status]=@Status END
次ã«ãZabbixãé 眮ãããŠãããã©ã«ããŒïŒzabbix \ conf \ userparams.dïŒã«ç§»åããps1æ¡åŒµåãæã€2ã€ã®ãã¡ã€ã«ïŒPowerShellïŒãäœæããããããã«æ¬¡ã®ã³ãŒããèšè¿°ããŸãã
ã¯ãšãªãå®è¡ããããã®ã³ãŒã
$SQLServer = "_"; $uid = ""; $pwd = ""; $Status="running"; $connectionString = "Server = $SQLServer; Database=_; Integrated Security = False; User ID = $uid; Password = $pwd;"; $connection = New-Object System.Data.SqlClient.SqlConnection; $connection.ConnectionString = $connectionString; # MSSQL / Create a request directly to MSSQL $SqlCmd = New-Object System.Data.SqlClient.SqlCommand; $SqlCmd.CommandType = [System.Data.CommandType]::StoredProcedure; $SqlCmd.CommandText = "nav.ZabbixGetCountRequestStatus"; $SqlCmd.Connection = $Connection; $paramStatus=$SqlCmd.Parameters.Add("@Status" , [System.Data.SqlDbType]::VarChar); $paramStatus.Value = $Status; $connection.Open(); $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter; $SqlAdapter.SelectCommand = $SqlCmd; $DataSet = New-Object System.Data.DataSet; $SqlAdapter.Fill($DataSet) > $null; $connection.Close(); $result = $DataSet.Tables[0].Rows[0]["Count"]; write-host $result;
ä¿çäžã®ãªã¯ãšã¹ãã®ã³ãŒã
$SQLServer = "_"; $uid = ""; $pwd = ""; $Status="suspended"; $connectionString = "Server = $SQLServer; Database=_; Integrated Security = False; User ID = $uid; Password = $pwd;"; $connection = New-Object System.Data.SqlClient.SqlConnection; $connection.ConnectionString = $connectionString; # MSSQL / Create a request directly to MSSQL $SqlCmd = New-Object System.Data.SqlClient.SqlCommand; $SqlCmd.CommandType = [System.Data.CommandType]::StoredProcedure; $SqlCmd.CommandText = "nav.ZabbixGetCountRequestStatus"; $SqlCmd.Connection = $Connection; $paramStatus=$SqlCmd.Parameters.Add("@Status" , [System.Data.SqlDbType]::VarChar); $paramStatus.Value = $Status; $connection.Open(); $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter; $SqlAdapter.SelectCommand = $SqlCmd; $DataSet = New-Object System.Data.DataSet; $SqlAdapter.Fill($DataSet) > $null; $connection.Close(); $result = $DataSet.Tables[0].Rows[0]["Count"]; write-host $result;
次ã«ããŠãŒã¶ãŒãã©ã¡ãŒã¿ãšæ¡åŒµå.confã䜿çšããŠãã¡ã€ã«ãäœæããå¿ èŠããããŸãïŒãŸãã¯ã以åã«äœæãããŠããå Žåã¯ãæ¢åã®ãŠãŒã¶ãŒãã¡ã€ã«ã«è¡ãè¿œå ããŸãïŒã
UserParameter = PARAMETER_NAME_NUMBERã®ãªã¯ãšã¹ãããããªã¯ãšã¹ããpowershell -NoProfile -ExecutionPolicy Bypass -File FULL_path \ zabbix \ conf \ userparams.d \ EXIT_FILENAME_NAME
UserParameter =ä¿çäžã®ãªã¯ãšã¹ãã®PARAMETER_NAME_NUMBERãpowershell -NoProfile -ExecutionPolicy Bypass -File FULL_Path \ zabbix \ conf \ userparams.d \ WAITING_FILTER_NAMEå
ãã®åŸã.confãã¡ã€ã«ãä¿åããZabbixãšãŒãžã§ã³ããåèµ·åããŸãã
ãã®åŸã2ã€ã®èŠçŽ ãZabbix newã«è¿œå ããŸãïŒãã®å ŽåãååãšããŒã¯äžèŽããŸãïŒã
TITLE_NAME_NUMBER_ OF QUESTIONS REQUESTED
TITLE_NAME_NUMBER_ OF EXPEDED REQUESTS
äœæããã«ã¹ã¿ã ããŒã¿èŠçŽ ã®ã°ã©ããšããªã¬ãŒãäœæã§ããããã«ãªããŸããã
ä¿çäžã®ãªã¯ãšã¹ãã®æ°ãæ¥æ¿ã«å¢å ããå Žåã次ã®ãªã¯ãšã¹ãã¯ãçŸåšå®è¡äžããã³ä¿çäžã®ãã¹ãŠã®ãªã¯ãšã¹ããããªã¯ãšã¹ãã®å®è¡å Žæããã³ãã°ã€ã³ã®è©³çŽ°ããªã¯ãšã¹ãã®ããã¹ãããã³èšç»ããã®ä»ã®è©³çŽ°ãšãšãã«è¡šç€ºã§ããŸãã
ã³ãŒã
/*, , , */ with tbl0 as ( select ES.[session_id] ,ER.[blocking_session_id] ,ER.[request_id] ,ER.[start_time] ,ER.[status] ,ES.[status] as [status_session] ,ER.[command] ,ER.[percent_complete] ,DB_Name(coalesce(ER.[database_id], ES.[database_id])) as [DBName] ,(select top(1) [text] from sys.dm_exec_sql_text(ER.[sql_handle])) as [TSQL] ,(select top(1) [objectid] from sys.dm_exec_sql_text(ER.[sql_handle])) as [objectid] ,(select top(1) [query_plan] from sys.dm_exec_query_plan(ER.[plan_handle])) as [QueryPlan] ,ER.[wait_type] ,ES.[login_time] ,ES.[host_name] ,ES.[program_name] ,ER.[wait_time] ,ER.[last_wait_type] ,ER.[wait_resource] ,ER.[open_transaction_count] ,ER.[open_resultset_count] ,ER.[transaction_id] ,ER.[context_info] ,ER.[estimated_completion_time] ,ER.[cpu_time] ,ER.[total_elapsed_time] ,ER.[scheduler_id] ,ER.[task_address] ,ER.[reads] ,ER.[writes] ,ER.[logical_reads] ,ER.[text_size] ,ER.[language] ,ER.[date_format] ,ER.[date_first] ,ER.[quoted_identifier] ,ER.[arithabort] ,ER.[ansi_null_dflt_on] ,ER.[ansi_defaults] ,ER.[ansi_warnings] ,ER.[ansi_padding] ,ER.[ansi_nulls] ,ER.[concat_null_yields_null] ,ER.[transaction_isolation_level] ,ER.[lock_timeout] ,ER.[deadlock_priority] ,ER.[row_count] ,ER.[prev_error] ,ER.[nest_level] ,ER.[granted_query_memory] ,ER.[executing_managed_code] ,ER.[group_id] ,ER.[query_hash] ,ER.[query_plan_hash] ,EC.[most_recent_session_id] ,EC.[connect_time] ,EC.[net_transport] ,EC.[protocol_type] ,EC.[protocol_version] ,EC.[endpoint_id] ,EC.[encrypt_option] ,EC.[auth_scheme] ,EC.[node_affinity] ,EC.[num_reads] ,EC.[num_writes] ,EC.[last_read] ,EC.[last_write] ,EC.[net_packet_size] ,EC.[client_net_address] ,EC.[client_tcp_port] ,EC.[local_net_address] ,EC.[local_tcp_port] ,EC.[parent_connection_id] ,EC.[most_recent_sql_handle] ,ES.[host_process_id] ,ES.[client_version] ,ES.[client_interface_name] ,ES.[security_id] ,ES.[login_name] ,ES.[nt_domain] ,ES.[nt_user_name] ,ES.[memory_usage] ,ES.[total_scheduled_time] ,ES.[last_request_start_time] ,ES.[last_request_end_time] ,ES.[is_user_process] ,ES.[original_security_id] ,ES.[original_login_name] ,ES.[last_successful_logon] ,ES.[last_unsuccessful_logon] ,ES.[unsuccessful_logons] ,ES.[authenticating_database_id] ,ER.[sql_handle] ,ER.[statement_start_offset] ,ER.[statement_end_offset] ,ER.[plan_handle] ,ER.[dop] ,coalesce(ER.[database_id], ES.[database_id]) as [database_id] ,ER.[user_id] ,ER.[connection_id] from sys.dm_exec_requests ER with(readuncommitted) right join sys.dm_exec_sessions ES with(readuncommitted) on ES.session_id = ER.session_id left join sys.dm_exec_connections EC with(readuncommitted) on EC.session_id = ES.session_id ) , tbl as ( select [session_id] ,[blocking_session_id] ,[request_id] ,[start_time] ,[status] ,[status_session] ,[command] ,[percent_complete] ,[DBName] ,OBJECT_name([objectid], [database_id]) as [object] ,[TSQL] ,[QueryPlan] ,[wait_type] ,[login_time] ,[host_name] ,[program_name] ,[wait_time] ,[last_wait_type] ,[wait_resource] ,[open_transaction_count] ,[open_resultset_count] ,[transaction_id] ,[context_info] ,[estimated_completion_time] ,[cpu_time] ,[total_elapsed_time] ,[scheduler_id] ,[task_address] ,[reads] ,[writes] ,[logical_reads] ,[text_size] ,[language] ,[date_format] ,[date_first] ,[quoted_identifier] ,[arithabort] ,[ansi_null_dflt_on] ,[ansi_defaults] ,[ansi_warnings] ,[ansi_padding] ,[ansi_nulls] ,[concat_null_yields_null] ,[transaction_isolation_level] ,[lock_timeout] ,[deadlock_priority] ,[row_count] ,[prev_error] ,[nest_level] ,[granted_query_memory] ,[executing_managed_code] ,[group_id] ,[query_hash] ,[query_plan_hash] ,[most_recent_session_id] ,[connect_time] ,[net_transport] ,[protocol_type] ,[protocol_version] ,[endpoint_id] ,[encrypt_option] ,[auth_scheme] ,[node_affinity] ,[num_reads] ,[num_writes] ,[last_read] ,[last_write] ,[net_packet_size] ,[client_net_address] ,[client_tcp_port] ,[local_net_address] ,[local_tcp_port] ,[parent_connection_id] ,[most_recent_sql_handle] ,[host_process_id] ,[client_version] ,[client_interface_name] ,[security_id] ,[login_name] ,[nt_domain] ,[nt_user_name] ,[memory_usage] ,[total_scheduled_time] ,[last_request_start_time] ,[last_request_end_time] ,[is_user_process] ,[original_security_id] ,[original_login_name] ,[last_successful_logon] ,[last_unsuccessful_logon] ,[unsuccessful_logons] ,[authenticating_database_id] ,[sql_handle] ,[statement_start_offset] ,[statement_end_offset] ,[plan_handle] ,[dop] ,[database_id] ,[user_id] ,[connection_id] from tbl0 where [status] in ('suspended', 'running', 'runnable') ) , tbl_group as ( select [blocking_session_id] from tbl where [blocking_session_id]<>0 group by [blocking_session_id] ) , tbl_res_rec as ( select [session_id] ,[blocking_session_id] ,[request_id] ,[start_time] ,[status] ,[status_session] ,[command] ,[percent_complete] ,[DBName] ,[object] ,[TSQL] ,[QueryPlan] ,[wait_type] ,[login_time] ,[host_name] ,[program_name] ,[wait_time] ,[last_wait_type] ,[wait_resource] ,[open_transaction_count] ,[open_resultset_count] ,[transaction_id] ,[context_info] ,[estimated_completion_time] ,[cpu_time] ,[total_elapsed_time] ,[scheduler_id] ,[task_address] ,[reads] ,[writes] ,[logical_reads] ,[text_size] ,[language] ,[date_format] ,[date_first] ,[quoted_identifier] ,[arithabort] ,[ansi_null_dflt_on] ,[ansi_defaults] ,[ansi_warnings] ,[ansi_padding] ,[ansi_nulls] ,[concat_null_yields_null] ,[transaction_isolation_level] ,[lock_timeout] ,[deadlock_priority] ,[row_count] ,[prev_error] ,[nest_level] ,[granted_query_memory] ,[executing_managed_code] ,[group_id] ,[query_hash] ,[query_plan_hash] ,[most_recent_session_id] ,[connect_time] ,[net_transport] ,[protocol_type] ,[protocol_version] ,[endpoint_id] ,[encrypt_option] ,[auth_scheme] ,[node_affinity] ,[num_reads] ,[num_writes] ,[last_read] ,[last_write] ,[net_packet_size] ,[client_net_address] ,[client_tcp_port] ,[local_net_address] ,[local_tcp_port] ,[parent_connection_id] ,[most_recent_sql_handle] ,[host_process_id] ,[client_version] ,[client_interface_name] ,[security_id] ,[login_name] ,[nt_domain] ,[nt_user_name] ,[memory_usage] ,[total_scheduled_time] ,[last_request_start_time] ,[last_request_end_time] ,[is_user_process] ,[original_security_id] ,[original_login_name] ,[last_successful_logon] ,[last_unsuccessful_logon] ,[unsuccessful_logons] ,[authenticating_database_id] ,[sql_handle] ,[statement_start_offset] ,[statement_end_offset] ,[plan_handle] ,[dop] ,[database_id] ,[user_id] ,[connection_id] , 0 as [is_blocking_other_session] from tbl union all select tbl0.[session_id] ,tbl0.[blocking_session_id] ,tbl0.[request_id] ,tbl0.[start_time] ,tbl0.[status] ,tbl0.[status_session] ,tbl0.[command] ,tbl0.[percent_complete] ,tbl0.[DBName] ,OBJECT_name(tbl0.[objectid], tbl0.[database_id]) as [object] ,tbl0.[TSQL] ,tbl0.[QueryPlan] ,tbl0.[wait_type] ,tbl0.[login_time] ,tbl0.[host_name] ,tbl0.[program_name] ,tbl0.[wait_time] ,tbl0.[last_wait_type] ,tbl0.[wait_resource] ,tbl0.[open_transaction_count] ,tbl0.[open_resultset_count] ,tbl0.[transaction_id] ,tbl0.[context_info] ,tbl0.[estimated_completion_time] ,tbl0.[cpu_time] ,tbl0.[total_elapsed_time] ,tbl0.[scheduler_id] ,tbl0.[task_address] ,tbl0.[reads] ,tbl0.[writes] ,tbl0.[logical_reads] ,tbl0.[text_size] ,tbl0.[language] ,tbl0.[date_format] ,tbl0.[date_first] ,tbl0.[quoted_identifier] ,tbl0.[arithabort] ,tbl0.[ansi_null_dflt_on] ,tbl0.[ansi_defaults] ,tbl0.[ansi_warnings] ,tbl0.[ansi_padding] ,tbl0.[ansi_nulls] ,tbl0.[concat_null_yields_null] ,tbl0.[transaction_isolation_level] ,tbl0.[lock_timeout] ,tbl0.[deadlock_priority] ,tbl0.[row_count] ,tbl0.[prev_error] ,tbl0.[nest_level] ,tbl0.[granted_query_memory] ,tbl0.[executing_managed_code] ,tbl0.[group_id] ,tbl0.[query_hash] ,tbl0.[query_plan_hash] ,tbl0.[most_recent_session_id] ,tbl0.[connect_time] ,tbl0.[net_transport] ,tbl0.[protocol_type] ,tbl0.[protocol_version] ,tbl0.[endpoint_id] ,tbl0.[encrypt_option] ,tbl0.[auth_scheme] ,tbl0.[node_affinity] ,tbl0.[num_reads] ,tbl0.[num_writes] ,tbl0.[last_read] ,tbl0.[last_write] ,tbl0.[net_packet_size] ,tbl0.[client_net_address] ,tbl0.[client_tcp_port] ,tbl0.[local_net_address] ,tbl0.[local_tcp_port] ,tbl0.[parent_connection_id] ,tbl0.[most_recent_sql_handle] ,tbl0.[host_process_id] ,tbl0.[client_version] ,tbl0.[client_interface_name] ,tbl0.[security_id] ,tbl0.[login_name] ,tbl0.[nt_domain] ,tbl0.[nt_user_name] ,tbl0.[memory_usage] ,tbl0.[total_scheduled_time] ,tbl0.[last_request_start_time] ,tbl0.[last_request_end_time] ,tbl0.[is_user_process] ,tbl0.[original_security_id] ,tbl0.[original_login_name] ,tbl0.[last_successful_logon] ,tbl0.[last_unsuccessful_logon] ,tbl0.[unsuccessful_logons] ,tbl0.[authenticating_database_id] ,tbl0.[sql_handle] ,tbl0.[statement_start_offset] ,tbl0.[statement_end_offset] ,tbl0.[plan_handle] ,tbl0.[dop] ,tbl0.[database_id] ,tbl0.[user_id] ,tbl0.[connection_id] , 1 as [is_blocking_other_session] from tbl_group as tg inner join tbl0 on tg.blocking_session_id=tbl0.session_id ) ,tbl_res_rec_g as ( select [plan_handle], [sql_handle], cast([start_time] as date) as [start_time] from tbl_res_rec group by [plan_handle], [sql_handle], cast([start_time] as date) ) ,tbl_rec_stat_g as ( select qs.[plan_handle] ,qs.[sql_handle] --,cast(qs.[last_execution_time] as date) as [last_execution_time] ,min(qs.[creation_time]) as [creation_time] ,max(qs.[execution_count]) as [execution_count] ,max(qs.[total_worker_time]) as [total_worker_time] ,min(qs.[last_worker_time]) as [min_last_worker_time] ,max(qs.[last_worker_time]) as [max_last_worker_time] ,min(qs.[min_worker_time]) as [min_worker_time] ,max(qs.[max_worker_time]) as [max_worker_time] ,max(qs.[total_physical_reads]) as [total_physical_reads] ,min(qs.[last_physical_reads]) as [min_last_physical_reads] ,max(qs.[last_physical_reads]) as [max_last_physical_reads] ,min(qs.[min_physical_reads]) as [min_physical_reads] ,max(qs.[max_physical_reads]) as [max_physical_reads] ,max(qs.[total_logical_writes]) as [total_logical_writes] ,min(qs.[last_logical_writes]) as [min_last_logical_writes] ,max(qs.[last_logical_writes]) as [max_last_logical_writes] ,min(qs.[min_logical_writes]) as [min_logical_writes] ,max(qs.[max_logical_writes]) as [max_logical_writes] ,max(qs.[total_logical_reads]) as [total_logical_reads] ,min(qs.[last_logical_reads]) as [min_last_logical_reads] ,max(qs.[last_logical_reads]) as [max_last_logical_reads] ,min(qs.[min_logical_reads]) as [min_logical_reads] ,max(qs.[max_logical_reads]) as [max_logical_reads] ,max(qs.[total_clr_time]) as [total_clr_time] ,min(qs.[last_clr_time]) as [min_last_clr_time] ,max(qs.[last_clr_time]) as [max_last_clr_time] ,min(qs.[min_clr_time]) as [min_clr_time] ,max(qs.[max_clr_time]) as [max_clr_time] ,max(qs.[total_elapsed_time]) as [total_elapsed_time] ,min(qs.[last_elapsed_time]) as [min_last_elapsed_time] ,max(qs.[last_elapsed_time]) as [max_last_elapsed_time] ,min(qs.[min_elapsed_time]) as [min_elapsed_time] ,max(qs.[max_elapsed_time]) as [max_elapsed_time] ,max(qs.[total_rows]) as [total_rows] ,min(qs.[last_rows]) as [min_last_rows] ,max(qs.[last_rows]) as [max_last_rows] ,min(qs.[min_rows]) as [min_rows] ,max(qs.[max_rows]) as [max_rows] ,max(qs.[total_dop]) as [total_dop] ,min(qs.[last_dop]) as [min_last_dop] ,max(qs.[last_dop]) as [max_last_dop] ,min(qs.[min_dop]) as [min_dop] ,max(qs.[max_dop]) as [max_dop] ,max(qs.[total_grant_kb]) as [total_grant_kb] ,min(qs.[last_grant_kb]) as [min_last_grant_kb] ,max(qs.[last_grant_kb]) as [max_last_grant_kb] ,min(qs.[min_grant_kb]) as [min_grant_kb] ,max(qs.[max_grant_kb]) as [max_grant_kb] ,max(qs.[total_used_grant_kb]) as [total_used_grant_kb] ,min(qs.[last_used_grant_kb]) as [min_last_used_grant_kb] ,max(qs.[last_used_grant_kb]) as [max_last_used_grant_kb] ,min(qs.[min_used_grant_kb]) as [min_used_grant_kb] ,max(qs.[max_used_grant_kb]) as [max_used_grant_kb] ,max(qs.[total_ideal_grant_kb]) as [total_ideal_grant_kb] ,min(qs.[last_ideal_grant_kb]) as [min_last_ideal_grant_kb] ,max(qs.[last_ideal_grant_kb]) as [max_last_ideal_grant_kb] ,min(qs.[min_ideal_grant_kb]) as [min_ideal_grant_kb] ,max(qs.[max_ideal_grant_kb]) as [max_ideal_grant_kb] ,max(qs.[total_reserved_threads]) as [total_reserved_threads] ,min(qs.[last_reserved_threads]) as [min_last_reserved_threads] ,max(qs.[last_reserved_threads]) as [max_last_reserved_threads] ,min(qs.[min_reserved_threads]) as [min_reserved_threads] ,max(qs.[max_reserved_threads]) as [max_reserved_threads] ,max(qs.[total_used_threads]) as [total_used_threads] ,min(qs.[last_used_threads]) as [min_last_used_threads] ,max(qs.[last_used_threads]) as [max_last_used_threads] ,min(qs.[min_used_threads]) as [min_used_threads] ,max(qs.[max_used_threads]) as [max_used_threads] from tbl_res_rec_g as t inner join sys.dm_exec_query_stats as qs with(readuncommitted) on t.[plan_handle]=qs.[plan_handle] and t.[sql_handle]=qs.[sql_handle] and t.[start_time]=cast(qs.[last_execution_time] as date) group by qs.[plan_handle] ,qs.[sql_handle] --,qs.[last_execution_time] ) select t.[session_id] -- ,t.[blocking_session_id] --, [session_id] ,t.[request_id] -- . ,t.[start_time] -- ,DateDiff(second, t.[start_time], GetDate()) as [date_diffSec] -- ,t.[status] -- ,t.[status_session] -- ,t.[command] -- , COALESCE( CAST(NULLIF(t.[total_elapsed_time] / 1000, 0) as BIGINT) ,CASE WHEN (t.[status_session] <> 'running' and isnull(t.[status], '') <> 'running') THEN DATEDIFF(ss,0,getdate() - nullif(t.[last_request_end_time], '1900-01-01T00:00:00.000')) END ) as [total_time, sec] -- , CAST(NULLIF((CAST(t.[total_elapsed_time] as BIGINT) - CAST(t.[wait_time] AS BIGINT)) / 1000, 0 ) as bigint) as [work_time, sec] -- , CASE WHEN (t.[status_session] <> 'running' AND ISNULL(t.[status],'') <> 'running') THEN DATEDIFF(ss,0,getdate() - nullif(t.[last_request_end_time], '1900-01-01T00:00:00.000')) END as [sleep_time, sec] -- , NULLIF( CAST((t.[logical_reads] + t.[writes]) * 8 / 1024 as numeric(38,2)), 0) as [IO, MB] -- , CASE t.transaction_isolation_level WHEN 0 THEN 'Unspecified' WHEN 1 THEN 'ReadUncommited' WHEN 2 THEN 'ReadCommited' WHEN 3 THEN 'Repetable' WHEN 4 THEN 'Serializable' WHEN 5 THEN 'Snapshot' END as [transaction_isolation_level_desc] -- () ,t.[percent_complete] -- ,t.[DBName] -- ,t.[object] -- , SUBSTRING( t.[TSQL] , t.[statement_start_offset]/2+1 , ( CASE WHEN ((t.[statement_start_offset]<0) OR (t.[statement_end_offset]<0)) THEN DATALENGTH (t.[TSQL]) ELSE t.[statement_end_offset] END - t.[statement_start_offset] )/2 +1 ) as [CURRENT_REQUEST] -- ,t.[TSQL] -- ,t.[QueryPlan] -- ,t.[wait_type] -- , (sys.dm_os_wait_stats) ,t.[login_time] -- ,t.[host_name] -- , . NULL ,t.[program_name] -- , . NULL ,cast(t.[wait_time]/1000 as decimal(18,3)) as [wait_timeSec] -- , ( ) ,t.[wait_time] -- , ( ) ,t.[last_wait_type] -- , ,t.[wait_resource] -- , , ,t.[open_transaction_count] -- , ,t.[open_resultset_count] -- , ,t.[transaction_id] -- , ,t.[context_info] -- CONTEXT_INFO ,cast(t.[estimated_completion_time]/1000 as decimal(18,3)) as [estimated_completion_timeSec] -- . NULL ,t.[estimated_completion_time] -- . NULL ,cast(t.[cpu_time]/1000 as decimal(18,3)) as [cpu_timeSec] -- ( ), ,t.[cpu_time] -- ( ), ,cast(t.[total_elapsed_time]/1000 as decimal(18,3)) as [total_elapsed_timeSec] -- , ( ) ,t.[total_elapsed_time] -- , ( ) ,t.[scheduler_id] -- , ,t.[task_address] -- , , ,t.[reads] -- , ,t.[writes] -- , ,t.[logical_reads] -- , ,t.[text_size] -- TEXTSIZE ,t.[language] -- ,t.[date_format] -- DATEFORMAT ,t.[date_first] -- DATEFIRST ,t.[quoted_identifier] --1 = QUOTED_IDENTIFIER (ON). â 0 ,t.[arithabort] --1 = ARITHABORT (ON). â 0 ,t.[ansi_null_dflt_on] --1 = ANSI_NULL_DFLT_ON (ON). â 0 ,t.[ansi_defaults] --1 = ANSI_DEFAULTS (ON). â 0 ,t.[ansi_warnings] --1 = ANSI_WARNINGS (ON). â 0 ,t.[ansi_padding] --1 = ANSI_PADDING (ON) ,t.[ansi_nulls] --1 = ANSI_NULLS (ON). â 0 ,t.[concat_null_yields_null] --1 = CONCAT_NULL_YIELDS_NULL (ON). â 0 ,t.[transaction_isolation_level] -- , ,cast(t.[lock_timeout]/1000 as decimal(18,3)) as [lock_timeoutSec] -- ( ) ,t.[lock_timeout] -- ( ) ,t.[deadlock_priority] -- DEADLOCK_PRIORITY ,t.[row_count] -- , ,t.[prev_error] -- , ,t.[nest_level] -- , ,t.[granted_query_memory] -- , (1 - 8 ) ,t.[executing_managed_code] --, CLR (, , ). -- , CLR , Transact-SQL ,t.[group_id] -- , ,t.[query_hash] -- - . -- , ,t.[query_plan_hash] -- - . -- ,t.[most_recent_session_id] -- , ,t.[connect_time] -- ,t.[net_transport] -- , ,t.[protocol_type] -- ,t.[protocol_version] -- , ,t.[endpoint_id] --, . endpoint_id sys.endpoints ,t.[encrypt_option] -- , , ,t.[auth_scheme] -- (SQL Server Windows), ,t.[node_affinity] -- , ,t.[num_reads] -- , ,t.[num_writes] -- , ,t.[last_read] -- ,t.[last_write] -- ,t.[net_packet_size] -- , ,t.[client_net_address] -- ,t.[client_tcp_port] -- , ,t.[local_net_address] --IP- , . , TCP ,t.[local_tcp_port] --TCP- , TCP ,t.[parent_connection_id] -- , MARS ,t.[most_recent_sql_handle] -- SQL, . most_recent_sql_handle most_recent_session_id ,t.[host_process_id] -- , . NULL ,t.[client_version] -- TDS- , . NULL ,t.[client_interface_name] -- , . NULL ,t.[security_id] -- Microsoft Windows, ,t.[login_name] --SQL Server , . -- , , . original_login_name. -- SQL Server , Windows ,t.[nt_domain] -- Windows , Windows . -- , , NULL ,t.[nt_user_name] -- Windows , Windows . -- , , NULL ,t.[memory_usage] -- 8- , ,t.[total_scheduled_time] -- , ( ) , ,t.[last_request_start_time] --, . , ,t.[last_request_end_time] -- ,t.[is_user_process] --0, . 1 ,t.[original_security_id] --Microsoft Windows, original_login_name ,t.[original_login_name] --SQL Server , . -- SQL Server, , Windows, -- , . -- , . -- EXECUTE AS ,t.[last_successful_logon] -- original_login_name ,t.[last_unsuccessful_logon] -- original_login_name ,t.[unsuccessful_logons] -- original_login_name last_successful_logon login_time ,t.[authenticating_database_id] -- , . -- 0. -- ,t.[sql_handle] --- SQL- ,t.[statement_start_offset] -- , . -- sql_handle, statement_end_offset sys.dm_exec_sql_text -- ,t.[statement_end_offset] -- , . -- sql_handle, statement_end_offset sys.dm_exec_sql_text -- ,t.[plan_handle] --- SQL ,t.[database_id] -- , ,t.[user_id] -- , ,t.[connection_id] -- , ,t.[is_blocking_other_session] --1- , 0- ,coalesce(t.[dop], mg.[dop]) as [dop] -- ,mg.[request_time] -- ,mg.[grant_time] -- , . NULL, ,mg.[requested_memory_kb] -- ,mg.[granted_memory_kb] -- . -- NULL, . -- requested_memory_kb. -- , -- ,mg.[required_memory_kb] -- (), . -- requested_memory_kb ,mg.[used_memory_kb] -- ( ) ,mg.[max_used_memory_kb] -- ,mg.[query_cost] -- ,mg.[timeout_sec] -- ,mg.[resource_semaphore_id] -- , ,mg.[queue_id] -- , . -- NULL, ,mg.[wait_order] -- queue_id. -- , . -- NULL, ,mg.[is_next_candidate] -- (1 = , 0 = , NULL = ) ,mg.[wait_time_ms] -- . NULL, ,mg.[pool_id] -- , ,mg.[is_small] -- 1 , . -- 0 ,mg.[ideal_memory_kb] --, (), , . -- ,mg.[reserved_worker_count] -- , , , ,mg.[used_worker_count] -- , ,mg.[max_used_worker_count] --??? ,mg.[reserved_node_bitmap] --??? ,pl.[bucketid] -- , . -- 0 - . -- SQL Plans Object Plans - 10007 32- 40009 â 64-. -- Bound Trees - 1009 32- 4001 64-. -- - 127 32- 64- ,pl.[refcounts] -- , . -- refcounts 1, ,pl.[usecounts] -- . -- , . -- showplan ,pl.[size_in_bytes] -- , ,pl.[memory_object_address] -- . -- sys.dm_os_memory_objects, -- , -- sys.dm_os_memory_cache_entries ,pl.[cacheobjtype] -- . ,pl.[objtype] -- . ,pl.[parent_plan_handle] -- -- sys.dm_exec_query_stats , (, ) ,qs.[creation_time] -- ,qs.[execution_count] -- ,qs.[total_worker_time] -- , , ( ) ,qs.[min_last_worker_time] -- , , ( ) ,qs.[max_last_worker_time] -- , , ( ) ,qs.[min_worker_time] -- , - , ( ) ,qs.[max_worker_time] -- , - , ( ) ,qs.[total_physical_reads] -- . -- 0 ,qs.[min_last_physical_reads] -- . -- 0 ,qs.[max_last_physical_reads] -- . -- 0 ,qs.[min_physical_reads] -- . -- 0 ,qs.[max_physical_reads] -- . -- 0 ,qs.[total_logical_writes] -- . -- 0 ,qs.[min_last_logical_writes] -- , . -- «» (. . ), . -- 0 ,qs.[max_last_logical_writes] -- , . -- «» (. . ), . -- 0 ,qs.[min_logical_writes] -- . -- 0 ,qs.[max_logical_writes] -- . -- 0 ,qs.[total_logical_reads] -- . -- 0 ,qs.[min_last_logical_reads] -- . -- 0 ,qs.[max_last_logical_reads] -- . -- 0 ,qs.[min_logical_reads] -- . -- 0 ,qs.[max_logical_reads] -- . -- 0 ,qs.[total_clr_time] --, ( ), -- Microsoft .NET Framework (CLR) . -- CLR , , , ,qs.[min_last_clr_time] -- , ( ), -- .NET Framework CLR . -- CLR , , , ,qs.[max_last_clr_time] -- , ( ), -- .NET Framework CLR . -- CLR , , , ,qs.[min_clr_time] -- , - .NET Framework CLR, -- ( ). -- CLR , , , ,qs.[max_clr_time] -- , - CLR .NET Framework, -- ( ). -- CLR , , , --,qs.[total_elapsed_time] -- , , ( ) ,qs.[min_last_elapsed_time] -- , , ( ) ,qs.[max_last_elapsed_time] -- , , ( ) ,qs.[min_elapsed_time] -- , - , ( ) ,qs.[max_elapsed_time] -- , - , ( ) ,qs.[total_rows] -- , . null. -- 0, ,qs.[min_last_rows] -- , . null. -- 0, ,qs.[max_last_rows] -- , . null. -- 0, ,qs.[min_rows] -- , - -- 0, ,qs.[max_rows] -- , - -- 0, ,qs.[total_dop] -- . -- 0 , ,qs.[min_last_dop] -- , . -- 0 , ,qs.[max_last_dop] -- , . -- 0 , ,qs.[min_dop] -- - . -- 0 , ,qs.[max_dop] -- - . -- 0 , ,qs.[total_grant_kb] -- , . -- 0 , ,qs.[min_last_grant_kb] -- , . -- 0 , ,qs.[max_last_grant_kb] -- , . -- 0 , ,qs.[min_grant_kb] -- . -- 0 , ,qs.[max_grant_kb] -- . -- 0 , ,qs.[total_used_grant_kb] -- , . -- 0 , ,qs.[min_last_used_grant_kb] -- , . -- 0 , ,qs.[max_last_used_grant_kb] -- , . -- 0 , ,qs.[min_used_grant_kb] -- . -- 0 , ,qs.[max_used_grant_kb] -- . -- 0 , ,qs.[total_ideal_grant_kb] -- , . -- 0 , ,qs.[min_last_ideal_grant_kb] -- , , . -- 0 , ,qs.[max_last_ideal_grant_kb] -- , , . -- 0 , ,qs.[min_ideal_grant_kb] -- - . -- 0 , ,qs.[max_ideal_grant_kb] -- - . -- 0 , ,qs.[total_reserved_threads] -- - . -- 0 , ,qs.[min_last_reserved_threads] -- , . -- 0 , ,qs.[max_last_reserved_threads] -- , . -- 0 , ,qs.[min_reserved_threads] -- , - . -- 0 , ,qs.[max_reserved_threads] -- . -- 0 , ,qs.[total_used_threads] -- - . -- 0 , ,qs.[min_last_used_threads] -- , . -- 0 , ,qs.[max_last_used_threads] -- , . -- 0 , ,qs.[min_used_threads] -- , . -- 0 , ,qs.[max_used_threads] -- , . -- 0 , from tbl_res_rec as t left outer join sys.dm_exec_query_memory_grants as mg on t.[plan_handle]=mg.[plan_handle] and t.[sql_handle]=mg.[sql_handle] left outer join sys.dm_exec_cached_plans as pl on t.[plan_handle]=pl.[plan_handle] left outer join tbl_rec_stat_g as qs on t.[plan_handle]=qs.[plan_handle] and t.[sql_handle]=qs.[sql_handle] --and qs.[last_execution_time]=cast(t.[start_time] as date);
ãŸããåéãããçµ±èšã«ãããšãæãé£ããã¯ãšãªãååŸã§ããããšãæãåºãããŠãã ããã
ã³ãŒã
/* creation_time - , . , . , , ( ), , . last_execution_time - . execution_count - - , - . , - , . CPU - . , , . , - . , , . AvgCPUTime - . TotDuration - , . , , " ". CPU ( ) - , - . , . sys.dm_os_wait_stats. AvgDur - . Reads - . , . - , . , . , , , , . Writes - . , "" . , 0 , , , tempdb. AggIO - - () , , . AvgIO - . : - 8192 . , "" . , ( ), , . , , 5, 300, , 10. - . , . , , , , . , - . ... , , . - . , , . . query_text - database_name - , , . NULL object_name - ( ), . */ with s as ( select creation_time, last_execution_time, execution_count, total_worker_time/1000 as CPU, convert(money, (total_worker_time))/(execution_count*1000)as [AvgCPUTime], qs.total_elapsed_time/1000 as TotDuration, convert(money, (qs.total_elapsed_time))/(execution_count*1000)as [AvgDur], total_logical_reads as [Reads], total_logical_writes as [Writes], total_logical_reads+total_logical_writes as [AggIO], convert(money, (total_logical_reads+total_logical_writes)/(execution_count + 0.0))as [AvgIO], [sql_handle], plan_handle, statement_start_offset, statement_end_offset from sys.dm_exec_query_stats as qs with(readuncommitted) where convert(money, (qs.total_elapsed_time))/(execution_count*1000)>=100 -- 100 ) select s.creation_time, s.last_execution_time, s.execution_count, s.CPU, s.[AvgCPUTime], s.TotDuration, s.[AvgDur], s.[Reads], s.[Writes], s.[AggIO], s.[AvgIO], --st.text as query_text, case when sql_handle IS NULL then ' ' else(substring(st.text,(s.statement_start_offset+2)/2,( case when s.statement_end_offset =-1 then len(convert(nvarchar(MAX),st.text))*2 else s.statement_end_offset end - s.statement_start_offset)/2 )) end as query_text, db_name(st.dbid) as database_name, object_schema_name(st.objectid, st.dbid)+'.'+object_name(st.objectid, st.dbid) as [object_name], sp.[query_plan], s.[sql_handle], s.plan_handle from s cross apply sys.dm_exec_sql_text(s.[sql_handle]) as st cross apply sys.dm_exec_query_plan(s.[plan_handle]) as sp
MySQLçšã«äœæããããšãã§ããŸãããããè¡ãã«ã¯ãmysql-connector-netãã€ã³ã¹ããŒã«ããŠã次ã®ããã«èšè¿°ããŸãã
ä¿çäžã®ãªã¯ãšã¹ãã®ã³ãŒã
# MySQL [string]$sMySQLUserName = 'UserName' [string]$sMySQLPW = 'UserPassword' [string]$sMySQLDB = 'db' [string]$sMySQLHost = 'IP-address' [void][System.Reflection.Assembly]::LoadWithPartialName("MySql.Data"); [string]$sConnectionString = "server="+$sMySQLHost+";port=3306;uid=" + $sMySQLUserName + ";pwd="+"'" + $sMySQLPW +"'"+ ";database="+$sMySQLDB; #Open a Database connection $oConnection = New-Object MySql.Data.MySqlClient.MySqlConnection($sConnectionString) $Error.Clear() try { $oConnection.Open() } catch { write-warning ("Could not open a connection to Database $sMySQLDB on Host $sMySQLHost. Error: "+$Error[0].ToString()) } #The first query # Get an instance of all objects need for a SELECT query. The Command object $oMYSQLCommand = New-Object MySql.Data.MySqlClient.MySqlCommand; # DataAdapter Object $oMYSQLDataAdapter = New-Object MySql.Data.MySqlClient.MySqlDataAdapter; # And the DataSet Object $oMYSQLDataSet = New-Object System.Data.DataSet; # Assign the established MySQL connection $oMYSQLCommand.Connection=$oConnection; # Define a SELECT query $oMYSQLCommand.CommandText='query'; $oMYSQLDataAdapter.SelectCommand=$oMYSQLCommand; # Execute the query $count=$oMYSQLDataAdapter.Fill($oMYSQLDataSet, "data"); $result = $oMYSQLDataSet.Tables[0].Rows[0]["Count"]; write-host $result;
çµæ
ãã®èšäºã§ã¯ãZabbixã®ããã©ãŒãã³ã¹ã«ãŠã³ã¿ãŒïŒããŒã¿èŠçŽ ïŒã®äŸãèŠãŠããŸããããã®ã¢ãããŒãã«ãããããŸããŸãªåé¡ããªã¢ã«ã¿ã€ã ã§ããŸãã¯ç¹å®ã®æéåŸã«ç®¡çè ã«éç¥ã§ããŸãããããã£ãŠããã®ã¢ãããŒãã«ãããé倧ãªåé¡ã®çºçãæå°éã«æããDBMSãšãµãŒããŒã®åäœãåæ¢ããããšãã§ããŸããããã«ãããçç£ããã»ã¹ãäœæ¥ããã»ã¹ãåæ¢ããã®ãé²ããŸãã
åã®èšäºïŒMS SQL Serverã®24æé365æ¥ã®æ å ±ã·ã¹ãã ããŒã¿ããŒã¹ã䜿çšããã¡ã³ããã³ã¹äœæ¥
ãœãŒã¹ïŒ
ãZabbixã®3.4ã®
ãããã©ãŒãã³ã¹ã«ãŠã³ã¿ã¯ã
ãããŒã¿ããŒã¹SQL Azureã®ããŒã¿ã»ã³ã¿ãŒã®ããã©ãŒãã³ã¹ãšããŒã¿ããŒã¹ãšã³ãžã³ãµãŒããŒSQL
» ã©ã€ãã¹ã¿ã€ã«SQL
ãSQLSkills
ãTechNetã®ãã€ã¯ããœãã
ãã¡ã¢ãªäœ¿çšéãåæã
ããããã©ãŒãã³ã¹åæ
ãSQLã®ããã¥ã¢ã«
ãWindowsäžã§ã®æ³šæäºé