Quantcast
Channel: Symantec Connect - Endpoint Management
Viewing all articles
Browse latest Browse all 7217

Adding Compliance by Computer Trending to Your SMP

$
0
0

References:

[1]  Adding Patch Compliance Trending Capacity to SMP is as Simple as Running a Report Daily :D

[2] Connect downloads: {CWoC} Patch Trending Sitebuilder

Adding compliance by computer trending to your SMP

As you probably have seen here on Connect (if not check [1] and [2] first) we can do pretty graphs for compliance by updates / bulletin by gathering data from a single report [1], and the {CWoC} SiteBuilder [2].

Today we will add similar capabilities to the system, but to trend compliance by computer.

Now this is a very different matter, as we cannot possibly offer the option to list and display compliance by computer. Instead what we'll do is break out the estate by percentage. So we can list the variance on a given percentage value over time, and display the information in an efficient manner, with the current trend and historical max and minimums.

But before we get to the graphs, you'll need to create a SQL report and add the following query to it:

/* 
      COMPLIANCE BY COMPUTER TRENDING
*/
-- PART I: Make sure underlying infrastructure exists and is ready to use
if (exists(select 1 from sys.objects where name = 'PM_TRENDS2_TEMP' and type = 'U'))
begin
	truncate table PM_TRENDS2_TEMP
end
else
begin
CREATE TABLE [dbo].[PM_TRENDS2_TEMP](
	[_ResourceGuid] [uniqueidentifier] NOT NULL,
	[Computer Name] [varchar](250) NOT NULL,
	[Compliance] [numeric](6, 2) NULL,
	[Applicable (Count)] [int] NULL,
	[Installed (Count)] [int] NULL,
	[Not Installed (Count)] [int] NULL,
	[Restart Pending] [varchar](3) NOT NULL,
	[_DistributionStatus] [nvarchar](16) NULL,
	[_OperatingSystem] [nvarchar](128) NULL,
	[_StartDate] [datetime] NULL,
	[_EndDate] [datetime] NULL,
) ON [PRIMARY]
end

if (not exists(select 1 from sys.objects where type = 'U' and name = 'TREND_WindowsCompliance_ByComputer'))
begin
	CREATE TABLE [dbo].[TREND_WindowsCompliance_ByComputer](
		[_Exec_id] [int] NOT NULL,
		[_Exec_time] [datetime] NOT NULL,
		[Percent] int NOT NULL,
		[Computer #] int NOT NULL,
		[% of Total] money NOT NULL,
	) ON [PRIMARY]

	CREATE UNIQUE CLUSTERED INDEX [IX_TREND_WindowsCompliance_ByComputer] ON [dbo].[TREND_WindowsCompliance_ByComputer] 
	(
		[Percent] ASC,
		[_exec_id] ASC
	)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = 
OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

end

-- PART II: Get data into the trending table if no data was captured in the last 23 hours
if (select MAX(_exec_time) from TREND_WindowsCompliance_ByComputer) <  dateadd(hour, -23, getdate()) or (select COUNT(*) from TREND_WindowsCompliance_ByComputer) = 0
begin

-- Get the compliance by update to a "temp" table
insert into PM_TRENDS2_TEMP
exec spPMWindows_ComplianceByComputer
							@OperatingSystem = '%',
							@DistributionStatus = 'active',
							@FilterCollection = '311e8dae-2294-4ff2-b9ef-b3d6a84183cb',
							@StartDate = '1990-08-21T00:00:00',
							@EndDate = '2020-12-31',
							@pCulture = 'en-gb',
							@ScopeCollectionGuid = '01024956-1000-4cdb-b452-7db0cff541b6',
							@TrusteeScope = '{2e1f478a-4986-4223-9d1e-b5920a63ab41}',
							@VendorGuid	= '00000000-0000-0000-0000-000000000000',
							@CategoryGuid = '00000000-0000-0000-0000-000000000000'

declare @id as int
	set @id = (select MAX(_exec_id) from TREND_WindowsCompliance_ByComputer)

declare @total as float
	set @total = (select COUNT(*) from PM_TRENDS2_TEMP)

insert into TREND_WindowsCompliance_ByComputer
select (ISNULL(@id + 1, 1)), GETDATE() as '_Exec_time', CAST(compliance as decimal) as 'Percentile', COUNT(*) as 'Computer #', cast((CAST(count(*) as float) / @total) * 100 as money) as '% of Total'
  from PM_TRENDS2_TEMP
 group by CAST(compliance as decimal)
 order by CAST(compliance as decimal)

end

This is for the data gathering. You will notice that we only collect statistics for 100 entries, so this is even more scalable than the Compliance By Bulletin: it will take 10,000 run for the table to reach 1,000,000 entries.

Now, for the visualisation, a line graph would show the distribution of computers across a selected range, but we can use another Google Chart option: the candlestick.

See for yourself and let us now what you prefer, as the feature will go into version 0.6.8 of the SiteBuilder (out real soon):

Line chart:

ComplianceByComputer_LineChart.PNG

Candlestick chart:

ComplianceByComputer_CandleStickChart.PNG

Note that the dataset only has 2 data columns right now, but as the base grows with time the candlestick chart will also show a vertical line going thru the  block center from the historical low and high values.

Also I have truncated the range to only include data from 75 to 100%, as it contains 94%+ of the estate.

For more on those chart, please see the Google live samples: https://google-developers.appspot.com/chart/interactive/docs/gallery/candlestickchart


Viewing all articles
Browse latest Browse all 7217

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>