All, I am looking for some SWAL/SQL code that can pull out the following information from the database.
Columns Include:
Device Name
IP Address
Make
Model
Serial Number
Temperature Fahrenheit and Celsius
Changed one line and got some more temperature values (not all temp sensors are called temp sensors....):
SELECT Top 100N.Caption AS [Device name],N.IP_Address,N.MachineType,N.Vendor,N.HardwareHealthInfos.ServiceTag AS [Serial Number],T.AVG_Node_Temp_Celcius AS [AVG Temp in C],T.AVG_Node_Temp_Farenheit AS [AVG Temp in F]FROM Orion.Nodes AS NLEFT OUTER JOIN (SELECT NodeID ,CASE WHEN H.HardwareUnit.Name='DegreesC' THEN ROUND(AVG(H.Value),0) WHEN H.HardwareUnit.Name='DegreesF' THEN ROUND(((AVG(H.Value)-32)*5/9),0) END AS [AVG_Node_Temp_Celcius] ,CASE WHEN H.HardwareUnit.Name='DegreesC' THEN ROUND(((AVG(H.Value)*9)/5+32),0) WHEN H.HardwareUnit.Name='DegreesF' THEN ROUND(AVG(H.Value),0) END AS [AVG_Node_Temp_Farenheit]FROM Orion.HardwareHealth.HardwareItem AS HWHERE H.HardwareUnit.Name IN ('DegreesF','DegreesC') AND H.IsDeleted='FALSE' AND H.Value IS NOT NULLGROUP BY H.NodeID,H.HardwareUnit.Name) AS T ON N.Nodeid=T.Nodeid
The other once though.... Hard to troubleshoot how your devices look like. Mine that don't have values in the query don't have that in orion at all.
Add the filter to the WHERE clause
I should be able to get you the first 5 Regarding temperature, is that something you poll via UnDP or would it be from Hardware Health?
Should be hardware health
Is this what you are looking for?
SELECT Top 100N.Caption AS [Device name],N.IP_Address,N.MachineType,N.Vendor,N.HardwareHealthInfos.ServiceTag AS [Serial Number],T.AVG_Node_Temp_Celcius AS [AVG Temp in C],T.AVG_Node_Temp_Farenheit AS [AVG Temp in F]FROM Orion.Nodes AS NLEFT OUTER JOIN (SELECT NodeID ,CASE WHEN H.HardwareUnit.Name='DegreesC' THEN ROUND(AVG(H.Value),0) WHEN H.HardwareUnit.Name='DegreesF' THEN ROUND(((AVG(H.Value)-32)*5/9),0) END AS [AVG_Node_Temp_Celcius] ,CASE WHEN H.HardwareUnit.Name='DegreesC' THEN ROUND(((AVG(H.Value)*9)/5+32),0) WHEN H.HardwareUnit.Name='DegreesF' THEN ROUND(AVG(H.Value),0) END AS [AVG_Node_Temp_Farenheit]FROM Orion.HardwareHealth.HardwareItem AS HWHERE H.uniquename like 'TemperatureSensor%' AND H.IsDeleted='FALSE' AND H.Value IS NOT NULLGROUP BY H.NodeID,H.HardwareUnit.Name) AS T ON N.Nodeid=T.Nodeid
One issue is that there are probably MANY temp-sensors on a node. The query just takes an average on each node. Then it checks if the value is in F or C and calculates them to the other where needed.
Yes, that is very close. The output is missing some information on some devices. I know when I had go through something similar in the past, I had to join other tables.
location where I can choose from only where vendor = Cisco
Thanks @Seashore for jumping in I was still sleeping It's nice to have people around the globe that can help each other!
Haha, sure thing @planglois. It's soon my turn to switch off for today. Your turn to assist now
I'll do my best to not deceive you
Thanks everyone for the assistance.
This is working like a champ. I have already used it to identify a remote site computer room that was overheating.
I would like to be able to turn this into an Alert, but trying to figure out how to pull the information from the database and trigger if the node goes above 135 degrees F or 50C.
thoughts?
In the best of worlds below would work. Test, if it doesn't we have to convert above report query to an alert query.
Ok, got it. thanks,
I have it dialed in now and alerting.