diff --git a/front/plugins/pihole_scan/config.json b/front/plugins/pihole_scan/config.json index 5db7497c1..b4807106c 100755 --- a/front/plugins/pihole_scan/config.json +++ b/front/plugins/pihole_scan/config.json @@ -80,8 +80,8 @@ }, { "function": "CMD", - "type": "readonly", - "default_value":"SELECT hwaddr as Object_PrimaryID, cast('http://' || (SELECT ip FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC, ip LIMIT 1) as VARCHAR(100)) || ':' || cast( SUBSTR((SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC, ip LIMIT 1), 0, INSTR((SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC, ip LIMIT 1), '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, macVendor as Watched_Value1, lastQuery as Watched_Value2, (SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC, ip LIMIT 1) as Watched_Value3, 'null' as Watched_Value4, '' as Extra, hwaddr as ForeignKey FROM EXTERNAL_PIHOLE.network WHERE hwaddr NOT LIKE 'ip-%' AND hwaddr <> '00:00:00:00:00:00'; ", + "type": "text", + "default_value":"SELECT n.hwaddr AS Object_PrimaryID, 'null' AS Object_SecondaryID, datetime() AS DateTime, na.ip AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, {s-quote}null{s-quote} AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE {s-quote}ip-%{s-quote} AND n.hwaddr <> {s-quote}00:00:00:00:00:00{s-quote};", "options": [], "localized": ["name", "description"], "name" : [{ @@ -219,6 +219,19 @@ "string" : "MAC" }] }, + { + "column": "Object_SecondaryID", + "css_classes": "col-sm-2", + "show": false, + "type": "label", + "default_value":"", + "options": [], + "localized": ["name"], + "name":[{ + "language_code":"en_us", + "string" : "N/A" + }] + }, { "column": "Watched_Value1", "mapped_to_column": "cur_IP", @@ -265,6 +278,20 @@ "string" : "Name" }] }, + { + "column": "Watched_Value4", + "mapped_to_column": "cur_Vendor", + "css_classes": "col-sm-2", + "show": true, + "type": "label", + "default_value":"", + "options": [], + "localized": ["name"], + "name":[{ + "language_code":"en_us", + "string" : "Vendor" + }] + }, { "column": "Dummy", "mapped_to_column": "cur_ScanMethod", diff --git a/pialert/plugin.py b/pialert/plugin.py index b40acb600..6bf882873 100755 --- a/pialert/plugin.py +++ b/pialert/plugin.py @@ -358,13 +358,14 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ): else: mylog('none', ['[Plugins] Skipped invalid sql result']) - + # check if the subprocess / SQL query failed / there was no valid output if len(sqlParams) == 0: mylog('none', ['[Plugins] No output received from the plugin ', plugin["unique_prefix"], ' - enable LOG_LEVEL=debug and check logs']) return pluginsState else: mylog('verbose', ['[Plugins] SUCCESS, received ', len(sqlParams), ' entries']) + mylog('debug', ['[Plugins] sqlParam entries: ', sqlParams]) # process results if any if len(sqlParams) > 0: