SQL Server Monitoring – Installation

The blog is part of the blog series named SQL Server Monitoring and here it will be shown how:

Download from GitHub

The tool can be downloaded from my GitHub repository.

Go to the Build directory.

Download the files FHSQLMonitor.pbit and FHSQLMonitor.sql.

Install and upgrade FHSQLmonitoring sql service

To install a new installation, or upgrade an already existing installation, the procedure are the same.

Start SQL Server Management Studio (here SSMS 22), connect to the instance and ensure that the Command timeout is set to 0.

Open the FHSQLMonitor.sql in SQL Server Management Studio

Set the parameters in the installation file

The first 3 parameters specifies how and where the tool will be installed or is already installed in case of an update.

ParameterDescription
@fhSQLMonitorDatabaseThe default name of the database to be used is “FHSQLMonitor”
@pbiSchemaThe default name of the schema used for the views that the Power BI Desktop loads data from
@olaDatabaseIn case that Ola Hallengren is installed in another database, specify the name of the database.

When upgrading and the parameter is at default NULL the current configuration will be used.

The next 4 parameters are only used during a fresh installation, and controls creation of the SQL Server agent job and the file location for the files holding the Blocks and Deadlocks data.
The parameters are not used during an update except if the service has not previously been installed.

ParameterDescription
@createSQLAgentJobsIf set to 1 the corresponding agent jobs are created if it not already exists.

If set to 0 already existing agent jobs will not be deleted.
@blocksAndDeadlocksFilePathPath to directory where the service BlocksAndDeadlocks saves the extended events files.

If not set the directory used are the SQL Server LOG directory.
@fhsqlAgentJobNameType0The name of the SQL Agent job for type 0 schedules.

The job name is constructed like this “FHSQLMonitor type 0 in {@fhSQLMonitorDatabase }”
@fhsqlAgentJobNameType1The name of the SQL Agent job for type 1 schedules.

The job name is constructed like this “FHSQLMonitor type 1 in {@fhSQLMonitorDatabase }”

The following 27 parameters are only used during a fresh installation.
The parameters are not used during an update except if the service has not previously been installed.
When updating, the already configured values in the tables dbo.fhsmSchedules and dbo.fhsmRetensions remains unchanged.

ParameterDefault
value
Reports affected
@enableAgentJobs1Agent jobs configuration
@enableAgentJobsPerformance1Agent jobs performance
@enableAgeOfStatistics1Statistics
@enableBackupStatus1Backup
@enableBlocksAndDeadlocks1Blocks and deadlocks
@enableCapacity1Database size
Partitioned indexes
Table size
@enableConnections1Connections
@enableCPUUtilization1CPU
@enableDatabaseIO1Database IO
@enableDatabaseState1Always On configuration
Database configuration
@enableIndexOperational1Index leaf statistics
Lock statistics
@enableIndexPhysical1Index physical
@enableIndexUsage1Index configuration
Index usage
@enableInstanceState1Instance configuration
Instance status
Resource Governor configuration
@enableMissingIndexes1Missing indexes
@enablePerformanceStatistics1Always On performance
Performance statistics
Resource Governor
@enablePlanCacheUsage1Plan cache usage
@enablePlanGuides1Plan guides
@enableQueryStatistics1Query statistics
@enableTriggers1Triggers
@enableWaitStatistics1Wait statistics
@enableWhoIsActive1Who is active
@enableLogShipping0Log shipping configuration
Log shipping status
@enableIndexRebuild0Index optimize
Ola Hallengren errors
@enableIndexReorganize0Index optimize
Ola Hallengren errors
@enableUpdateAllStatistics0Index optimize
Ola Hallengren errors
@enableUpdateModifiedStatistics0Index optimize
Ola Hallengren errors

Execute the installation script

A fresh installation takes a few seconds depending on your hardware of course.

An update can take some time depending on the amount of data.

New indexes will be created with page compression if the SQL server instance supports it.
Existing indexes will not be updated or in anyway changed to e.g. use page compression.

Enable SQL agent job

After installing and when you chosed to create the SQL agent jobs by setting the installation parameter @createSQLAgentJobs to 1, the SQL agent jobs are created but disabled.

To enable the SQL agent jobs right-click on them and select Enable.

The services will now start executing by the configured schedule and collect data.

Connect report

The Power BI report requires that the program version of Power BI Desktop is the March 2026 release version number 2.152.882.0 or higher.

The installation shown here is run on a clean Windows 11 work station and with the default settings of Power BI Desktop, March 2026, release version number 2.152.882.0.

The Power BI Desktop report is parametrized and allows you to specify the following parameters:

ParameterDescription
Server nameThe server where FHSQLMonitor is installed
Database nameThe database where FHSQLMonitor is installed
Schema nameThe schema for the views used by the Power BI report.

It must match the installation parameter @pbiSchema
Data load listA comma separated list of services for which data should be loaded into the Power BI report.

The default value with an empty configuration string is that data for all services are loaded.

Open the Power BI Desktop file FHSQLMonitor.pbit

1) In the Edit parameters form fill in the values matching your installation.

2) Specify the credentials to be used when connecting to the database.

3) Click OK if the Encryption Support dialog is shown.

4) After data load the Front page in the report will show the parameters used in the report.

Close and save the report as a PBIX file and the specified parameters are now saved as part of the report.