Thanks alot for an amazing product. Really enjoy playing around with it and configuring it.
I have a question regarding the SNMP sensor that I’ve been playing around with and I have a few questions/suggestions.
So, currently I use it to monitor the interfaces on my router. The values come back in bytes and I then need to convert them into MiB (Mibibytes) using the template sensor and then round that value off to 1 decimal point. I have four interfaces that I’m monitoring, so each one requires a call/new instance of the SNMP monitor, followed by the data conversion using the template monitor for all 4 and once again another 4 instances of the template sensor need to be run.
Would it be possible to add a value_template to the SNMP monitor so that a template monitor isn’t required?
Can the SNMP monitor be modified to call all values of the all interfaces using one instance rather than multiple?
Am I running the SNMP sensor in the correct manner or can it already be run using one instance and returning multiple values?
If these modifications can be made, then other systems can be monitored in an extremely ‘light’ manner. This will bring down the load by quite a chunk.
Please let me know if this is possible
Would be possible as the SNMP sensor is just receiving values.
With code changes, yes. We have a bunch of sensors which are gathering everything and then splitting the values into different sensors (eg. the weather platforms). I doubt that it would be efficient for SNMP because the responses can be pretty big (without further containment) and those information needs to be processed some way or another.
I see the point here. For systems and network monitoring are already a lot of tools available which are optimized for speed and resource usage. It is always an option to get the needed information from an intermediary tool like netdata, collectd, or alike in a slow pace.
The first sensor returns the estimated runtime of the UPS connected to my NAS, in seconds.
The second sensor returns the status of that same UPS, as either ‘OL’ or ‘OB’.
So I have the following template sensors to make those values more readable:
- platform: template
sensors:
ups_runtime_templated:
value_template: >-
{%- if states.sensor.ups_runtime -%}
{%- set minutes = states.sensor.ups_runtime.state | multiply(0.016666666666667) | round(0) -%}
{%- if minutes == 1 -%}
1 minute
{%- else -%}
{{ minutes }} minutes
{%- endif -%}
{%- else -%}
unknown
{%- endif -%}
ups_status_templated:
value_template: >-
{%- if is_state('sensor.ups_status', 'OL') -%}
On power
{%- elif is_state('sensor.ups_status', 'OB') -%}
On battery
{%- endif -%}
EDIT: unit_of_measurement does indeed work…not sure why I never just tried it.
At this point, I’m hoping for a fix for that issue so my 4 float-based SNMP sensors would actually work. The SNMP sensor supporting value_template would be a nice bonus.
So here is what I currently use:
SNMP Sensor:
baseoid: 1.3.6.1.2.1.2.2.1.16.1
And then to change the value, which is in bytes, I use the following template sensor to convert to Mebibytes(Total)
value_template: ‘{{ states.sensor.snmp.state | multiply(0.00000095367) | round | int }}’
This outputs a whole number as for the value in Mebibytes.
I also experience a problem as once this value goes over 4000MiB (Around 4GB), the counter reports as unknown or 0. The only fix is to restart the monitored SNMP device, in this case, my router. I understand that this is an issue with SNMP v1. Is there a way to force SNMP v2c to query the router and if so, where can a I specify authentication under the sensor…
Hi there,
Sorry for the late reply. By the way, you guys are making life rather expensive All I wanna do is buy more and more HA compliant devices. I think a robot vacuum is next on the list.
Anyway, back to the SNMP value_template request. So, I use the following template to pull current data sent/receive on an interface on my router:
{{ states.sensor.interface-up/down.state | multiply(0.00000095367) | round | int }}
And that returns a value in MB on how much data has been sent or received on the specified interface. It works, but just thought that it could just be run using the SNMP sensor rather than having to template