Is it possible to include net-snmp-tools in the Hassio container or otherwise include a snmpset option in the snmp platform?
I used this instruction to control a few APC PDU’s with SNMP: SNMP based command line switch.
Now I install this manually (apk add net-snmp-tools) and it works beautifully, but it’s lost with each container rebuild ofcourse.
Hi dazeller, thanks for the suggestion! Completely forgot about this thread… I also found a solution quite some time ago and I see that I started typing it in here, but never posted it…
This thread has been checked 700 times now, so i guess there are more people looking for this. What I did:
In configuration.yaml:
shell_command:
install_snmp: ‘/sbin/apk add net-snmp-tools’
action: shell_command.install_snmp
metadata: {}
data: {}
mode: single
This installs snmp-tools in qemux86-64-homeassistant container, so it works from the gui.
If you want it to work from ssh/ssh/cli, add ‘apk add net-snmp-tools’ to configuration - init_commands in ‘Advanced SSH & Web Terminal’
And then for example to switch poe power on/off on a Cisco SG350 switchport:
This helped me fix being able to control POE on my ICX7150. It uses non-standard payload values, 3 for on and 2 for off. The payload_on and payload_off parameters stopped working in the standard SNMP switch setup a while back. The last digit of the OID is the port number.
- switch:
name: Port 1/1/32 Power
command_on: /usr/bin/snmpset -Oqv -v 3 -l authPriv -u user -a SHA -A "auth" -x AES -X "pass" 192.168.11.1 1.3.6.1.4.1.1991.1.1.2.14.2.2.1.2.32 integer 3
command_off: /usr/bin/snmpset -Oqv -v 3 -l authPriv -u user -a SHA -A "auth" -x AES -X "pass" 192.168.11.11 1.3.6.1.4.1.1991.1.1.2.14.2.2.1.2.32 integer 2
command_state: /usr/bin/snmpget -Oqv -v 3 -l authPriv -u user -a SHA -A "auth" -x AES -X "pass" 192.168.11.1 1.3.6.1.4.1.1991.1.1.2.14.2.2.1.2.32
value_template: '{{ value == "3" }}'