sending alerts via mail from Sensu-server

Hi ,
I need to send alerts via mail from sensu server .

As per https://sensuapp.org/docs/0.12/adding_a_handler ,do in need to set up SMTP and then proceed .

or

According to latest doc https://sensuapp.org/docs/0.21/handlers ,there is only handler, in which mailx exists.

Please suggest which one to follow.

Thanks in advance

I recommend using the latest doc at first, and then moving onto

I also recommend taking
https://www.udemy.com/sensu-introduction/

Where I have a chapter dedicated to installing and configuring that
mail handler. Hopefully it can explain the hows/whys on this
procedure.

···

On Tue, Jan 12, 2016 at 5:59 AM, kumar kittu <dvrkittu@gmail.com> wrote:

Hi ,
I need to send alerts via mail from sensu server .

As per https://sensuapp.org/docs/0.12/adding_a_handler ,do in need to set up
SMTP and then proceed .

or

According to latest doc https://sensuapp.org/docs/0.21/handlers ,there is
only handler, in which mailx exists.

Please suggest which one to follow.

Thanks in advance

I agree. The sensu introduction course is really awesome!

···

On Jan 13, 2016, at 9:29 AM, Kyle Anderson <kyle@xkyle.com> wrote:

I recommend using the latest doc at first, and then moving onto
GitHub - sensu-plugins/sensu-plugins-mailer: This plugin is an email handler for Sensu.

I also recommend taking
https://www.udemy.com/sensu-introduction/

Where I have a chapter dedicated to installing and configuring that
mail handler. Hopefully it can explain the hows/whys on this
procedure.

On Tue, Jan 12, 2016 at 5:59 AM, kumar kittu <dvrkittu@gmail.com> wrote:

Hi ,
I need to send alerts via mail from sensu server .

As per https://sensuapp.org/docs/0.12/adding_a_handler ,do in need to set up
SMTP and then proceed .

or

According to latest doc https://sensuapp.org/docs/0.21/handlers ,there is
only handler, in which mailx exists.

Please suggest which one to follow.

Thanks in advance

Thanks Kyle

I cloned https://github.com/sensu-plugins/sensu-plugins-mailer and moved handler.mailer.rb into /etc/sensu/handlers

then created handler.mailer.json in /etc/sensu/conf.d

{

“handlers”: {

“mailer”: {

“type”: “pipe”,

“command”: “/etc/sensu/handlers/handler-mailer.rb”

}

}

}

And created mailer.json in /etc/sensu/conf.d as:

{

“mailer”: {

“mail_to”: “abc@gmail.com”,

“smtp_address”: “localhost”,

“smtp_port”: “25”,

“smtp_domain”: “localhost.localdomain”

}

}

When restarted sensu,I am seeing below error:

{“timestamp”:“2016-01-14T10:21:38.232976+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/usr/bin/env /etc/sensu/handlers/handler-mailer.rb”,“name”:“mailer”},“output”:["/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require’: cannot load such file – mail (LoadError)\n\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require’\n\tfrom /etc/sensu/handlers/handler-mailer.rb:18:in `'\nonly handling every 60 occurrences: "]}

Below things verified:

1.Installed plugins with /opt/sensu/embedded/bin/gem install sensu-plugins-mailer

2.set EMBEDDED_RUBY=true

3.ruby version is 2.2.4 from rvm

request you to suggest where i am getting wrong.

···

On Wednesday, January 13, 2016 at 8:59:58 PM UTC+5:30, Kyle Anderson wrote:

I recommend using the latest doc at first, and then moving onto
https://github.com/sensu-plugins/sensu-plugins-mailer

I also recommend taking
https://www.udemy.com/sensu-introduction/

Where I have a chapter dedicated to installing and configuring that
mail handler. Hopefully it can explain the hows/whys on this
procedure.

On Tue, Jan 12, 2016 at 5:59 AM, kumar kittu dvrk...@gmail.com wrote:

Hi ,
I need to send alerts via mail from sensu server .

As per https://sensuapp.org/docs/0.12/adding_a_handler ,do in need to set up
SMTP and then proceed .

or

According to latest doc https://sensuapp.org/docs/0.21/handlers ,there is
only handler, in which mailx exists.

Please suggest which one to follow.

Thanks in advance

Please watch and follow the training. In there I explain exactly why I
recommend the installation via the ruby gem (which you have done, but
you are not using the right path)
The training is free. It also includes show notes that include exactly
what commands I run
(https://github.com/solarkennedy/sensu-training/tree/master/introduction/lectures\)

Another reason why I encourage watching the training is that I explain
*why* I install things in a particular way (not via a github clone in
this case). This can be very helpful to new-commers, because often
commands that are copied and pasted come without context, and the user
may run a command trying to get something accomplished, but not
understand why they are doing it and what the effects actually are. In
the training I explain why we run things and what happens when we run
them.

Sometimes you can learn a lot more by watching someone do it than
exploring organically, and I encourage you to watch the training first
before continuing.

···

On Thu, Jan 14, 2016 at 2:35 AM, kumar kittu <dvrkittu@gmail.com> wrote:

Thanks Kyle

I cloned GitHub - sensu-plugins/sensu-plugins-mailer: This plugin is an email handler for Sensu. and moved
handler.mailer.rb into /etc/sensu/handlers
then created handler.mailer.json in /etc/sensu/conf.d

{
  "handlers": {
    "mailer": {
      "type": "pipe",
      "command": "/etc/sensu/handlers/handler-mailer.rb"
    }
  }
}
And created mailer.json in /etc/sensu/conf.d as:
{
  "mailer": {
    "mail_to": "abc@gmail.com",
    "smtp_address": "localhost",
    "smtp_port": "25",
    "smtp_domain": "localhost.localdomain"
  }
}

When restarted sensu,I am seeing below error:
{"timestamp":"2016-01-14T10:21:38.232976+0000","level":"info","message":"handler
output","handler":{"type":"pipe","command":"/usr/bin/env
/etc/sensu/handlers/handler-mailer.rb","name":"mailer"},"output":["/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
`require': cannot load such file -- mail (LoadError)\n\tfrom
/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
`require'\n\tfrom /etc/sensu/handlers/handler-mailer.rb:18:in `<main>'\nonly
handling every 60 occurrences: "]}

Below things verified:
1.Installed plugins with /opt/sensu/embedded/bin/gem install
sensu-plugins-mailer
2.set EMBEDDED_RUBY=true
3.ruby version is 2.2.4 from rvm

request you to suggest where i am getting wrong.

On Wednesday, January 13, 2016 at 8:59:58 PM UTC+5:30, Kyle Anderson wrote:

I recommend using the latest doc at first, and then moving onto
GitHub - sensu-plugins/sensu-plugins-mailer: This plugin is an email handler for Sensu.

I also recommend taking
https://www.udemy.com/sensu-introduction/

Where I have a chapter dedicated to installing and configuring that
mail handler. Hopefully it can explain the hows/whys on this
procedure.

On Tue, Jan 12, 2016 at 5:59 AM, kumar kittu <dvrk...@gmail.com> wrote:
> Hi ,
> I need to send alerts via mail from sensu server .
>
> As per https://sensuapp.org/docs/0.12/adding_a_handler ,do in need to
> set up
> SMTP and then proceed .
>
> or
>
> According to latest doc https://sensuapp.org/docs/0.21/handlers ,there
> is
> only handler, in which mailx exists.
>
> Please suggest which one to follow.
>
> Thanks in advance