50 lines
1.6 KiB
Text
50 lines
1.6 KiB
Text
For example, the following watch generates a report that contains the
|
|
*Error Monitoring* dashboard and emails the report every hour:
|
|
|
|
[source,js]
|
|
---------------------------------------------------------
|
|
PUT _xpack/watcher/watch/error_report
|
|
{
|
|
"trigger" : {
|
|
"schedule": {
|
|
"interval": "1h"
|
|
}
|
|
},
|
|
"actions" : {
|
|
"email_admin" : { <1>
|
|
"email": {
|
|
"to": "'Recipient Name <recipient@example.com>'",
|
|
"subject": "Error Monitoring Report",
|
|
"attachments" : {
|
|
"error_report.pdf" : {
|
|
"reporting" : {
|
|
"url": "http://0.0.0.0:5601/api/reporting/generate/dashboard/Error-Monitoring?_g=(time:(from:now-1d%2Fd,mode:quick,to:now))", <2>
|
|
"retries":6, <3>
|
|
"interval":"1s", <4>
|
|
"auth":{ <5>
|
|
"basic":{
|
|
"username":"elastic",
|
|
"password":"changeme"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
---------------------------------------------------------
|
|
// CONSOLE
|
|
|
|
<1> You must configure at least one email account to enable Watcher to send email.
|
|
For more information, see
|
|
{xpack-ref}/actions-email.html#configuring-email[Configuring Email Accounts].
|
|
<2> This is an example Generation URL. You can copy and paste the URL for any
|
|
report from the Kibana UI.
|
|
<3> Optional, default is 40
|
|
<4> Optional, default is 15s
|
|
<5> Provide user credentials for a user with permission to access Kibana and
|
|
{reporting}.
|
|
//For more information, see <<secure-reporting>>.
|
|
//<<reporting-app-users, Setting up a Reporting Role>>.
|