Difference between revisions of "Home Assistant - Network Monitoring"
Jump to navigation
Jump to search
(Created page with "== SNMP Interface Polling == configuration.yaml example (TL-ER6020 OIDs) <pre> sensor: - platform: snmp name: wan_in host: 10.10.10.1 baseoid: 1.3.6.1.2.1.31.1....") |
|||
Line 44: | Line 44: | ||
unit_of_measurement: 'Mbps' | unit_of_measurement: 'Mbps' | ||
friendly_name: "WAN Out" | friendly_name: "WAN Out" | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | == OpenVPN Session Monitor == | ||
+ | <pre> | ||
+ | - platform: command_line | ||
+ | name: OpenVPN_Connections | ||
+ | command: "grep -c 'CLIENT_LIST' /etc/openvpn/server/openvpn-status.log | awk '{print $0-1}'" | ||
+ | scan_interval: 15 | ||
</pre> | </pre> |
Revision as of 11:02, 13 March 2023
SNMP Interface Polling
configuration.yaml example (TL-ER6020 OIDs)
sensor: - platform: snmp name: wan_in host: 10.10.10.1 baseoid: 1.3.6.1.2.1.31.1.1.1.6.2 accept_errors: true community: 'public' version: '2c' scan_interval: 4 - platform: snmp name: wan_out host: 10.10.10.1 baseoid: 1.3.6.1.2.1.31.1.1.1.10.2 accept_errors: true community: 'public' version: '2c' scan_interval: 4 - platform: derivative name: wan_in_der source: sensor.wan_in unit_time: s unit: B - platform: derivative name: wan_out_der source: sensor.wan_out unit_time: s unit: B
Required template:
- platform: template sensors: wan_in_mbps: value_template: "{{ [((states('sensor.wan_in_der')|float*8)/1000000)|round(2),0]|max }}" unit_of_measurement: 'Mbps' friendly_name: "WAN In" wan_out_mbps: value_template: "{{ [((states('sensor.wan_out_der')|float*8)/1000000)|round(2),0]|max }}" unit_of_measurement: 'Mbps' friendly_name: "WAN Out"
OpenVPN Session Monitor
- platform: command_line name: OpenVPN_Connections command: "grep -c 'CLIENT_LIST' /etc/openvpn/server/openvpn-status.log | awk '{print $0-1}'" scan_interval: 15