Unable to create watch for reporting : Cannot parse attachment of type [reporting]

I am creating a watch to send dashboard report using mail action , but while running the PUT request I am getting an error as "Cannot parse attachment of type [reporting]"

Here is my simple watch which I am trying to post.

PUT _xpack/watcher/watch/test
{
  "trigger": {
    "schedule": {
      "interval": "1h"
    }
  },
  "input": {
    "simple": {
      "name": "Prashant"
    }
  },
  "actions": {
    "reminder_email": {
      "email": {
        "to": "test@gmail.com",
        "from": "test@gmail.com",
        "subject": "Alert : Test",
        "body": "Dear {{ctx.payload.name}}, Email Reporting sample test",
        "attachments": {
          "dashboard.pdf": {
            "reporting": {
              "url": "localhost:5601/api/reporting/generate/dashboard/IP-dashboard"
            }
          }
        }
      }
    }
  }
}

Any help on this would be highly appreciated.

Hey,

which Elasticsearch version are you using? Is it 5.1.1?

--Alex

Hi @spinscale:
I am using version 5.0.0

Hey,

reporting is only supported from version 5.1 on.

--Alex

I meant, the reporting attachment type in watcher, to be specific. Sorry for the confusion.

Thanks @spinscale : I will check the same with 5.1 version..

Just one more Q's , I used an older approach as :

PUT _watcher/watch/test
{
  "trigger" : {
    "schedule": {
      "interval": "1h"
    }
  },
  "actions" : {
  "email_admin" : { 
    "email": {
      "to": "'prashanttct07@gmail.com'",
      "subject": "Error Monitoring Report",
      "attachments" : {
        "error_report.pdf" : {
          "http" : {
            "content_type" : "application/pdf",
            "request" : {
              "method": "POST", 
              "headers": {
                "kbn-xsrf": "reporting"
              },
              "read_timeout": "300s", 
              "auth":{ 
                "basic":{
                  "username":"elastic",
                  "password":"changeme"
                }
              },
              "url": "http://0.0.0.0:5601/api/reporting/generate/dashboard/Dash01?_g=(time:(from:now-1d%2Fd,mode:quick,to:now))&sync" 
            }
          }
        }
      }
    }
  }
 }
}

So here also I am getting a failure with below error message.

"status": "failure",
          "reason": "Watch[test] attachment[error_report.pdf] HTTP error status host[52.31.61.200], port[5601], method[POST], path[/api/reporting/generate/dashboard/Dash01], status[401]"
        }  

So if possible can you let me know how I can get it working in 5.0.0, if I am not planning to upgrade for now.

Hey,

401 means an authorization error. Can you check if the credentials are correct and also ensure this works with curl on the command line?

--Alex

Yes, creds are correct as I logged in to Kibana with same credentials ...

Just to confirm here I have to give the same credentials which i used to login to kibana?

Also, do you see if any issue with the query ? As I rechecked and credentials are correct

Hey,

you should remove the sync parameter if you use the reporting action as well. Again, can you please make sure this works via curl with the same credentials? If the user is able to create a dashboard in the UI, then this call should work as well.

--Alex

So far I have not upgraded it to 5.1 and its running with 5.0.

So just curious if I can get it work with 5.0 it does not matters if it is reporting action or HTTP

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