Code Monkey home page Code Monkey logo

dbachecks's People

Contributors

ant-green avatar ashdar avatar claudioessilva avatar conseilit avatar dba-leshop avatar fatherjack avatar friedrichweinmann avatar garethnewman avatar gbargsley avatar github-actions[bot] avatar jaapbrasser avatar jpomfret avatar kenkcsl avatar lowlydba avatar markaugust avatar michalporeba avatar mikedavem avatar mikepetrak avatar mikeybronowski avatar potatoqualitee avatar pspsam avatar rabryst avatar sanderstad avatar shaneis avatar sqldbawithabeard avatar staggerlee011 avatar stuart-moore avatar tboggiano avatar wsmelton avatar zikato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dbachecks's Issues

Question on naming tests

Is the current result set

image

better than this ?

image

I have added the context for each Server so each one is seperate and altered the ordering of the test title

HADR check should include validating if the AlwaysOn XE session is enabled/started

When scripting out the creation of an AG on SQL Server 2012+ (that I've tried it does this on any version) it does not (1) enable the AlwaysOn_health XE session nor (2) set that session to start on start-up.

This will happen whether you use SMO (what dbatools will have soon) or if you use SQLSERVER provider via the sqlserver module.

Start-DbcPowerBi has bad check?

mmm that exists, so the check is probably outdated.

Tests Passed: 1312, Failed: 0, Skipped: 1, Pending: 0, Inconclusive: 0


    Directory: C:\Windows\temp


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       12/27/2017   4:11 PM                dbachecks
[16:11:32][Update-DbcPowerBiDataSource] Wrote results to C:\Windows\temp\dbachecks\dbachecks_1_SuspectPage_FailedJob_LastGoodCheckdb_LastBackup_VirtualLogFile_MemoryDump_Default.json


PS C:\Users\> Start-DbcPowerBi
WARNING: [16:21:10][Start-DbcPowerBi] json file not found. Run Update-DbcPowerBiDataSource to auto generate

Question on Tags

When I use Pester I like to have different types of Tags

So for example
my drive size, services checks are also tagged Server
my SQL Admins, Adhoc, Tmpdb checks are also tagged Instance
my dbowner, identity, dbcc checks are also tagged database
my SQL Admins, dbowner, job owner tests are also tagged security

We should ensure we have some consistency in this right now before it gets real messy :-)

Discuss

Make auth a configurable value in connection check

 It "$_ AUth Scheme should be NTLM" {
                $connection.AuthScheme | Should Be "NTLM"
            }

Explore other options that perhaps should be configurable this way. I know we'll have a lot of configurable things but it'll be easy to mod using our Import and Export JSON thingies.

Too Many Executing Script in

We need a plan to avoid the number of files growing and giving us this

image

when just running one tag

My suggestion is to reduce the number of Tests.ps1 files and move the Describe blocks with the tags inside them

I suggest

Server.Tests.ps1
Instance.Tests.ps1
Database.Tests.ps1

as a starter for ten

Discus

Skips

What do yall think of the way I'm skipping (using the config?)

Skip checks if databases is part of Availability Group and not readable

We have many automated checks in place using dbatools and we use the registered servers. Could you please add intelligence to the checks that if the database is part of availability group and not readable then it automatically skips the steps.

Otherwise our monitoring shows a lot of errors like the below sample:
APPLICATION_NAME: "dbatools PowerShell module - dbatools.io"
ERROR NUMBER: 976.
ERROR MESSAGE: The target database, 'DB_NAME', is participating in an availability group and is currently not accessible for queries. Either data movement is suspended or the availability replica is not enabled for read access. To allow read-only access to this and other databases in the availability group, enable read access to one or more secondary availability replicas in the group. For more information, see the ALTER AVAILABILITY GROUP statement in SQL Server Books Online.

SQL_TEXT:
use [DB_NAME] SELECT (select value from sys.database_scoped_configurations as dsc where dsc.name = 'MAXDOP') AS [MaxDop], (select value_for_secondary from sys.database_scoped_configurations as dsc where dsc.name = 'MAXDOP') AS [MaxDopForSecondary], (select value from sys.database_scoped_configurations as dsc where dsc.name = 'LEGACY_CARDINALITY_ESTIMATION') AS [LegacyCardinalityEstimation], (select ISNULL(value_for_secondary, 2) from sys.database_scoped_configurations as dsc where dsc.name = 'LEGACY_CARDINALITY_ESTIMATION') AS [LegacyCardinalityEstimationForSecondary], (select value from sys.database_scoped_configurations as dsc where dsc.name = 'PARAMETER_SNIFFING') AS [ParameterSniffing], (select ISNULL(value_for_secondary, 2) from sys.database_scoped_configurations as dsc where dsc.name = 'PARAMETER_SNIFFING') AS [ParameterSniffingForSecondary], (select value from sys.database_scoped_configurations as dsc where dsc.name = 'QUERY_OPTIMIZER_HOTFIXES') AS [QueryOptimizerHotfixes], (select ISNULL(value_for_secondary, 2) from sys.database_scoped_configurations as dsc where dsc.name = 'QUERY_OPTIMIZER_HOTFIXES') AS [QueryOptimizerHotfixesForSecondary]

folder naming

Should it be tests-external? or the other way around? We will, at some point, add pester tests to test our commands so.. im up for a rename, not sure i like tests-external anyway.

Skip Log Check not working

I enabled the skip.backuplogcheck to true and attempted to run my invoke again and it still checks logs.

image

Setting Config Values

When setting config values if $false or $true is not used for a boolean option it causes it to be a string and has issues.

