Giter Site home page Giter Site logo

imajaydwivedi / sqlmonitor Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 14.0 11.05 MB

SQLMonitor is designed as opensource tool to replace expensive enterprise monitoring or to simply fill the gap and monitor all environments such as DEV, TEST, QA/UAT & PROD.

License: MIT License

TSQL 23.32% PLpgSQL 58.19% PowerShell 16.74% C# 0.36% Python 1.39% Batchfile 0.01%

sqlmonitor's Introduction

About Me Contact Me ajaydwivedi.com LinkedIn YouTube StackOverflow

About Me

G. Resume

https://ajaydwivedi.com

LinkedIn Profile

YouTube ajaydwivedi

StackOverflow

sqlmonitor's People

Contributors

imajaydwivedi avatar

Stargazers

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

Watchers

 avatar

sqlmonitor's Issues

Dashboard - Deadlock Analysis

Dashboard - Deadlock Analysis

Below query can be used for this infra -

declare @_endDate datetime;
set @_startDate = dateadd(hour,-24,getdate());
set @_endDate = GETDATE()

exec sp_BlitzLock @StartDate = @_startDate, @EndDate = @_endDate
				,@OutputDatabaseName = 'tempdb'
go

select *
from tempdb..BlitzLock

We are getting error on two step 3__XEventSession and 9__CopyDbaToolsModule2Host

**2024Feb16_1240 INFO: ***Working on step '3__XEventSession'..
2024Feb16_1240 INFO: $XEventSessionFilePath = 'D:\GitHub\SQLMonitor\DDLs\SCH-Create-XEvents.sql'
2024Feb16_1240 INFO: Computed XEvent files directory -> 'D:\MSSQL15.MSSQLSERVER\XEvents'..
2024Feb16_1240 INFO: Create XEvent session named [xevent_metrics]..

The target, "5B2DA06D-898A-43C8-9309-39BBBE93EBBD.package0.event_file", encountered a configuration error during initialization.
Object cannot be added to the event session. The operating system returned error 5: 'Access is denied.
' while creating the file 'C:\Program Files\Microsoft SQL
Server\MSSQL15.SQL2019\MSSQL\xevents\xevent_metrics_0_133525896392450000.xel'.
At line:97864 char:9

  •     throw $records[0]
    
  •     ~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (SQLMASTER\SQL2019:String) [], Exception
    • FullyQualifiedErrorId : dbatools_Invoke-DbaQuery

2024Feb16_1243 INFO: *****Working on step '9__CopyDbaToolsModule2Host'..
2024Feb16_1243 INFO: $DbaToolsFolderPath = 'D:\Github\dbatools'
2024Feb16_1243 INFO: $dbaToolsLibraryFolderPath = 'D:\Github\dbatools.library'
Import-LocalizedData : Cannot find the Windows PowerShell data file 'dbatools.psd1' in directory
'D:\GitHub\SQLMonitor\SQLMonitor\en-US', or in any parent culture directories.
At D:\GitHub\SQLMonitor\SQLMonitor\Install-SQLMonitor.ps1:1937 char:5

  • Import-LocalizedData -BaseDirectory $dbatoolsConfigFileDirectory  ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (D:\GitHub\SQLMo...S\dbatools.psd1:String) [Import-LocalizedData], PSInvalidOperationE
      xception
    • FullyQualifiedErrorId : ImportLocalizedData,Microsoft.PowerShell.Commands.ImportLocalizedData

SQL CPU Not Showing in SQLCluster Case

Describe the bug
SQLCluster CPU is not showing on dashboard when the SQLCluster is NOT present on preferred node.

To Reproduce
Assume 2 active-active SQLClusters, say SqlClus01 & SqlClus02 configured on 2 hosts SqlHost01 & SqlHost02. If both the SqlClus01 & SqlClus02 are both moved to SqlHost01, then SqlHost02 does not show SQL CPU on dashboards.

Track Status of SQLAgent Service

After reboot of OS/Box, sometimes, SQLAgent service does not start automatically.

Add feature to track SQLAgent services & display on All Server Dashboard.

Basic Slack Alerts for Core Metrics

Create following alerts using Python & Slack -

  • CPU
  • Blocking
  • Memory Grants Pending
  • Waits Per Core Per Minute
  • Disk Latency
  • TempDb Space Utilization
  • Log Space Utilization
  • AlwaysOn Latency Health
  • Disk Space Utilization
  • Backup History
  • Offline SQLAgent Service
  • SQLInstance Unavailable
  • [ ]

We are getting the below error how to fixed this

2024Feb16_1042 ERROR: Seems either [DBA] does not exists, or the data/log files are present in C:\ drive.
Kindly rectify this issue.
F:\GitHub\SQLMonitor\SQLMonitor\Install-SQLMonitor.ps1 : Stop here. Fix above issue.
At F:\Github\SQLMonitor\Private\Wrapper-InstallSQLMonitor.ps1:75 char:1

  • F:\GitHub\SQLMonitor\SQLMonitor\Install-SQLMonitor.ps1 @params

Setup Alert Engine Using Python+Postgres

