Add Event Webhook Method, Add debugLog for Command on Event
parent
9d05ff8e59
commit
588d536580
|
|
@ -2335,6 +2335,30 @@ module.exports = function(s,config,lang){
|
|||
"form-group-class-pre-layer": "h_det_input h_det_1",
|
||||
"possible": ""
|
||||
},
|
||||
{
|
||||
"name": "detail=detector_webhook_method",
|
||||
"field": lang['Call Method'],
|
||||
"description": "",
|
||||
"default": "GET",
|
||||
"example": "",
|
||||
"form-group-class": "h_det_web_input h_det_web_1",
|
||||
"form-group-class-pre-layer": "h_det_input h_det_1",
|
||||
"fieldType": "select",
|
||||
"possible": [
|
||||
{
|
||||
"name": `GET (${lang.Default})`,
|
||||
"value": "GET"
|
||||
},
|
||||
{
|
||||
"name": "PUT",
|
||||
"value": "PUT"
|
||||
},
|
||||
{
|
||||
"name": "POST",
|
||||
"value": "POST"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "detail=detector_command_enable",
|
||||
"field": lang['Command on Trigger'],
|
||||
|
|
|
|||
|
|
@ -315,7 +315,9 @@ module.exports = function(s,config,lang){
|
|||
|
||||
if(filter.webhook && currentConfig.detector_webhook === '1'){
|
||||
var detector_webhook_url = addEventDetailsToString(d,currentConfig.detector_webhook_url)
|
||||
request({url:detector_webhook_url,method:'GET',encoding:null},function(err,data){
|
||||
var webhookMethod = currentConfig.detector_webhook_method
|
||||
if(!webhookMethod || webhookMethod === '')webhookMethod = 'GET'
|
||||
request(detector_webhook_url,{method:'GET',encoding:null},function(err,data){
|
||||
if(err){
|
||||
s.userLog(d,{type:lang["Event Webhook Error"],msg:{error:err,data:data}})
|
||||
}
|
||||
|
|
@ -326,7 +328,9 @@ module.exports = function(s,config,lang){
|
|||
s.group[d.ke].activeMonitors[d.id].detector_command = s.createTimeout(s.group[d.ke].activeMonitors[d.id].detector_command,currentConfig.detector_command_timeout,10)
|
||||
var detector_command = addEventDetailsToString(d,currentConfig.detector_command)
|
||||
if(detector_command === '')return
|
||||
exec(detector_command,{detached: true})
|
||||
exec(detector_command,{detached: true},function(err){
|
||||
if(err)s.debugLog(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
//show client machines the event
|
||||
|
|
|
|||
Loading…
Reference in New Issue