I’m not sure how to phrase this properly, so I’ll just jump right in.
I’ve set up Home Assistant to receive SNMP data from Windows File Server in the form of sensors. The idea behind this would be to monitor free disk space. The SNMP data is in the form of OIDs and I can get total disk space and used disk space.
I would like to combine these two figures to get a percentage value and ideally have it represented visually with a green-orange-red icon, depending on how much disk space is available.
Basically, I want to take two values from sensors and do a calculation with them.
Hi, that’s exactly what I want to do, thanks a bunch.
I can now get it to do simple things, but unfortunately ‘free disk space’ isn’t one of the measured metrics for SNMP, or I’m just not seeing it, so I have to do a long calculation.
Basically {[(Total - Used) / Total] x 100}
This is the line with my custom sensor, would you mind having a look at how I need to change it to get it working:
I’m still digging around for the OIDs to show processor load and free memory, the values at the moment are for something else as placeholders. The fan speed and temperature is a nice touch.
Just to clarify, it’s not really ignoring the function. It’s an “order of operations” thing.
since you didn’t use the parentheses around the entire thing it assumed that you just wanted to round the last term in the equation - which in this case is 100. since 100 is already rounded to a full decimal place then nothing is different.
the “round” is specific to the last grouped terms just before the command. just like the “int” is specific to the last grouped term - states(‘sensor.hrstoragetotal_disk_c’)
Dear @thekevinkalis,
I am trying to do the same as you did, SNMP sensors to monitor a WIN machine, in my case the NUC on which my Hass runs in a VM under VirtualBox.
I have tried to use SNMPWalk, but I can’t figure out how to retrieve the OIDs I need: disk total space, disk free space, memory, CPU, etc.
Could you please share the OIDs you used? Or your sensors config.? I am a bit desperate.
Thanks!
I ended up using OID Browser, I found the interface much more user friendly. With a bit of clicking around, you get a feel for the structure and where the OIDs are. I’m assuming you’ve enabled the SNMP service within Windows and know the community string.
When you have the OIDs, you have to create sensors for each value, ie. “Total Disk Space”, “Used Disk Space” etc. You then have to create a separate sensor to calculate the available disk space.
Thanks, I eventually found an OID browser showing enough information.
FYI, for the CPU, I use the Windows Device Portal API, which provides the info (curl in a command_line sensor). It is not always matching 100% what I see in the Task Manager running on the machine, but it is a good indication.