This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

SAM - Linux CPU (swql)

The SAM template "Linux CPU Monitoring Perl" is pretty good in getting the user and system CPU, but there is no good way of displaying this information.

This little script will pull out the information for each component - which is very helpful if you're applying this to hundreds of Linux boxes.

cscoengineer_0-1594824918689.png

SELECT
TOUPPER(SUBSTRING(n.Caption,1,case when charindex('.',n.Caption,1) <=4 then length(n.Caption) else (charindex('.',n.Caption,1)-1) end)) AS [Node Name]
,n.DetailsUrl AS [_LinkFor_Node Name]
,'/Orion/images/StatusIcons/Small-' + n.StatusIcon AS [_IconFor_Node Name]

,concat(CPUuser.value,'%') as [CPU User]
,concat(CPUsystem.value,'%') as [CPU System]
from orion.nodes n

join
(SELECT
n.NodeID
,case when c.CurrentStatistics.ComponentStatisticData is null then '--'
else tostring(round(c.CurrentStatistics.ComponentStatisticData,1)) end as [Value]
From Orion.nodes n
join Orion.apm.Application a on a.NodeID=n.nodeid
join Orion.apm.Component c on c.ApplicationID=a.ApplicationID
join Orion.apm.ComponentDefinition cd on cd.ComponentType=c.componenttype
where c.disabled=0 and c.ComponentName like 'CPU User Time%' ) CPUuser on CPUuser.nodeid=n.nodeid

join
(SELECT
n.NodeID
,case when c.CurrentStatistics.ComponentStatisticData is null then '--'
else tostring(round(c.CurrentStatistics.ComponentStatisticData,1)) end as [Value]
From Orion.nodes n
join Orion.apm.Application a on a.NodeID=n.nodeid
join Orion.apm.Component c on c.ApplicationID=a.ApplicationID
join Orion.apm.ComponentDefinition cd on cd.ComponentType=c.componenttype
where c.disabled=0 and c.ComponentName like 'CPU System Time%' ) CPUsystem on CPUsystem.nodeid=n.nodeid

order by CPUsystem.value desc, CPUuser.value desc

Thank you
Amit

email: ashah@loop1.com

Loop1 Systems - SolarWinds Training and Professional Services