I thought I would share how I am able to trigger a HomeSeer event based on the dpinger output from my pfSense router. This took me less than 5 minutes to setup.
The HomeSeer event will trigger whenever the pfSense dpinger WAN monitor sends an Alarm or Clear event. The regular expression will capture the values and place them into the HomeSeer Global Variables so they can be used in scripting or within an e-mail.
Requirements:
HomeSeer Event:
Event Name: pfSense WAN Monitoring
Trigger: UltraLog3: Syslog Match
IF Syslog MsgTag starts with dpinger
AND IF Syslog MsgContent Regular Expression:
Then:
UltraSMTP3: Send an Email
Message Body:
Regards,
Ultrajones
The HomeSeer event will trigger whenever the pfSense dpinger WAN monitor sends an Alarm or Clear event. The regular expression will capture the values and place them into the HomeSeer Global Variables so they can be used in scripting or within an e-mail.
Requirements:
- HomeSeer3
- UltraLog3 HSPI
- UltraSMTP3 HSPI (optional)
- pfSense Router configured to send syslog output to UltraLog3
HomeSeer Event:
Event Name: pfSense WAN Monitoring
Trigger: UltraLog3: Syslog Match
IF Syslog MsgTag starts with dpinger
AND IF Syslog MsgContent Regular Expression:
Code:
WAN_DHCP\s+(?'ipaddress'\d+\.\d+\.\d+\.\d+):\s+(?'status'Alarm|Clear)\s(?'type'\w+)\s(?'latency'\d+).+?loss\s(?'pktloss'\d+)%
UltraSMTP3: Send an Email
Message Body:
PHP Code:
<html>
<body>
<p>The pfSense dpinger reported a change in the WAN monitoring state.</p>
<table border="1">
<tr>
<td>IP Address:</td><td>$$GetVar:[ipaddress]</td>
</tr>
<tr>
<td>Alarm Status:</td><td>$$GetVar:[status]</td>
</tr>
<tr>
<td>Alarm Type:</td><td>$$GetVar:[type]</td>
</tr>
<tr>
<td>Network Latency:</td><td>$$GetVar:[latency]us</td>
</tr>
<tr>
<td>Packet Loss:</td><td>$$GetVar:[pktloss]%</td>
</tr>
</table>
</body>
</html>
Ultrajones
Comment