#433, 435 work - handle empty in DHCPLSS, email templates fixes
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<table width=100% border=0 bgcolor=#4b99d3 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 15px; text-align:center; color:#ffffff"> <tr>
|
<table width=100% border=0 bgcolor=#4b99d3 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 15px; text-align:center; color:#ffffff"> <tr>
|
||||||
<td width=100%> Report Date: <b><REPORT_DATE></b> </td>
|
<td width=100% bgcolor="#3c8dbc"> Report Date: <b><REPORT_DATE></b> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<table width=100% bgcolor=#3c8dbc cellpadding=5px cellspacing=0 style="font-size: 13px; font-weight: bold; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;">
|
<table width=100% bgcolor=#3c8dbc cellpadding=5px cellspacing=0 style="font-size: 13px; font-weight: bold; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td width=50% style="text-align:center;color: white;">
|
<td width=50% style="text-align:center;color: white;" bgcolor="#3c8dbc">
|
||||||
<a href="https://github.com/jokob-sk/Pi.Alert" target="_blank" style="color: white">Pi.Alert</a>
|
<a href="https://github.com/jokob-sk/Pi.Alert" target="_blank" style="color: white">Pi.Alert</a>
|
||||||
<a href=".." target="_blank" style="color: white"> (<SERVER_NAME>)</a>
|
<a href=".." target="_blank" style="color: white"> (<SERVER_NAME>)</a>
|
||||||
<br><span style="display:inline-block;color: white; transform: rotate(180deg)">©</span>2020 Puche (2022+
|
<br><span style="display:inline-block;color: white; transform: rotate(180deg)">©</span>2020 Puche (2022+
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<table width=100% border=0 bgcolor=#4b99d3 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 15px; text-align:center; color:#ffffff"> <tr>
|
<table width=100% border=0 bgcolor=#4b99d3 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 15px; text-align:center; color:#ffffff"> <tr>
|
||||||
<td width=100%> Report Date: <b><REPORT_DATE></b> </td>
|
<td width=100% bgcolor="#3c8dbc"> Report Date: <b><REPORT_DATE></b> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<table width=100% bgcolor=#3c8dbc cellpadding=5px cellspacing=0 style="font-size: 13px; font-weight: bold; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;">
|
<table width=100% bgcolor=#3c8dbc cellpadding=5px cellspacing=0 style="font-size: 13px; font-weight: bold; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td width=50% style="text-align:center;color: white;">
|
<td width=50% style="text-align:center;color: white;" bgcolor="#3c8dbc">
|
||||||
<a href="https://github.com/jokob-sk/Pi.Alert" target="_blank" style="color: white">Pi.Alert</a>
|
<a href="https://github.com/jokob-sk/Pi.Alert" target="_blank" style="color: white">Pi.Alert</a>
|
||||||
<a href=".." target="_blank" style="color: white"> (<SERVER_NAME>)</a>
|
<a href=".." target="_blank" style="color: white"> (<SERVER_NAME>)</a>
|
||||||
<br><span style="display:inline-block;color: white; transform: rotate(180deg)">©</span>2020 Puche (2022+
|
<br><span style="display:inline-block;color: white; transform: rotate(180deg)">©</span>2020 Puche (2022+
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import sys
|
|||||||
sys.path.append("/home/pi/pialert/front/plugins")
|
sys.path.append("/home/pi/pialert/front/plugins")
|
||||||
sys.path.append('/home/pi/pialert/pialert')
|
sys.path.append('/home/pi/pialert/pialert')
|
||||||
|
|
||||||
from plugin_helper import Plugin_Object, Plugin_Objects
|
from plugin_helper import Plugin_Object, Plugin_Objects, handleEmpty
|
||||||
from logger import mylog
|
from logger import mylog
|
||||||
from dhcp_leases import DhcpLeases
|
from dhcp_leases import DhcpLeases
|
||||||
|
|
||||||
@@ -45,28 +45,28 @@ def get_entries(path, plugin_objects):
|
|||||||
row = line.rstrip().split()
|
row = line.rstrip().split()
|
||||||
if len(row) == 5:
|
if len(row) == 5:
|
||||||
plugin_objects.add_object(
|
plugin_objects.add_object(
|
||||||
primaryId=row[1],
|
primaryId = handleEmpty(row[1]),
|
||||||
secondaryId=row[2],
|
secondaryId = handleEmpty(row[2]),
|
||||||
watched1='True',
|
watched1 = handleEmpty('True'),
|
||||||
watched2=row[3],
|
watched2 = handleEmpty(row[3]),
|
||||||
watched3=row[4],
|
watched3 = handleEmpty(row[4]),
|
||||||
watched4='True',
|
watched4 = handleEmpty('True'),
|
||||||
extra=path,
|
extra = handleEmpty(path),
|
||||||
foreignKey=row[1]
|
foreignKey = handleEmpty(row[1])
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
leases = DhcpLeases(path)
|
leases = DhcpLeases(path)
|
||||||
leasesList = leases.get()
|
leasesList = leases.get()
|
||||||
for lease in leasesList:
|
for lease in leasesList:
|
||||||
plugin_objects.add_object(
|
plugin_objects.add_object(
|
||||||
primaryId=lease.ethernet,
|
primaryId = handleEmpty(lease.ethernet),
|
||||||
secondaryId=lease.ip,
|
secondaryId = handleEmpty(lease.ip),
|
||||||
watched1=lease.active,
|
watched1 = handleEmpty(lease.active),
|
||||||
watched2=lease.hostname,
|
watched2 = handleEmpty(lease.hostname),
|
||||||
watched3=lease.hardware,
|
watched3 = handleEmpty(lease.hardware),
|
||||||
watched4=lease.binding_state,
|
watched4 = handleEmpty(lease.binding_state),
|
||||||
extra=path,
|
extra = handleEmpty(path),
|
||||||
foreignKey=lease.ethernet
|
foreignKey = handleEmpty(lease.ethernet)
|
||||||
)
|
)
|
||||||
return plugin_objects
|
return plugin_objects
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ pialertConfigFile = read_config_file()
|
|||||||
timeZoneSetting = pialertConfigFile['TIMEZONE']
|
timeZoneSetting = pialertConfigFile['TIMEZONE']
|
||||||
timeZone = pytz.timezone(timeZoneSetting)
|
timeZone = pytz.timezone(timeZoneSetting)
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
def handleEmpty(input):
|
||||||
|
if input == '' or None:
|
||||||
|
return 'null'
|
||||||
|
else:
|
||||||
|
return input
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
def decodeBase64(inputParamBase64):
|
def decodeBase64(inputParamBase64):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user