diff --git a/definitions/en_CA.js b/definitions/en_CA.js
index db5af321..8bec2844 100644
--- a/definitions/en_CA.js
+++ b/definitions/en_CA.js
@@ -2743,7 +2743,105 @@ module.exports = function(s,config,lang){
"default": "10",
"example": "",
"possible": ""
- }
+ },
+ {
+ "name": "detail=detector_notrigger_webhook",
+ "field": "Webhook",
+ "description": "Send a GET request to a URL with some values from the event.",
+ "default": "0",
+ "example": "",
+ "selector": "h_det_web_notrig",
+ "fieldType": "select",
+ "possible": [
+ {
+ "name": lang.No,
+ "value": "0"
+ },
+ {
+ "name": lang.Yes,
+ "value": "1"
+ }
+ ]
+ },
+ {
+ hidden: true,
+ "name": "detail=detector_notrigger_webhook_url",
+ "field": lang['Webhook URL'],
+ "description": "",
+ "default": "",
+ "example": "http://111.111.111.111?mid={{MONITOR_ID}}&group={{GROUP_KEY}}&confidence={{CONFIDENCE}}",
+ "form-group-class": "h_det_web_notrig_input h_det_web_notrig_1",
+ "possible": ""
+ },
+ {
+ "name": "detail=detector_notrigger_webhook_method",
+ "field": lang['Call Method'],
+ "description": "",
+ "default": "GET",
+ "example": "",
+ "form-group-class": "h_det_web_notrig_input h_det_web_notrig_1",
+ "fieldType": "select",
+ "possible": [
+ {
+ "name": `GET (${lang.Default})`,
+ "value": "GET"
+ },
+ {
+ "name": "PUT",
+ "value": "PUT"
+ },
+ {
+ "name": "POST",
+ "value": "POST"
+ }
+ ]
+ },
+ {
+ "name": "detail=detector_notrigger_command_timeout",
+ "field": lang['Allow Next Webhook'],
+ "description": "This value is a timer to allow the next running of your webhook. This value is in minutes.",
+ "default": "10",
+ "example": "",
+ "form-group-class": "h_det_web_notrig_input h_det_web_notrig_1",
+ "possible": ""
+ },
+ {
+ "name": "detail=detector_notrigger_command_enable",
+ "field": lang['Command on Trigger'],
+ "description": "",
+ "default": "0",
+ "example": "",
+ "selector": "h_det_com_notrig",
+ "fieldType": "select",
+ "possible": [
+ {
+ "name": lang.No,
+ "value": "0"
+ },
+ {
+ "name": lang.Yes,
+ "value": "1"
+ }
+ ]
+ },
+ {
+ "name": "detail=detector_notrigger_command",
+ "field": lang['Command'],
+ "description": "The command that will run. This is the equivalent of running a shell command from terminal.",
+ "default": "",
+ "form-group-class": "h_det_com_notrig_input h_det_com_notrig_1",
+ "example": "/home/script.sh {{MONITOR_ID}} {{GROUP_KEY}} {{CONFIDENCE}}",
+ "possible": ""
+ },
+ {
+ "name": "detail=detector_notrigger_command_timeout",
+ "field": lang['Allow Next Command'],
+ "description": "This value is a timer to allow the next running of your script. This value is in minutes.",
+ "default": "10",
+ "example": "",
+ "form-group-class": "h_det_com_notrig_input h_det_com_notrig_1",
+ "possible": ""
+ },
]
},
{
diff --git a/languages/en_CA.json b/languages/en_CA.json
index 2b968840..382edaa1 100644
--- a/languages/en_CA.json
+++ b/languages/en_CA.json
@@ -532,8 +532,9 @@
"Webhook URL": "Webhook URL",
"Command on Trigger": "Command on Trigger",
"Command": "Command",
- "Allow Next Command": "Allow Next Command in Minutes",
- "Allow Next Trigger": "Allow Next Trigger in Milliseconds",
+ "Allow Next Webhook": "Allow Next Webhook",
+ "Allow Next Command": "Allow Next Command",
+ "Allow Next Trigger": "Allow Next Trigger",
"Save Events to SQL": "Save Events to SQL",
"Email on Trigger": "Email on Trigger Emails go to the main account holder's login address.",
"Attach Video Clip": "Attach Video Clip",
diff --git a/libs/events.js b/libs/events.js
index c51b8c24..36c80a25 100644
--- a/libs/events.js
+++ b/libs/events.js
@@ -4,7 +4,7 @@ var exec = require('child_process').exec;
var spawn = require('child_process').spawn;
var request = require('request');
module.exports = function(s,config,lang){
- var addEventDetailsToString = function(eventData,string,addOps){
+ s.addEventDetailsToString = function(eventData,string,addOps){
//d = event data
if(!addOps)addOps = {}
var newString = string + ''
@@ -307,7 +307,7 @@ module.exports = function(s,config,lang){
})
if(filter.webhook && currentConfig.detector_webhook === '1'){
- var detector_webhook_url = addEventDetailsToString(d,currentConfig.detector_webhook_url)
+ var detector_webhook_url = s.addEventDetailsToString(d,currentConfig.detector_webhook_url)
var webhookMethod = currentConfig.detector_webhook_method
if(!webhookMethod || webhookMethod === '')webhookMethod = 'GET'
request(detector_webhook_url,{method: webhookMethod,encoding:null},function(err,data){
@@ -319,7 +319,7 @@ module.exports = function(s,config,lang){
if(filter.command && currentConfig.detector_command_enable === '1' && !s.group[d.ke].activeMonitors[d.id].detector_command){
s.group[d.ke].activeMonitors[d.id].detector_command = s.createTimeout('detector_command',s.group[d.ke].activeMonitors[d.id],currentConfig.detector_command_timeout,10)
- var detector_command = addEventDetailsToString(d,currentConfig.detector_command)
+ var detector_command = s.addEventDetailsToString(d,currentConfig.detector_command)
if(detector_command === '')return
exec(detector_command,{detached: true},function(err){
if(err)s.debugLog(err)
diff --git a/libs/monitor.js b/libs/monitor.js
index 2ae5e55f..acddda84 100644
--- a/libs/monitor.js
+++ b/libs/monitor.js
@@ -1219,8 +1219,28 @@ module.exports = function(s,config,lang){
s.setNoEventsDetector = function(e){
var monitorId = e.id || e.mid
var detector_notrigger_timeout = (parseFloat(e.details.detector_notrigger_timeout) || 10) * 1000 * 60
+ var currentConfig = s.group[e.ke].rawMonitorConfigurations[monitorId].details
clearInterval(s.group[e.ke].activeMonitors[monitorId].detector_notrigger_timeout)
s.group[e.ke].activeMonitors[monitorId].detector_notrigger_timeout = setInterval(function(){
+ if(currentConfig.detector_notrigger_webhook === '1' && !s.group[e.ke].activeMonitors[monitorId].detector_notrigger_webhook){
+ s.group[e.ke].activeMonitors[monitorId].detector_notrigger_webhook = s.createTimeout('detector_notrigger_webhook',s.group[e.ke].activeMonitors[monitorId],currentConfig.detector_notrigger_webhook_timeout,10)
+ var detector_notrigger_webhook_url = s.addEventDetailsToString(e,currentConfig.detector_notrigger_webhook_url)
+ var webhookMethod = currentConfig.detector_notrigger_webhook_method
+ if(!webhookMethod || webhookMethod === '')webhookMethod = 'GET'
+ request(detector_notrigger_webhook_url,{method: webhookMethod,encoding:null},function(err,data){
+ if(err){
+ s.userLog(d,{type:lang["Event Webhook Error"],msg:{error:err,data:data}})
+ }
+ })
+ }
+ if(currentConfig.detector_notrigger_command_enable === '1' && !s.group[e.ke].activeMonitors[monitorId].detector_notrigger_command){
+ s.group[e.ke].activeMonitors[monitorId].detector_notrigger_command = s.createTimeout('detector_notrigger_command',s.group[e.ke].activeMonitors[monitorId],currentConfig.detector_notrigger_command_timeout,10)
+ var detector_notrigger_command = s.addEventDetailsToString(e,currentConfig.detector_notrigger_command)
+ if(detector_notrigger_command === '')return
+ exec(detector_notrigger_command,{detached: true},function(err){
+ if(err)s.debugLog(err)
+ })
+ }
s.onDetectorNoTriggerTimeoutExtensions.forEach(function(extender){
extender(e)
})