Quantcast
Channel: THWACK: Popular Discussions - Orion SDK
Viewing all articles
Browse latest Browse all 3719

I need help implementing a Custom SQL Query

$
0
0

Good Afternoon everyone,

 

Since a short period I've started working on an assignment given to me by my organization its Developers. I am not well known with Solarwinds, but learning. My IT manager asked me to create multiple Node Groupswhich are specifically for the IT production environment per country.

 

He also asked me to make one for Developers, who want to monitor specific devices within Solarwinds on their own accord. The machines, as set in the previous named node group, are assigned to a Windows User Group and taken into the Account Limitations. The Home Page View has been adjusted as well. Via this manner I have given our Developers rights to have a restricted view in Solarwinds. However! They also noted me they want an e-mail. And I'm trying to find out how to restrict this.

 

Now I've created a query that returns the values I actually need! I need to implement this within the Alert overview as a Custom SQL Alert. And I am at a loss. Everything I try keeps getting returned as"Query Condition is not valid".

 

# Query = Get all Machines from the Node Group [Development Servers] where FreeSpace is equal or less then 5%

 

/* Select the information needed. The machine name is being reported as well as the Full Capacity and Free space of the Disk. The Node Group is returned as well. */

SELECT N.NodeID, N.Caption, V.DisplayName, V.VirtualMachineID, VMV.Capacity, VMV.FreeSpace, C.Name

FROM Nodes AS N

 

/* Ensure all joins are made between every Database. This ensures that the correct information is returned in a single row. */

LEFT JOIN VirtualmachinesView as V ON N.NodeID = V.NodeID

LEFT JOIN ContainerMemberSnapshots AS CMS ON N.NodeID = CMS.EntityID and CMS.EntityType = 'Orion.Nodes'

LEFT JOIN Containers AS C ON C.ContainerID = CMS.ContainerID

LEFT JOIN VIM_VirtualMachineVolumes AS VMV ON VMV.VirtualMachineID = V.VirtualMachineID

 

/* The Container Name is defined to be 'Development Servers' as well as the FreeSpace remaining on the disk. It must be equal or less then 5%. */

WHERE C.Name='Development Servers'

AND (cast(VMV.FreeSpace as float)/cast(VMV.Capacity as float)) <= .05

 

/* Order the table by NodeID */

ORDER BY N.NodeID

 

Every form of feedback is appreciated. If it's not possible within Solarwinds, that's an answer as well which I can relay towards my manager.

 

With kind regards,

 

Tim


Viewing all articles
Browse latest Browse all 3719

Trending Articles



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