Quantcast
Channel: THWACK: All Content - Network Performance Monitor
Viewing all articles
Browse latest Browse all 21870

DISKS SPACE TREND Report with SQL Reporting Services

$
0
0

I created a Solarwinds Disk Usage Report using MS SQL reporting service. The SQL query should work for Solarwinds Report Writer too. The report will collect fixed disk usage (%) information for all nodes from 4 different days (yesterday(day1) and 2, 7 and 31 days ago). Then calculate the daily(day2-day1), weekly(day7-day1), monthly(daye31-day1) increase. If the usage is > 95%, or Daily Increase > 10%, or Weekly Increase > 20% or Monthly Increase > 30%, the information will be displayed. Because the calculation is only based on 4 days data,  the results may not always 100% correct, but it should close the true picture which can be used to analyse the disk usage trend. Hope this helpful.

SolarwindsDiskUsageReportIMG.jpg

=========================================

Select TbDay1.NodeName, TbDay1.NodeID, TbDay1.DiskName, TbDay1.DiskID, TbDay1.Disk_Size,

      TbDay1.Day1, TbDay1.Day1_DiskUsed, TbDay1.Day1_PercentDiskUsed,

      TbDay2.Day2, TbDay2.Day2_DiskUsed, TbDay2.Day2_PercentDiskUsed,

      Round(TbDay1.Day1_PercentDiskUsed - TbDay2.Day2_PercentDiskUsed,2) AS DailyIncrease,

      TbDay7.Day7, TbDay7.Day7_DiskUsed, TbDay7.Day7_PercentDiskUsed,

      Round(TbDay1.Day1_PercentDiskUsed - TbDay7.Day7_PercentDiskUsed,2) AS WeeklyIncrease,

      TbDay30.Day30, TbDay30.Day30_DiskUsed, TbDay30.Day30_PercentDiskUsed,

      Round(TbDay1.Day1_PercentDiskUsed - TbDay30.Day30_PercentDiskUsed,2) AS MonthlyIncrease

FROM

(((

(SELECT

  Nodes.NodeID AS NodeID,

  Nodes.Caption AS NodeName,

  Volumes.VolumeID AS DiskID,

  Volumes.Caption AS DiskName,

  CONVERT(date,VolumeUsage.DateTime) AS Day1,

  ROUND(AVG(VolumeUsage.DiskSize)/1024/1024/1024,1) AS Disk_Size,

  ROUND(AVG(VolumeUsage.AvgDiskUsed)/1024/1024/1024,1) AS Day1_DiskUsed,

  ROUND(AVG(VolumeUsage.PercentDiskUsed),1) AS Day1_PercentDiskUsed

FROM

(Nodes INNER JOIN Volumes ON (Nodes.NodeID = Volumes.NodeID))  INNER JOIN VolumeUsage ON (Volumes.VolumeID = VolumeUsage.VolumeID)

WHERE

(Volumes.VolumeType ='Fixed Disk')

AND ( DateTime BETWEEN DATEADD(dd, -1, DATEDIFF(dd, 0, GETDATE())) AND DATEADD(hh, -22, DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))))

GROUP BY CONVERT(date,VolumeUsage.DateTime), Nodes.NodeID, Volumes.VolumeID, Nodes.Caption, Volumes.Caption

) TbDay1

INNER JOIN

(SELECT

  Nodes.NodeID AS NodeID,

  Nodes.Caption AS NodeName,

  Volumes.VolumeID AS DiskID,

  Volumes.Caption AS DiskName,

  CONVERT(date,VolumeUsage.DateTime) AS Day2,

  ROUND(AVG(VolumeUsage.DiskSize)/1024/1024/1024,1) AS Disk_Size,

  ROUND(AVG(VolumeUsage.AvgDiskUsed)/1024/1024/1024,1) AS Day2_DiskUsed,

  ROUND(AVG(VolumeUsage.PercentDiskUsed),1) AS Day2_PercentDiskUsed

FROM

(Nodes INNER JOIN Volumes ON (Nodes.NodeID = Volumes.NodeID))  INNER JOIN VolumeUsage ON (Volumes.VolumeID = VolumeUsage.VolumeID)

WHERE

(Volumes.VolumeType ='Fixed Disk')

AND ( DateTime BETWEEN DATEADD(dd, -2, DATEDIFF(dd, 0, GETDATE())) AND DATEADD(hh, -22, DATEADD(dd, -1, DATEDIFF(dd, 0, GETDATE()))))

GROUP BY CONVERT(date,VolumeUsage.DateTime),Nodes.NodeID, Volumes.VolumeID, Nodes.Caption, Volumes.Caption

) TbDay2

ON (TbDay1.NodeID = TbDay2.NodeID AND TbDay1.DiskID = TbDay2.DiskID)

)

