From 1cbbfb25cc4d801906aed6ce3f78a5742ef886c9 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sun, 26 Feb 2023 12:59:23 +1100 Subject: [PATCH] Plugins 0.3 - Readme 0.2 --- front/plugins/README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/front/plugins/README.md b/front/plugins/README.md index ef7b4b9f..29384373 100755 --- a/front/plugins/README.md +++ b/front/plugins/README.md @@ -88,6 +88,28 @@ https://www.google.com|null|2023-01-02 15:56:30|200|0.7898| If the datasource is set to `pialert-db-query` the `CMD` setting needs to contain a SQL query rendering the columns as defined in the "Column order and values" section above. The order of columns is important. +#### Examples + +SQL query example: + +```SQL +SELECT dv.dev_Name as Object_PrimaryID, + cast(dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID, + datetime() as DateTime, + ns.Service as Watched_Value1, + ns.State as Watched_Value2, + 'null' as Watched_Value3, + 'null' as Watched_Value4, + ns.Extra as Extra +FROM + (SELECT * FROM Nmap_Scan) ns +LEFT JOIN + (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv +ON ns.MAC = dv.dev_MAC +``` + +Required `CMD` setting example with above query (you can set `"type": "label"` if you want it to make uneditable in the UI): + ```json { "function": "CMD", @@ -184,8 +206,6 @@ Example: ``` ##### Localized strings - - - `"language_code":""` - code name of the language string. Only these three currently supported. At least the `"language_code":"en_us"` variant has to be defined. - `"string"` - The string to be displayed in the given language.