Design Email & Slack Alerts for following -

  • Instance Unavailability
  • Database Unvailability
  • CPU (High/Critical)
  • Blocking
  • Memory Grant Pending
  • Low SQL Server Ram
  • Jobs Alert
  • ErrorLog based Alerts
  • Login Failures
  • Backups not happening
  • TempDbSaver based alert
  • LogSaver based alert
  • Incorrect tempdb config
  • Alert for long running transaction

Setup Alert Engine Using Python+SQLServer

Design Email & Slack Alerts for following -

  • Instance Unavailability
  • Database Unvailability
  • CPU (High/Critical)
  • Blocking
  • Memory Grant Pending
  • Low SQL Server Ram
  • Jobs Alert
  • ErrorLog based Alerts
  • Login Failures
  • Backups not happening
  • TempDbSaver based alert
  • LogSaver based alert
  • Incorrect tempdb config
  • Alert for long running transaction

Self-Sign PowerShell Scripts

In highly secured environment, only remote-signed powershell scripts are allowed.

Self-signing SQLMonitor powershell scripts will help in smooth deployments.

Add Parameters to Skip Particular Wait Type in `usp_waits_per_core_per_minute`

Is your feature request related to a problem? Please describe.
On some of my servers, there are some WaitTypes that always occurring, and overshadowing other relevant wait types.

Describe the solution you'd like
Below 2 options -

  1. A parameter to ignore comma separate list of wait types
  2. A table that keeps a list of wait types that can be ignored for easy handling. This table should be present on each server.

Add Collection Time on All Server Dashboard

Is your feature request related to a problem? Please describe.
It's very important to know when the data collection happened while analyzing the data.

So need to add collection_time on All Server Dashboard panels.

Change Retention of `dbo.all_server_volatile_info_history` to 15 Days

There are scenarios where we need to check historical metrics to figure out max/min/average/pencentile etc for a metrics within x days.

For example, get max memory utilization for last 7 days.

Need to change Retention of dbo.all_server_volatile_info_history to 15 Days in table dbo.purge_table.

Infra to Support Password Rotation for `grafana` Login

Due to restrict oranizational security policies, login password should change very 90 days.

Due to this, password for grafana login should be rotated every 90 days.

Need to build the infra to support password rotation for grafana login

Migrate `grafana` Login from Inventory on All Servers

Is your feature request related to a problem? Please describe.
Deployment of SQLMonitor on AG replicas causes grafana login with different SIDs.
Thus monitoring stops working post failover.

Describe the solution you'd like
Create grafana login by scripting out from Inventory Server. This would ensure consistency of login SID.

Exception Tables for All Panels on All Server Dashboard

Is your feature request related to a problem? Please describe.

There are times when we can not do anything to one issue appearing on dashboard.
For example, if a database has been set to offline or readonly, then backups won't happen.
So having an exception table would help to skip these records showing on dashboard.

Control Immediate Removal of Perfmon File in Job `(dba) CollectPerfmonData`

Is your feature request related to a problem? Please describe.
I was to analyze the generated perfmon blg files on my server. So don't want to remove them immediately.

Describe the solution you'd like
A parameter in script SQLMonitor\perfmon-collector-push-to-sqlserver.ps1 to decide if immediately remove a file or not.

Dashboard Exposing Latest Backup History

Is your feature request related to a problem? Please describe.
Sometimes backups are not happening, and we find out very late.

Having a dashboard will help in timely detection of miss backup issues.

  • Added exception for Offline/ReadOnly/Standby databases
  • Ignore database snapshots
  • Added exception table on Inventory server for handling Restore State or any other maintenance activity
  • Implement logic based on Job Category for backup jobs on AG backups. Goal is to figure out which replica is source of backup jobs

Add additional verification step for Instance-Availability

Is your feature request related to a problem? Please describe.
Sometimes job (dba) Check-InstanceAvailability may fail due to various reasons like file reuse, temporary glitch, etc
Due to this, the job sets a server OFFLINE

Describe the solution you'd like
Add additional verification using tsql method to reset the OFFLINE flag for offline servers.

`Remove-SQLMonitor` - Save InstanceDetails are until the Instance is Removed Full

If Remove-SQLMonitor fails after step 49__DropTable_InstanceDetails, then with current code, its not possible to finish the unistallation as the details of instance are lost.

In order to get around this issue, kindly save the instance_details somewhere at start of installation, and remove same after successfull uninstallation.

Capture `sp_Blitz` Result & Create Dashboard

Is your feature request related to a problem? Please describe.
sp_Blitz exposes lots of issues that could be helpful to DBA & Developers.

Describe the solution you'd like
Capture sp_Blitz result at least once a week, and create dashboards exposing various kind of informations from same.

Job `(dba) Collect-DiskSpace` failing

Describe the bug
Job (dba) Collect-DiskSpace failing with below error message after upgrade of dbatools to latest release.

2023Nov22_1832 INFO:      Fetch disk space on $HostName = [21L-LTPABL-1187]..
2023Nov22_1832 INFO:      Push disk info to SqlServer [21L-LTPABL-1187].[DBA].[dbo].[disk_space]..
The certificate chain was issued by an authority that is not trusted
At line:97904 char:9
+         throw $records[0]
+         ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ConnectionError: (21L-LTPABL-1187:String) [], Exception
    + FullyQualifiedErrorId : dbatools_Write-DbaDbTableData

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.