INNER JOIN

(SELECT

  Nodes.NodeID AS NodeID,

  Nodes.Caption AS NodeName,

  Volumes.VolumeID AS DiskID,

  Volumes.Caption AS DiskName,

  CONVERT(date,VolumeUsage.DateTime) AS Day7,

  ROUND(AVG(VolumeUsage.DiskSize)/1024/1024/1024,1) AS Disk_Size,

  ROUND(AVG(VolumeUsage.AvgDiskUsed)/1024/1024/1024,1) AS Day7_DiskUsed,

  ROUND(AVG(VolumeUsage.PercentDiskUsed),1) AS Day7_PercentDiskUsed

  FROM

  (Nodes INNER JOIN Volumes ON (Nodes.NodeID = Volumes.NodeID))  INNER JOIN VolumeUsage ON (Volumes.VolumeID = VolumeUsage.VolumeID)

  WHERE

  (Volumes.VolumeType ='Fixed Disk')

    AND ( DateTime BETWEEN DATEADD(dd, -7, DATEDIFF(dd, 0, GETDATE())) AND DATEADD(hh, -22, DATEADD(dd, -6, DATEDIFF(dd, 0, GETDATE()))))

  GROUP BY CONVERT(date,VolumeUsage.DateTime),Nodes.NodeID, Volumes.VolumeID, Nodes.Caption, Volumes.Caption

) TbDay7

ON (TbDay7.NodeID = TbDay2.NodeID AND TbDay7.DiskID = TbDay2.DiskID)

)

  INNER JOIN

  (SELECT

    Nodes.NodeID AS NodeID,

    Nodes.Caption AS NodeName,

    Volumes.VolumeID AS DiskID,

    Volumes.Caption AS DiskName,

    CONVERT(date,VolumeUsage.DateTime) AS Day30,

    ROUND(AVG(VolumeUsage.DiskSize)/1024/1024/1024,1) AS Disk_Size,

    ROUND(AVG(VolumeUsage.AvgDiskUsed)/1024/1024/1024,1) AS Day30_DiskUsed,

    ROUND(AVG(VolumeUsage.PercentDiskUsed),1) AS Day30_PercentDiskUsed

    FROM

    (Nodes INNER JOIN Volumes ON (Nodes.NodeID = Volumes.NodeID))  INNER JOIN VolumeUsage ON (Volumes.VolumeID = VolumeUsage.VolumeID)

    WHERE

    (Volumes.VolumeType ='Fixed Disk')

    AND ( DateTime BETWEEN DATEADD(dd, -31, DATEDIFF(dd, 0, GETDATE())) AND DATEADD(hh, -22, DATEADD(dd, -30, DATEDIFF(dd, 0, GETDATE()))))

    GROUP BY CONVERT(date,VolumeUsage.DateTime),Nodes.NodeID, Volumes.VolumeID, Nodes.Caption, Volumes.Caption

  ) TbDay30

ON (TbDay7.NodeID = TbDay30.NodeID AND TbDay7.DiskID = TbDay30.DiskID)

  )

 

 

WHERE TbDay1.Day1_PercentDiskUsed > 95.0 OR Round(TbDay1.Day1_PercentDiskUsed - TbDay2.Day2_PercentDiskUsed,2) > 10.0 OR Round(TbDay1.Day1_PercentDiskUsed - TbDay7.Day7_PercentDiskUsed,2) > 20.0 OR Round(TbDay1.Day1_PercentDiskUsed - TbDay30.Day30_PercentDiskUsed,2) > 30.0

 

 

ORDER BY TbDay1.NodeName, TbDay1.DiskName


Viewing all articles
Browse latest Browse all 21870

Trending Articles



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