-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 320 fix? #623
base: development
Are you sure you want to change the base?
Issue 320 fix? #623
Conversation
Hopefully this helps with issue 320
Cleaned up the code
|
||
begin { | ||
<# | ||
Step one. Get de free diskspace from the disks where Sql Server is parking it's files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get the free
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the comments in the code :-) Thank you :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this as a starter for ten.
Once this function is settled it can probably be submitted to dbatools but for now it can then be called for the Assertion which can then be used in the Pester Check
Question - How will it handle multiple instances ?
|
||
begin { | ||
<# | ||
Step one. Get de free diskspace from the disks where Sql Server is parking it's files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the comments in the code :-) Thank you :-)
#> | ||
|
||
$DiskFreeSpace = Get-DbaDbFile -SqlInstance $SqlInstance | Select-Object @{label='DriveLetter';Expression={$_.PhysicalName.substring(0,3)}}, VolumeFreeSpace |Sort-Object -Property Driveletter -Unique | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please can this have a try catch
#> | ||
|
||
$FileGrowth = Get-DbaDbFile -SqlInstance $SqlInstance | Select-Object @{label='DriveLetter';Expression={$_.PhysicalName.substring(0,3)}}, NextGrowthEventSize | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please can this have a try catch
If the drives are the same, the comparison will take place and the result will be shown. | ||
#> | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super, can we create a pscustomobject here so that we have something like
ComputerName | SQLInstance | DriveLetter | FreeSpace | Growth | GrowthAchievable
Beard BeardInstance | Q | 100000 | 500000 | true
Made some progress with the helpfull comments of Sean and Rob. The last change is somewhat iffy. I've created the custom object but do you want it to write to the host or do you want to write it to a file?
Fixed a little bug with a wrong column name in the output. Excluded the finally from the try catch. It got there every time for no apparent reason.
Goodmorning @SQLDBAWithABeard and @shaneis, I'm blocking time this week to get this baby cleaned and babypowdered ;). |
Reitse! |
Hi Shane,
I did :). And that's one part of the question. Is my little check database,
instance or server related? I'd say server but the big beardy boss has the
final say :).
If the server assertion is the way to go, i'd have to add an assertion in
the Get-AllServerInfo function and pass the result (if needed) to the new
function Assert-DiskGrowth or whatever the name might be.
Am i thinking in the right direction?
…On Wed, 7 Aug 2019 at 16:10, shaneis ***@***.***> wrote:
Reitse!
Have you checked dbachecks/internal/assertions/ for examples?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#623>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIAYUDJ6DGKDYE2AMHAPX33QDLJW7ANCNFSM4HV3RKCA>
.
|
You are absolutely correct with your logic for the processing of the check @reitse :-) Now, where should the check life? That is indeed a fantastic question and one which I can logicallly answer with Server or Instance or Database!! I am going to say Instance and have it fail at an instance level as possibly if there is not enough space for one database to grow then you dont want 100 errors for the next databases |
Assert-DBGrowthEvent added to the InstanceAssertions. Removed the commandline output in the GetDatabaseDiskFreeSpace that has been replaced with the custom function.
I've added the assertion and hope It's somewhere along the line of where it should be. Eagerly awaiting your constructive comments! :) |
A New PR
THANK YOU - We love to get PR's and really appreciate your time and help to improve this module
Accepting a PR
Before we accept the PR - please confirm that you have run the tests locally to avoid our automated build and release process failing. You can see how to do that in our wiki
https://github.com/sqlcollaborative/dbachecks/wiki
Please confirm you have 0 failing Pester Tests
[x] There are 0 failing Pester tests (there were 0 Pester tests so that was easy ;))
Changes this PR brings
Please add below the changes that this PR covers. It doesnt need an essay just the bullet points :-)
This function checks the available disk space and compares it with expected file growth. If the growth is larger than the available space, time to act!