How to read email ids stored in database table and send alert emails through watcher?


I have a requirement where I have to send alerts to multiple email IDs stored in a sql server table. I have tested Watcher to send out alerts via email but not able to configure it for email IDs stored in table.

I have explored we can use script for dynamic values and we can store the values in elasticsearch as well but struggling to implement it for my requirement.
If anybody has implemented a similar requirement or can suggest any solution that would be a great help!!

One more point to add, if there are multiple alerts for a single contact in last 15 mins I want to send him alert once rather than multiple times.

Thanks in advance!


as you wrote: you cannot access an SQL table in Elasticsearch, so you need a mechanism to sync those email addresses over to elasticsearch (or just hardcode them in watch for testing). Each watch can have a recipient configured in the email action, that will be an email address.

If you have problems with writing a watch, please be more specific where the exact problem is.


Hi Alex,

Thanks for your reply.

Problem is I cannot store contact email IDs (business constraints) in elasticsearch and I have to read it from SQL Server db table. Can you please suggest how can I do this in Watcher?

I have tested Watcher for sending out alerts to specific email IDs and it is working fine.


There is not possibility to directly access an SQL server via watcher. However if you SQL server has an HTTP interface, you could use an HTTP Input to get it.

Is it not possible to use any script like Painless or Groovy in the Watcher to access SQL Server database tables?

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