Hi,
As part of our regular reporting process, we are pulling a report from solarwinds for node CPU, MEMORY and DISK Utilization data. We are now working to automate this process using SWQL queries. However, when attempting to extract historical data via SWQL, the queries are returning no results(giving errors)
We would require your help to gather the information via query.
Used below query to fetch the details:
SELECT
n.Caption AS NodeName,
n.IPAddress,
ROUND(AVG(cpu.AvgLoad), 2) AS AvgCPULoadPercent_Last2Hours,
ROUND(AVG(mem.AvgValue), 2) AS AvgMemoryUsedPercent_Last2Hours,
vol.InstanceName AS VolumeDescription,
ROUND(AVG(vol.AvgValue), 2) AS AvgVolumeUsedPercent_Last2Hours
FROM Orion.Nodes n
-- CPU history
JOIN Orion.CPULoad cpu ON cpu.NodeID = n.NodeID
-- Memory history from agent
JOIN Orion.AgentPerformanceCounters mem ON mem.NodeID = n.NodeID
-- Volume history from agent
JOIN Orion.AgentVolumePerformance vol ON vol.NodeID = n.NodeID
WHERE n.Caption = 'Node Name' --- replace with node name
AND cpu.DateTime > (GETDATE() - 2.0 / 24.0)
AND mem.CounterName = 'PercentMemoryUsed'
AND mem.DateTime > (GETDATE() - 2.0 / 24.0)
AND vol.CounterName = 'PercentDiskUsed'
AND vol.DateTime > (GETDATE() - 2.0 / 24.0)
GROUP BY
n.Caption,
n.IPAddress,
vol.InstanceName
ORDER BY
vol.InstanceName
===========================================
SELECT
n.NodeID,
n.Caption AS NodeName,
n.IPAddress,
ROUND(AVG(c.AvgLoad), 2) AS AvgCPULoadLast2Hours,
n.PercentMemoryUsed AS CurrentMemoryUsedPercent,
v.VolumeDescription,
v.VolumePercentUsed AS CurrentDiskUsedPercent
FROM Orion.Nodes n
JOIN Orion.CPULoad c ON c.NodeID = n.NodeID
LEFT JOIN Orion.Volumes v ON v.NodeID = n.NodeID
WHERE
n.Caption = 'vbcs157.mgt.in.corp'
AND c.DateTime > DATEADD(HOUR, -2, GETDATE())
AND v.VolumePercentUsed IS NOT NULL
GROUP BY
n.NodeID,
n.Caption,
n.IPAddress,
n.PercentMemoryUsed,
v.VolumeDescription,
v.VolumePercentUsed
ORDER BY
v.VolumeDescription