Notes from @SQLDBAWithABeard :
yes thats a tricky one - could you create an issue and we might try and see if we can code for that (if "false") {$false} etc

Update Help for Invoke-DbcCheck

Should have pertinent examples for this project and then referrals for ppl to look at Pester's help if they wanna know the deets

Also our description and everything is all Pester, should be more from our readme.md

Add Type to Get-DbcCheck

Each test uses Get-ComputerName or Get-SqlInstance - @JanMulkens said, and it's true, that this info from the readme is not adequate:

...however, you can set a permanent list of servers. "Servers" include both SQL Server instances and Windows servers. Checks that access Windows Server (e.g. disk space checks) will utilize -ComputerName parameter. A pure SQL Server command(s) (such as the backup check) utilizes the -SqlInstance parameter.

embedded $psitem

So what happens if you have an embedded foreach? You lose track of the original $_ or $psitem it seems. I propose that we do this - assign the first psitem to $servername

Describe "Duplicate Index" -Tag Index, $filename {
	(Get-SqlInstance).ForEach{
		$servername = $psitem
		Context "Testing $servername for duplicate indexes" {
            (Get-DbaDatabase -SqlInstance $servername).ForEach{
				It "$psitem should not have duplicate indexes" {
					Find-SqlDuplicateIndex -SqlInstance $servername -Database $psitem.Name | Should Be $null
				}
			}
		}
	}
}

Do multiple checks from same dbatools command? Or 1 file per property?

Scenario

I'm writing a test to test

  • PageVerify
  • AutoShrink
  • AutoClose

All of those can be checked from Get-DbaDatabase dbatools command.

Question

Should we have 1 .tests.ps1 file for each check?
Or everything in a single .tests.ps1 file where we do the validation for the skip like $autoclose = Get-DbcConfigValue skip.AutoClose ?

Conversion error Testing Backups

Context Testing backups on PRDPRSDBS11A,5510 [-] Error occurred in Context block 2.32s PSInvalidCastException: Cannot convert value "System.String" to type "System.Management.Automation.SwitchParameter". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0. ArgumentTransformationMetadataException: Cannot convert value "System.String" to type "System.Management.Automation.SwitchParameter". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0. ParameterBindingArgumentTransformationException: Cannot process argument transformation on parameter 'Skip'. Cannot convert value "System.String" to type "System.Management.Automation.SwitchParameter". Boolean parameters accept o nly Boolean values and numbers, such as $True, $False, 1 or 0. at <ScriptBlock>, C:\GitHub\dbachecks\checks\lastbackup.Tests.ps1: line 18 at DescribeImpl, C:\Program Files\WindowsPowerShell\Modules\Pester\4.1.1\Functions\Describe.ps1: line 161

Handling diff servers for diff things

In my environment, I treat all of my servers the same. but what if ppl have diff RPOs for diff farms?

How would we tell people to use this? Create a script where they repeatedly reset Set-DbcConfig -Name Setup.SqlInstance -Value sql2016, sql2017, sql2008, sql2008\express

Is that healthy/acceptable, @FriedrichWeinmann ?

Save-DbcPrequisites

mmmm, i guess this should be save.ps1 since we're requiring prereqs in the module manifest. save all required modules or do we just show ppl how to install PowerShell Gallery?

Add Type to Get-DbcCheck

Each test uses Get-ComputerName or Get-SqlInstance, this info from the readme is not adequate:

...however, you can set a permanent list of servers. "Servers" include both SQL Server instances and Windows servers. Checks that access Windows Server (e.g. disk space checks) will utilize -ComputerName parameter. A pure SQL Server command(s) (such as the backup check) utilizes the -SqlInstance parameter.

Preferable would be to see the type you can use behind or in front of the group in get-dbccheck

Network Latency Test Seems Innacurate

I am not sure how the test is connecting, but we do not have the latency output by the test.

`Executing script C:\GitHub\dbachecks\checks\latency.Tests.ps1

Describing Testing network latency
[-] network latency for PRDPRSDBS11A,5510 should be less than 40 ms 299ms
Expected: {True}
But was: {False}
7: $results.Average.TotalMilliseconds -lt $max | Should be $true
at Invoke-LegacyAssertion, C:\Program Files\WindowsPowerShell\Modules\Pester\4.1.1\Functions\Assertions\Should.ps1: line 190
at , C:\GitHub\dbachecks\checks\latency.Tests.ps1: line 7`

need better names for New-DbcPowerBiJson and Show-DbcPowerBi

Usage

# Run tests and export its json
New-DbcPowerBiJson

# Launch PowerBi then hit refresh
Show-DbcPowerBi

New-DbcPowerBiJson

Basically is:

$results = Invoke-DbcCheck -Show Summary -PassThru
$results.TestResult | ConvertTo-Json -Depth 5 | Out-File "$env:windir\temp\dbachecks.json"

Show-DbcPowerBi

Launches the included pbix file - all you gotta do is hit refresh ♻️

Error on import

When importing the psd1 I get this error

Import-Module .\dbachecks.psd1
Exception calling "InvokeScript" with "4" argument(s): "You cannot call a method on a null-valued expression."At C:\Users\mrrob\OneDrive\Documents\GitHub\dbachecks\dbachecks.psm1:17 char:9

  • else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scr ...
    
  •        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : RuntimeException

Importing external configs (not DbcConfigs)

should we make a command to make it easy to import config shit enmasse? I think the answer is no, we'd just be duplicating work that should be done within Set-DbcConfig

for instance

$skips = Import-CliXml skips.xml
foreach ($skip in $skips) { Set-DbcConfig ....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.