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....") |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | Handful of helpful configs I've managed to kludge together: | ||
+ | |||
== SNMP Interface Polling == | == SNMP Interface Polling == | ||
configuration.yaml example (TL-ER6020 OIDs) | configuration.yaml example (TL-ER6020 OIDs) | ||
Line 44: | Line 46: | ||
unit_of_measurement: 'Mbps' | unit_of_measurement: 'Mbps' | ||
friendly_name: "WAN Out" | friendly_name: "WAN Out" | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | == OpenVPN Session Monitor == | ||
+ | Assumes default Openvpn config directories: | ||
+ | |||
+ | <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> | ||
+ | |||
+ | == ICMP Testing == | ||
+ | Likely well documented online and simple: | ||
+ | |||
+ | <pre> | ||
+ | - platform: ping | ||
+ | host: 10.8.0.1 | ||
+ | name: OpenVPN_GW | ||
+ | count: 2 | ||
+ | scan_interval: 15 | ||
+ | </pre> | ||
+ | |||
+ | == SMTP - Outbound Notifications == | ||
+ | Match your SMTP auth and recipient settings: | ||
+ | |||
+ | <pre> | ||
+ | notify: | ||
+ | - name: FooFooMail | ||
+ | platform: smtp | ||
+ | server: smtp.hijacked.us | ||
+ | port: 587 | ||
+ | timeout: 15 | ||
+ | sender: user@hijacked.us | ||
+ | encryption: starttls | ||
+ | username: user@hijacked.us | ||
+ | password: "Super_Secure1" | ||
+ | recipient: rcpt@hijacked.us | ||
+ | |||
</pre> | </pre> |
Latest revision as of 11:15, 13 March 2023
Handful of helpful configs I've managed to kludge together:
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
Assumes default Openvpn config directories:
- platform: command_line name: OpenVPN_Connections command: "grep -c 'CLIENT_LIST' /etc/openvpn/server/openvpn-status.log | awk '{print $0-1}'" scan_interval: 15
ICMP Testing
Likely well documented online and simple:
- platform: ping host: 10.8.0.1 name: OpenVPN_GW count: 2 scan_interval: 15
SMTP - Outbound Notifications
Match your SMTP auth and recipient settings:
notify: - name: FooFooMail platform: smtp server: smtp.hijacked.us port: 587 timeout: 15 sender: user@hijacked.us encryption: starttls username: user@hijacked.us password: "Super_Secure1" recipient: rcpt@hijacked.us