Difference between revisions of "Home Assistant - Network Monitoring"

From WTFwiki
Jump to navigation Jump to search
 
Line 68: Line 68:
 
     count: 2
 
     count: 2
 
     scan_interval: 15
 
     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 12: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