There are customers that would like to have package server and package status reporting on all SMPs from the Parent SMP. This report is an attempt to accomplish this. It requires some knowledge of SQL to configure properly. The steps to configure are documented and color coded in the HowTo83775.doc in the attached zip file.
This query and reports require that linked servers are established on the parent SMP for each of the child SMPs in the environment. If IT Analytics is already installed and configured on the parent SMP this should already be done.
To configure the query and reports for your infrastructure first import the packageserverreports.xml into the console on the parent SMP.
1. Uncomment each of the --DECLARE statements for however many child SMPs in the configuration
2. Uncomment each if the --Set @child? = statement for however many child SMPs in the configuration
3. Set the Set @child? = to '[child_SMP_name].[smp_database_name] for each child SMP
4. There is a "Union" section for each child SMP. Commented out sections are encapsulated with /* .... */. Remove the beginning /* and ending */ for each child SMP section in the configuration.
5. The very last SQL command in the sequential "Union" statements must be EXEC (@sql_script). Comment this statement in the previous "union" statements for the child SMPs and uncomment this in the last "union" statement for the last child SMP.
These steps will need to be done in the raw SQL and in each of the package server reports.
If the result set is too large for the “package servers details” report, you might consider breaking this up into multiple reports.
--sp_helptext spgetpackagesummary
/*-- Get list of linked servers
select name from sys.servers where product = 'SQL Server'
--Get DB Names
select * from sys.databases where name like 'symantec%' */
--Step 1 in ReadMe First
DECLARE @child1 nvarchar(64)
DECLARE @child2 nvarchar(64)
--DECLARE @child3 nvarchar(64)
--DECLARE @child4 nvarchar(64)
--DECLARE @child5 nvarchar(64)
--DECLARE @child6 nvarchar(64)
--Step 2 & 3 in ReadMe First
set @child1 = '[ns71-ks4].symantec_cmdb1' --replace with correct child SMP and database
set @child2 = '[ns71-ks2].symantec_cmdb' --replace with correct child SMP and database
--set @child3 = ''
--set @child4 = ''
--set @child5 = ''
--set @child6 = ''
Create table #packageserver(
[name] nvarchar(64),
[guid] uniqueidentifier,
[pkgname]nvarchar(255),
[pkgguid]uniqueidentifier,
[ownernsguid] uniqueidentifier,
[Status]nvarchar(20),
[Description] nvarchar(255))
DECLARE @sql_script VARCHAR(MAX)
select @sql_script =
'insert into #packageserver
select i.name, s.pkgsvrid, i2.name, s.PackageID, i.ownernsguid, s.Status, s.description from swdpackageserver s
join vItem i on i.Guid = s.PkgSvrId
join vItem i2 on i2.Guid = s.packageid
--child1
Union
select i.name, s.pkgsvrid, i2.name, s.PackageID, i.ownernsguid, s.Status, s.description from ' + @child1 + '.dbo.swdpackageserver s
join ' + @child1 + '.dbo.vItem i on i.Guid = s.PkgSvrId
join ' + @child1 + '.dbo.vItem i2 on i2.Guid = s.packageid
--child2
-- Step 4 Comment if only one child SMP
Union
select i.name, s.pkgsvrid, i2.name, s.PackageID, i.ownernsguid, s.Status, s.description from ' + @child2 + '.dbo.swdpackageserver s
join ' + @child2 + '.dbo.vItem i on i.Guid = s.PkgSvrId
join ' + @child2 + '.dbo.vItem i2 on i2.Guid = s.packageid'
EXEC (@sql_script) -- Step 5 Remove if three child SMPs
--child3
-- Step 4 Uncomment for third child SMP
/* Union
select i.name, s.pkgsvrid, i2.name, s.PackageID, i.ownernsguid, s.Status, s.description from' + @child3 + '.dbo.swdpackageserver s
join' + @child3 + '.dbo.vItem i on i.Guid = s.PkgSvrId
join' + @child3 + '.vItem i2 on i2.Guid = s.packageid
--' --uncomment if only 3 child SMP
--EXEC (@sql_script) --Step 5 uncomment if only 3 child SMPs */
--child4
-- Step 4 Uncomment for forth child SMP
/* select @sql_script =
Union
select i.name, s.pkgsvrid, i2.name, s.PackageID, i.ownernsguid, s.Status, s.description from' + @child4 + '.dbo.swdpackageserver s
join' + @child4 + '.dbo.vItem i on i.Guid = s.PkgSvrId
join' + @child4 + '.vItem i2 on i2.Guid = s.packageid
--' --uncomment if only 4 child SMP
-- EXEC (@sql_script) ) --Step 5 uncomment if only 4 child SMPs */
--child5
-- Step 4 Uncomment for fifth child SMP
/* select @sql_script =
Union
select i.name, s.pkgsvrid, i2.name, s.PackageID, i.ownernsguid, s.Status, s.description from' + @child5 + '.dbo.swdpackageserver s
join' + @child5 + '.dbo.vItem i on i.Guid = s.PkgSvrId
join' + @child5 + '.vItem i2 on i2.Guid = s.packageid
--' --uncomment if only 5 child SMP
-- EXEC (@sql_script) --) --Step 5 uncomment if only 5 child SMPs */
--child6
-- Step 4 Uncomment for sixth child SMP
/* select @sql_script =
'Union
select i.name, s.pkgsvrid, i2.name, s.PackageID, i.ownernsguid, s.Status, s.description from' + @child6 + '.dbo.swdpackageserver s
join' + @child6 + '.vItem i on i.Guid = s.PkgSvrId
join' + @child6 + '.vItem i2 on i2.Guid = s.packageid'
-- EXEC (@sql_script) ) --Step 5 uncomment if 6 child SMPs */
select ps.Status, ps.guid, count(*) as [Packages]
into #tmp
from #PackageServer as ps
group by ps.Status, ps.guid
select distinct
t.guid as PkgSvrId,
t.[Name][PkgServer],
f.Name [SMP],
isnull(( select sum(Packages) from #tmp where lower(Status) = 'ready' and guid=t.guid ),0) as [Ready],
isnull(( select sum(Packages) from #tmp where lower(Status) = 'invalid package' and guid=t.guid ),0) as [Invalid],
isnull(( select sum(Packages) from #tmp where lower(Status) not in ('ready','invalid package') and guid=t.guid ),0) as [NotReady]
from #packageserver as t
join ForwardServer f on f.Guid = t.ownernsguid
order by t.[Name]
Select ps.name [pkgserver], f.name [SMP], ps.pkgname, ps.pkgguid, ps.Status, ps.description from #packageserver ps
join ForwardServer f on ps.ownernsguid = f.guid
order by ps.name
drop table #packageserver
drop table #tmp