{ "code_name": "website_monitor", "unique_prefix": "WEBMON", "enabled": true, "data_source": "python-script", "localized": ["display_name", "description", "icon"], "display_name" : [{ "language_code":"en_us", "string" : "Website monitor" }], "icon":[{ "language_code":"en_us", "string" : "" }], "description": [{ "language_code":"en_us", "string" : "This plugin is to monitor status changes of services or websites." }], "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" }] } , { "column": "Plugin", "css_classes": "col-sm-2", "show": false, "type": "label", "default_value":"", "options": [], "localized": ["name"], "name":[{ "language_code":"en_us", "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" }] }, { "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": "DateTimeCreated", "css_classes": "col-sm-2", "show": true, "type": "label", "default_value":"", "options": [], "localized": ["name"], "name":[{ "language_code":"en_us", "string" : "Created" }] }, { "column": "DateTimeChanged", "css_classes": "col-sm-2", "show": true, "type": "label", "default_value":"", "options": [], "localized": ["name"], "name":[{ "language_code":"en_us", "string" : "Changed" }] }, { "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" }] }, { "column": "Watched_Value2", "css_classes": "col-sm-2", "show": true, "type": "label", "default_value":"", "options": [], "localized": ["name"], "name":[{ "language_code":"en_us", "string" : "Latency" }] }, { "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" }] } , { "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" }] } , { "column": "UserData", "css_classes": "col-sm-2", "show": true, "type": "textboxsave", "default_value":"", "options": [], "localized": ["name"], "name":[{ "language_code":"en_us", "string" : "Comments" }] }, { "column": "Status", "css_classes": "col-sm-1", "show": true, "type": "replace", "default_value":"", "options": [ { "equals": "watched-not-changed", "replacement": "
schedule the scheduling settings from below are applied. If you select once the scan is run only once on start of the application (container) for the time specified in WEBMON_RUN_TIMEOUT setting."
}]
},
{
"function": "CMD",
"type": "text",
"default_value":"python3 /home/pi/pialert/front/plugins/website_monitor/script.py urls={urls}",
"options": [],
"localized": ["name", "description"],
"name" : [{
"language_code":"en_us",
"string" : "Command"
}],
"description": [{
"language_code":"en_us",
"string" : "Command to run"
}]
},
{
"function": "RUN_SCHD",
"type": "text",
"default_value":"0 2 * * *",
"options": [],
"localized": ["name", "description"],
"name" : [{
"language_code":"en_us",
"string" : "Schedule"
}],
"description": [{
"language_code":"en_us",
"string" : "Only enabled if you select schedule in the WEBMON_RUN setting. Make sure you enter the schedule in the correct cron-like format (e.g. validate at crontab.guru). For example entering 0 4 * * * will run the scan after 4 am in the TIMEZONE you set above. Will be run NEXT time the time passes."
}]
},
{
"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)"
}],
"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 plugin_website_monitor.json file endpoint."
}]
},
{
"function": "RUN_TIMEOUT",
"type": "integer",
"default_value":5,
"options": [],
"localized": ["name", "description"],
"name" : [{
"language_code":"en_us",
"string" : "Run timeout"
},
{
"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."
}]
},
{
"function": "WATCH",
"type": "multiselect",
"default_value":["Watched_Value1"],
"options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
"localized": ["name", "description"],
"name" :[{
"language_code":"en_us",
"string" : "Watched"
}] ,
"description":[{
"language_code":"en_us",
"string" : "Send a notification if selected values change. Use CTRL + Click to select/deselect. Watched_Value1 is response status code (e.g.: 200, 404)Watched_Value2 is Latency (not recommended)Watched_Value3 unused Watched_Value4 unused new means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. watched-changed means that selected Watched_ValueN columns changed."
}]
},
{
"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"
}],
"description": [{
"language_code":"en_us",
"string" : "Services to watch. Enter full URL, e.g. https://google.com. The values from this setting will be used to replace the {urls} wildcard in the WEBMON_CMD setting."
}]
},
{
"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"
}],
"description": [{
"language_code":"en_us",
"string" : "Unused setting - for demonstration only. Getting the IP address of the Router / Internet. "
}]
}
]
}