{
    "code_name": "website_monitor",
    "unique_prefix": "WEBMON",
    "plugin_type": "other",
    "enabled": true,    
    "data_source":  "script",
    "show_ui": true,
    "localized": ["display_name", "description", "icon"],
	"display_name" : [{
		  "language_code": "en_us",
		  "string" : "Website monitor"
		},
		{
		  "language_code": "es_es",
		  "string" : "Monitor de sitio web"
		}],
    "icon":[{
        "language_code": "en_us",
        "string" : "<i class=\"fa-solid fa-globe\"></i>"
		},
		{
		"language_code": "es_es",
        "string" : "<i class=\"fa-solid fa-globe\"></i>"
		}],     
    "description": [{
        "language_code": "en_us",
        "string" : "This plugin is to monitor status changes of services or websites."
		},
		{
		"language_code": "es_es",
        "string" : "Este complemento es para monitorear los cambios de estado de los servicios o sitios web."
    }],
    "params" : [{
        "name"  : "macs",
        "type"  : "sql",
        "value" : "SELECT dev_MAC from DEVICES"
    },
    {
        "name"  : "urls",
        "type"  : "setting",
        "value" : "WEBMON_urls_to_check"
    },
    {
        "name"  : "internet_ip",
        "type"  : "setting",
        "value" : "WEBMON_SQL_internet_ip"
    }],  
    "database_column_definitions":
    [          
        {
            "column": "Index",
            "css_classes": "col-sm-2",
            "show": false,
            "type": "label",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "N/A"
				},
				{
                "language_code": "es_es",
                "string" : "N/A"					
                }]
        },
        {
            "column": "Plugin",
            "css_classes": "col-sm-2",
            "show": false,
            "type": "label",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "N/A"
				},
				{
                "language_code": "es_es",
                "string" : "N/A"					
                }]
        },
        {
            "column": "Object_PrimaryID",
            "css_classes": "col-sm-2",
            "show": true,
            "type": "url",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "Monitored URL"
				},
				{
                "language_code": "es_es",
                "string" : "URL monitoreada"					
                }]
        },
        {
            "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"
				},
				{
                "language_code": "es_es",
                "string" : "N/A"					
                }]
        },
        {
            "column": "DateTimeCreated",
            "css_classes": "col-sm-2",
            "show": true,
            "type": "label",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "Created"
				},
				{
                "language_code": "es_es",
                "string" : "Creado"					
                }]
        },
        {
            "column": "DateTimeChanged",
            "css_classes": "col-sm-2",
            "show": true,
            "type": "label",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "Changed"
				},
				{
                "language_code": "es_es",
                "string" : "Cambiado"					
                }]
        },
        {
            "column": "Watched_Value1",
            "css_classes": "col-sm-2",
            "show": true,
            "type": "threshold",            
            "default_value":"",
            "options": [
                {
                    "maximum": 199,
                    "hexColor": "#792D86"                
                },
                {
                    "maximum": 299,
                    "hexColor": "#5B862D"
                },
                {
                    "maximum": 399,
                    "hexColor": "#7D862D"
                },
                {
                    "maximum": 499,
                    "hexColor": "#BF6440"
                },
                {
                    "maximum": 599,
                    "hexColor": "#D33115"
                }
            ],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "Status code"
				},
				{
                "language_code": "es_es",
                "string" : "Código de estado"					
                }]
        },
        {
            "column": "Watched_Value2",
            "css_classes": "col-sm-2",
            "show": true,
            "type": "label",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "Latency"
				},
				{
                "language_code": "es_es",
                "string" : "Latencia"					
                }]
        },
        {
            "column": "Watched_Value3",
            "css_classes": "col-sm-2",
            "show": false,
            "type": "label",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "N/A"
				},
				{
                "language_code": "es_es",
                "string" : "N/A"					
                }]
        },
        {
            "column": "Watched_Value4",
            "css_classes": "col-sm-2",
            "show": false,
            "type": "label",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "N/A"
				},
				{
                "language_code": "es_es",
                "string" : "N/A"					
                }]
        },       
        {
            "column": "UserData",
            "css_classes": "col-sm-2",
            "show": true,
            "type": "textbox_save",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "Comments"
				},
				{
                "language_code": "es_es",
                "string" : "Comentarios"					
                }]
        },        
        {
            "column": "Status",
            "css_classes": "col-sm-1",
            "show": true,
            "type": "replace",            
            "default_value":"",
            "options": [
                {
                    "equals": "watched-not-changed",
                    "replacement": "<div style='text-align:center'><i class='fa-solid fa-square-check'></i><div></div>"
                },
                {
                    "equals": "watched-changed",
                    "replacement": "<div style='text-align:center'><i class='fa-solid fa-triangle-exclamation'></i></div>"
                },
                {
                    "equals": "new",
                    "replacement": "<div style='text-align:center'><i class='fa-solid fa-circle-plus'></i></div>"
                },
                {
                    "equals": "missing-in-last-scan",
                    "replacement": "<div style='text-align:center'><i class='fa-solid fa-question'></i></div>"
                }
            ],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "Status"
				},
				{
                "language_code": "es_es",
                "string" : "Estado"					
                }]
        },        
        {
            "column": "Extra",
            "css_classes": "col-sm-3",
            "show": false,
            "type": "label",            
            "default_value":"",
            "options": [],
            "localized": ["name"],
            "name":[{
                "language_code": "en_us",
                "string" : "Extra"
				},
				{
                "language_code": "es_es",
                "string" : "Extra"					
                }]
        }            
    ],
    "settings":[
        {
            "function": "RUN",         
            "events": ["run"],   
            "type": "text.select",            
            "default_value":"disabled",
            "options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
            "localized": ["name", "description"],
            "name" :[{
                "language_code": "en_us",
                "string" : "When to run"
				},
				{
                "language_code": "es_es",
                "string" : "Cuando ejecuta"
            }],
            "description": [{
                "language_code": "en_us",
                "string" : "Enable a regular scan of your services. If you select <code>schedule</code> the scheduling settings from below are applied. If you select <code>once</code> the scan is run only once on start of the application (container) for the time specified in <a href=\"#WEBMON_RUN_TIMEOUT\"><code>WEBMON_RUN_TIMEOUT</code> setting</a>."
				},
				{
                "language_code": "es_es",
                "string" : "Habilite un escaneo regular de sus servicios. Si selecciona <code>schedule</code>, se aplican las configuraciones de programación de abajo. Si selecciona <code>once</code>, el escaneo se ejecuta solo una vez al iniciar la aplicación (contenedor) durante el tiempo especificado en <a href=\"#WEBMON_RUN_TIMEOUT\"><code>WEBMON_RUN_TIMEOUT</code> configuración</a>."
            }]
        },
        {
            "function": "CMD",
            "type": "text",
            "default_value":"python3 /app/front/plugins/website_monitor/script.py urls={urls}",
            "options": [],
            "localized": ["name", "description"],
            "name" : [{
                "language_code": "en_us",
                "string" : "Command"
				},
				{
                "language_code": "es_es",
                "string" : "Comando"						
            }],
            "description": [{
                "language_code": "en_us",
                "string" : "Command to run"
				},
				{
                "language_code": "es_es",
                "string" : "Comando a ejecutar"	
            }]
        },
        {
            "function": "RUN_SCHD",
            "type": "text",
            "default_value":"0 2 * * *",
            "options": [],
            "localized": ["name", "description"],
            "name" : [{
                "language_code": "en_us",
                "string" : "Schedule"
				},
				{
                "language_code": "es_es",
                "string" : "Schedule"
				}],
				"description": [{
                "language_code": "en_us",
                "string" : "Only enabled if you select <code>schedule</code> in the <a href=\"#WEBMON_RUN\"><code>WEBMON_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
				},
				{
                "language_code": "es_es",
                "string": "Solo habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#WEBMON_RUN\"><code>WEBMON_RUN</code></a>. Asegúrese de ingresar el schedule en el formato similar a cron correcto (por ejemplo, valide en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, ingrese <code >0 4 * * *</code> ejecutará el escaneo después de las 4 am en el <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> que configuró arriba </a>. Se ejecutará la PRÓXIMA vez que pase el tiempo."
            }]
        },
        {
            "function": "API_SQL",
            "type": "text",
            "default_value":"SELECT * FROM plugin_website_monitor",
            "options": [],
            "localized": ["name", "description"],
            "name" : [{
                "language_code": "en_us",
                "string" : "API endpoint (not implemented)"
				},
				{
                "language_code": "es_es",
                "string" : "Punto de conexión de la API (no implementado)"				
            }],
            "description": [{
                "language_code": "en_us",
                "string" : "You can specify a custom SQL query which will generate a JSON file and then expose it via the <a href=\"/api/plugin_website_monitor.json\" target=\"_blank\"><code>plugin_website_monitor.json</code> file endpoint</a>."
				},
				{
                "language_code": "es_es",
                "string" : "Puede especificar una consulta SQL personalizada que generará un archivo JSON y luego lo expondrá a través de <a href=\"/api/plugin_website_monitor.json\" target=\"_blank\"><code>plugin_website_monitor.json</code> punto final del archivo</a>."					
            }]            
        },
        {
            "function": "RUN_TIMEOUT",
            "type": "integer",
            "default_value":5,
            "options": [],
            "localized": ["name", "description"],
            "name" : [{
                "language_code": "en_us",
                "string" : "Run timeout"
				},
				{
                "language_code": "es_es",
                "string" : "Tiempo de espera de ejecución"				
				},
				{
                "language_code": "de_de",
                "string" : "Wartezeit"
            }],
            "description": [{
                "language_code": "en_us",
                "string" : "Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted."
				},
				{
                "language_code": "es_es",
                "string" : "Tiempo máximo en segundos para esperar a que finalice el script. Si se supera este tiempo, el script se cancela."
            }]
        },
        {
            "function": "WATCH",
            "type": "text.multiselect",
            "default_value":["Watched_Value1"],
            "options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
            "localized": ["name", "description"],
            "name" :[{
                "language_code": "en_us",
                "string" : "Watched"
				},
				{
                "language_code": "es_es",
                "string" : "Visto"				
            }],
            "description":[{
                "language_code": "en_us",
                "string" : "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is response status code (e.g.: 200, 404)</li><li><code>Watched_Value2</code> is Latency (not recommended)</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> unused </li></ul>"
				},
				{
                "language_code": "es_es",
                "string" : "Envíe una notificación si los valores seleccionados cambian. Use <code>CTRL + Click</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es un código de estado de respuesta (por ejemplo: 200, 404) </li><li><code>Valor_observado2</code> es Latencia (no recomendado)</li><li><code>Valor_observado3</code> no utilizado </li><li><code>Valor_observado4 </ code> sin usar </li></ul>"				
            }] 
        },
        {
            "function": "REPORT_ON",
            "type": "text.multiselect",
            "default_value":["new","watched-changed"],
            "options": ["new","watched-changed","watched-not-changed", "missing-in-last-scan"],
            "localized": ["name", "description"],
            "name" :[{
                "language_code": "en_us",
                "string" : "Report on"
				},
				{
                "language_code": "es_es",
                "string" : "Informar sobre"					
            }] ,
            "description":[{
                "language_code": "en_us",
                "string" : "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed."
				},
				{
                "language_code": "es_es",
                "string" : "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que seleccionó <code>Watched_ValueN Las columnas </code> cambiaron."					
            }] 
        },
        {
            "function": "urls_to_check",
            "type": "list",
            "default_value":["https://google.com", "https://duck.com"],
            "options": [],
            "localized": ["name", "description"],
            "name" : [{
                "language_code": "en_us",
                "string" : "Arguments"
				},
				{
                "language_code": "es_es",
                "string" : "Argumentos"					
            }],
            "description": [{
                "language_code": "en_us",
                "string" : "Services to watch. Enter full URL, e.g. <code>https://google.com</code>. The values from this setting will be used to replace the <code>{urls}</code> wildcard in the <code>WEBMON_CMD</code> setting."
				},
				{
                "language_code": "es_es",
                "string" : "Servicios para ver. Ingrese la URL completa, por ejemplo, <code>https://google.com</code>. Los valores de esta configuración se usarán para reemplazar el comodín <code>{urls}</code> en la configuración < code>WEBMON_CMD</code>."					
            }]
        },
        {
            "function": "SQL_internet_ip",
            "type": "readonly",
            "default_value":"SELECT dev_LastIP FROM Devices WHERE dev_MAC = 'Internet'",
            "options": [],
            "localized": ["name", "description"],
            "name" : [{
                "language_code": "en_us",
                "string" : "Helper variable"
				},
				{
                "language_code": "es_es",
                "string" : "Variable de ayuda"					
            }],
            "description": [{
                "language_code": "en_us",
                "string" : "Unused setting - for demonstration only. Getting the IP address of the Router / Internet."
				},
				{
                "language_code": "es_es",
                "string" : "Configuración no utilizada: solo para demostración. Obtener la dirección IP del enrutador / Internet."				
            }]
        }

    ]
}
