Am I able to install SQLWatch to a server which has been set up with a Cname alias whereby @@servername variable returns the Cname value not the actual server name?
The install-dbasqlwatch fails with errors regarding sp_add_jobserver which I can add post-install manually, but will there be other references that may catch me out later?
Hi, that’s a very good question! I never tested such config but happy to work with you to make it work if you encounter issues.
Thanks Marcin, let me have a play with it and I’ll get back to you if I get errors. Cheers, Shaun
First up, thank you very much for getting back to me so quickly, I know this is a real “edge case”.
I’ve now tried an install with the following results:
I ran via the dbatools install method from the central repository server and used the cname for the sqlinstance option.
The dacpac returned multiple errors as before:
Could not deploy package.
Error SQL72014: .Net SqlClient Data Provider: Msg 14262, Level 16, State 1, Procedure msdb.dbo.sp_add_jobserver, Line 88 The specified @server_name (‘cname’) does not exist.
Error SQL72045: Script execution error.
However, all the jobs, XES and objects were created, but the jobs were disabled. I ran EXEC dbo.sp_add_jobserver for the jobs which enabled them, then I ran them manually.
This seemed to populate all the necessary tables but the disk data was missing so I had to update the powershell job step in the job SQLWATCH-LOGGER-DISK-UTILISATION
replacing the cname with actual server name in the powershell command, Invoke-SqlCmd -ServerInstance “servername”. Running SQLWATCH-INTERNAL-CONFIG job populated the disk tables correctly after that.
With the central repository I had to add the server using the cname when running the command .\SqlWatchImport.exe --add cname
All seems to running OK but I will keep an eye on it. I think it may point to powershell not be able to translate the cname at runtime. What do you think?