home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
moodle.waes.ac.uk
/
moodle.waes.ac.uk.zip
/
moodle.waes.ac.uk
/
TMG
/
SP1-TMG-KB981324-AMD64-ENU.msp
/
PCW_CAB_SHFx2
/
F2143_msfpcui.dll
/
BINARY
/
25051
< prev
next >
Wrap
Text File
|
2010-06-15
|
3KB
|
87 lines
CREATE PROCEDURE [ISA_spUsageSummary]
AS
BEGIN
SET NOCOUNT ON;
IF OBJECT_ID ('tblUsageSummary', 'u') IS NOT NULL
DROP TABLE [tblUsageSummary]
DECLARE @FromDate datetime
SET @FromDate = (SELECT [FromDate] FROM [tblSummaryParams])
CREATE TABLE #Table1
(
iHour int,
CacheHits bigint,
ProcessingTime bigint,
TotalBytes bigint,
Requests bigint,
WebRequests bigint
);
DECLARE @CurrentDate datetime
SET @CurrentDate = @FromDate
SET @CurrentDate = DATEADD(hour, -1 * DATEPART(hour, @CurrentDate), @CurrentDate)
SET @CurrentDate = DATEADD(minute, -1 * DATEPART(minute, @CurrentDate), @CurrentDate)
SET @CurrentDate = DATEADD(second, -1 * DATEPART(second, @CurrentDate), @CurrentDate)
SET @CurrentDate = DATEADD(millisecond, -1 * DATEPART(millisecond, @CurrentDate), @CurrentDate)
IF OBJECT_ID ('WEB_LOGS', 'view') IS NOT NULL
BEGIN
INSERT INTO #Table1
SELECT
DATEPART(hour, [logTime]) AS iHour,
CASE
WHEN ([objectsource] IN (1, 2, 3, 4, 8)) THEN COUNT(*)
ELSE 0
END AS CacheHits,
SUM(CAST([processingtime] AS bigint)) AS ProcessingTime,
SUM([bytesrecvd]) + SUM([bytessent]) AS TotalBytes,
COUNT(*) AS Requests,
COUNT(*) AS WebRequests
FROM WEB_LOGS
WHERE
([InternalServiceInfo] & 2) = 0 AND
([Action] != 8) AND
([resultcode] != 13301) AND
([Action] != 10) AND
([objectsource] != 6)
GROUP BY
DATEPART(hour, [logTime]),
DATEPART(minute, [logTime]),
[objectsource]
END
IF OBJECT_ID ('FWS_LOGS', 'view') IS NOT NULL
BEGIN
INSERT INTO #Table1
SELECT
DATEPART(hour, [logTime]) AS iHour,
0 AS CacheHits,
SUM(CAST([connectiontimeDelta] AS bigint)) AS ProcessingTime,
SUM([bytesrecvdDelta]) + SUM([bytessentDelta]) AS TotalBytes,
CASE
WHEN ([Action] = 11) THEN 0
ELSE COUNT(*)
END AS Requests,
0 AS WebRequests
FROM FWS_LOGS
WHERE
([InternalServiceInfo] & 2) = 0 AND
([Action] != 8) AND
([Action] != 10)
GROUP BY
DATEPART(hour, [logTime]),
DATEPART(minute, [logTime]),
[Action];
END
SELECT
DATEADD(hour, [iHour] , @CurrentDate) AS Interval,
SUM([CacheHits]) AS [CacheHits],
SUM([processingtime]) AS ProcessingTime,
SUM([TotalBytes]) AS TotalBytes,
SUM([Requests]) AS Requests,
SUM([WebRequests]) AS WebRequests,
MAX([Requests]) AS MaxConcurrentConnectionsPerMinute,
@FromDate AS Date
INTO [tblUsageSummary]
FROM #Table1
GROUP BY
[iHour]
INSERT INTO [tblSummaryTables] ([TableName]) VALUES ('tblUsageSummary')
END