Kiln » KilnSupportScripts Powershell Scripts to help monitor a Kiln environment. Contact Fog Creek support before using.
Clone URL:  
run-checkBackend.example.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
. C:\code\checkKiln\checkBackend.ps1 $sRepoGUID = 'B530EC64-82BE-473A-82E1-569464B1074A' $sChangeset1 = 'f181ad06356697b8676868fec36fbe13167081dd' $sChangeset2 = 'ed5f14291c3ab9d9bf24dee8e1b4761799509d15' $logFile = "C:\code\checkKiln\checkBackend.log" $kilnRepositories = "C:\KilnRepositories" $maxMiniRedisSize = 3000000 #3MB $smtpServer = "testmail.example.com" $from = "ben@example.com" $to = "ben@example.com" Get-ProcessStats "backend" $logFile Get-ProcessStats "memcached" $logFile Get-ProcessStats "QueueService" $logFile Get-ProcessStats "redis-server" $logFile $passed = Check-KilnBackend $sRepoGUID $sChangeset1 $sChangeset2 $logFile if (-not $passed) { Send-MailMessage -From $from -To $to -SmtpServer $SmtpServer -Subject "The Kiln Backend Had To Be Restarted" #-Attachment $logFile } $lenMiniRedis = Get-MiniRedisSize $kilnRepositories $logFile $intLenMiniRedis = 0 if ([System.Int64]::TryParse($lenMiniRedis, [ref]$intLenMiniRedis)) { if ($intLenMiniRedis -gt $maxMiniRedisSize) { $strLenMiniRedisKb = "{0:N0}" -f ($intLenMiniRedis / 1024) Send-MailMessage -From $from -To $to -SmtpServer $SmtpServer -Subject "The Kiln MiniRedis.db is too large" -Body "MiniRedis.db is $strLenMiniRedisKB KB" } }