Hi,
Setup: ES/Kibana 7.5.2
We are trying to configure automatic PDF report generation and sent to the email on a schedule.
The dashboard pdf works fine if we simply download it using Generate PDF option.
However when using the POST Url for the Dashboard in Watcher it throws the error
Here is the configuration of the Watch.
{
"trigger": {
"schedule": {
"interval": "1m"
}
},
"input": {
"none": {}
},
"condition": {
"always": {}
},
"actions": {
"email_admin": {
"email": {
"profile": "standard",
"attachments": {
"error_report.pdf": {
"reporting": {
"url": "http://NGINXIP/otwater/api/reporting/generate/printablePdf?jobParams=(browserTimezone:Asia%2FDubai,layout:(dimensions:(height:300,width:2066.45849609375),id:preserve_layout),objectType:visualization,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fvisualize%2Fedit%2F4019c4c0-8dad-11e9-96c9-bfdd3cee8fc8%3F_g%3D(filters:!!(),refreshInterval:(pause:!!t,value:0),time:(from:now-4d,to:now))%26_a%3D(filters:!!(),linked:!!f,query:(language:lucene,query:!%27!%27),uiState:(),vis:(aggs:!!(),params:(axis_formatter:number,axis_position:left,axis_scale:normal,background_color_rules:!!((id:b8fe36b0-8dac-11e9-9d4b-f52707f2360f)),bar_color_rules:!!((id:ca629360-8dac-11e9-9d4b-f52707f2360f)),default_index_pattern:!%27filebeat-*!%27,gauge_color_rules:!!((id:cf9d61c0-8dac-11e9-9d4b-f52707f2360f)),gauge_inner_width:10,gauge_style:half,gauge_width:10,id:!%2761ca57f0-469d-11e7-af02-69e470af7417!%27,index_pattern:!%27amialerts-*!%27,interval:auto,series:!!((axis_position:right,chart_type:line,color:%252368BC00,fill:0.5,formatter:number,id:!%2761ca57f1-469d-11e7-af02-69e470af7417!%27,line_width:1,metrics:!!((id:!%2761ca57f2-469d-11e7-af02-69e470af7417!%27,type:count)),point_size:1,separate_axis:0,split_color_mode:rainbow,split_mode:terms,stacked:none,terms_field:area.keyword)),show_grid:1,show_legend:1,time_field:cdate,type:timeseries),title:!%272019%2B-Training%2BTrend!%27,type:metrics))%27),title:%272019%20-Training%20Trend%27)",
"retries": 4,
"interval": "15s",
"auth": {
"basic": {
"username": "elastic",
"password": "::es_redacted::"
}
}
}
}
},
"to": [
"myemailaddress@company.com"
],
"subject": "Monitoring Report"
}
}
}
}
When i execute/simulate this, we get the following error
POST _watcher/watch/e833ed0e-31b8-40ce-8644-08835346f34b/_execute
{
"_id" : "e833ed0e-31b8-40ce-8644-08835346f34b_e8944eac-ed34-4c7c-8ee7-ad53286a7dca-2020-10-06T04:43:26.199964Z",
"watch_record" : {
"watch_id" : "e833ed0e-31b8-40ce-8644-08835346f34b",
"node" : "uhS6MPqkSjCmpKYpzS84Kw",
"state" : "executed",
"user" : "myuser",
"status" : {
"state" : {
"active" : true,
"timestamp" : "2020-10-06T04:42:13.405Z"
},
"last_checked" : "2020-10-06T04:43:26.199Z",
"last_met_condition" : "2020-10-06T04:43:26.199Z",
"actions" : {
"email_admin" : {
"ack" : {
"timestamp" : "2020-10-06T04:42:13.405Z",
"state" : "awaits_successful_execution"
},
"last_execution" : {
"timestamp" : "2020-10-06T04:43:26.199Z",
"successful" : false,
"reason" : ""
}
}
},
"execution_state" : "executed",
"version" : 1268
},
"trigger_event" : {
"type" : "manual",
"triggered_time" : "2020-10-06T04:43:26.199Z",
"manual" : {
"schedule" : {
"scheduled_time" : "2020-10-06T04:43:26.199Z"
}
}
},
"input" : {
"none" : { }
},
"condition" : {
"always" : { }
},
"metadata" : {
"name" : "UFW Automated Report",
"xpack" : {
"type" : "json"
}
},
"result" : {
"execution_time" : "2020-10-06T04:43:26.199Z",
"execution_duration" : 10,
"input" : {
"type" : "none",
"status" : "success",
"payload" : { }
},
"condition" : {
"type" : "always",
"status" : "success",
"met" : true
},
"actions" : [
{
"id" : "email_admin",
"type" : "email",
"status" : "failure",
"error" : {
"root_cause" : [
{
"type" : "exception",
"reason" : "Watch[e833ed0e-31b8-40ce-8644-08835346f34b] reporting[error_report.pdf] Error response when trying to trigger reporting generation host[NGINXIP], port[80] method[POST], path[/otwater/api/reporting/generate/printablePdf], status[301]"
}
],
"type" : "exception",
"reason" : "Watch[e833ed0e-31b8-40ce-8644-08835346f34b] reporting[error_report.pdf] Error response when trying to trigger reporting generation host[NGINXIP], port[80] method[POST], path[/otwater/api/reporting/generate/printablePdf], status[301]"
}
}
]
},
"messages" : [ ]
}
}
Any help would be highly appreciated.