Unable to generate reports using watcher

Hi All,

I created a watch for reporting and am getting this message when am executing it ,please do let me know what has to done

  "actions": [
    {
      "id": "email_admin",
      "type": "email",
      "status": "failure",
      "reason": "Watch[error_report] reporting[error_report.pdf] Error when polling pdf from host[x.x.x.x], port[5601], method[POST], path[/api/reporting/generate/visualization/eb9c4d90-47c8-11e7-99d5-bffffae7], status[200]"
    }
  ]
},
"messages": []

}

Please help me how to fix this issue
Thanks in advance,
Raj

hey,

can you share the full watch please?

--Alex

Hi Alex,

Thank you for the reply now i tried another elk machine

Iam trying to schedule a automatic report using watcher and I got email with pdf attachment ,but when is open it says fail to load and the same visualization ,i created a manual report using generated pdf and after some time it loads in to saved objects and I downloaded pdf and able to view the pdf ,

I used
PUT xpack/watcher/watch/cstest_report
{
"trigger" : {
"schedule": {
"interval": "1d"
}
},
"actions" : {
"email_admin" : {
"email": {
"to": "xx@xx",
"subject": "cs test report",
"attachments" : {
"cs_report.pdf" : {
"http" : {
"content_type" : "application/pdf",
"request" : {
"method": "POST",
"scheme": "http",
"headers": {
"kbn-xsrf": "reporting"
},
"auth": {
"basic": {
"username": "elastic",
"password": "xxxx"
}
},
"read_timeout": "300s",
"url": "http://localhost:5601/api/reporting/generate/dashboard/24dfe340-5742-11e7-ab3b-e7e9f2dfdcf8?_g=(refreshInterval:(display:Off,pause:!f,section:0,value:0),time:(from:now%2Fd,mode:quick,to:now%2Fd))&"
}
}
}
}
}
}
}
}

and I want to execute it so i used

POST xpack/watcher/watch/cstest_report/_execute
{
"record_execution": true
}

it will not even take time to load it comes immediately with

{
"id": "cstest_report_2f6a378f-a0ab-4de2-956c-131e6b4b6fbf-2017-06-29T13:38:04.278Z",
"watch_record": {
"watch_id": "cs_test_report",
"state": "executed",
"_status": {
"state": {
"active": true,
"timestamp": "2017-06-29T13:37:59.068Z"
},
"last_checked": "2017-06-29T13:38:04.278Z",
"last_met_condition": "2017-06-29T13:38:04.278Z",
"actions": {
"email_admin": {
"ack": {
"timestamp": "2017-06-29T13:38:04.278Z",
"state": "ackable"
},
"last_execution": {
"timestamp": "2017-06-29T13:38:04.278Z",
"successful": true
},
"last_successful_execution": {
"timestamp": "2017-06-29T13:38:04.278Z",
"successful": true
}
}
}
},
"trigger_event": {
"type": "manual",
"triggered_time": "2017-06-29T13:38:04.278Z",
"manual": {
"schedule": {
"scheduled_time": "2017-06-29T13:38:04.278Z"
}
}
},
"input": {
"none": {}
},
"condition": {
"always": {}
},
"result": {
"execution_time": "2017-06-29T13:38:04.278Z",
"execution_duration": 254,
"input": {
"type": "none",
"status": "success",
"payload": {}
},
"condition": {
"type": "always",
"status": "success",
"met": true
},
"actions": [
{
"id": "email_admin",
"type": "email",
"status": "success",
"email": {
"account": "standard_account",
"message": {
"id": "cs_test_report_2f6a378f-a0ab-4de2-956c-131e6b4b6fbf-2017-06-29T13:38:04.278Z",
"from": "xx@xx",
"sent_date": "2017-06-29T13:38:04.383Z",
"to": [
"xx@xx"
],
"subject": "cs test report"
}
}
}
]
},
"messages": []
}
}

I will receive an email and if i try to open it will say fail to load it , but if i go to saved objects i have all the list of generated automatic reports but I dont want to download it from kibana I want it to view from email.

Please help me to fix this issue.

Thanks in advance,
Raj

how does the file in the attachment look like? Is it zero sized?

Hi Alex,

No its 2.4 kb,but simultaneously if i go to generated reports in saved objects i could find the same pdf ,same size,and i tried manually downloading it ,I am able to open,but I want it automatic.

Thanks,
Raj

Hey,

after digging a bit I saw that this logline is misleading

"reason": "Watch[error_report] reporting[error_report.pdf] Error when polling pdf from host[x.x.x.x], port[5601], method[POST], path[/api/reporting/generate/visualization/eb9c4d90-47c8-11e7-99d5-bffffae7], status[200]"

the statusfield is actually not 200 (everything ok), but a 4xx error. Which means a client error, after the creation of the dashboard was triggered.

You can emulate the same behaviour that the reporting attachment is doing, by triggered the creation of a dashboard and then poll if it has been received, here is how:

curl -X POST -u user:pass --header "kbn-xsrf: reporting" "http://example.org:5601/path/to/dashboard

The above returns a JSON payload, that contains a a field called path - which is the new URI for to poll.

You can now issue the curl call above against the same URL and check the responses. Is there a 4xx error returned at some point?

Sorry for the lengthy description, but this is the only way to get down to the issue. I will improve the logging in the meantime.

Thanks a lot for your help and patience, greatly appreciated!

--Alex

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.