not getting mail using simple email handler

Hi,
I configure sensu server and added checks and all working fine but when I tried to add simple email handler to get email that is not working…
but not getting any error message on sensu_server.log but getting below error when I checked in maillog.

{
  "handlers": {
    "mail": {
      "type": "pipe",
      "command": "mail -s 'sensu event' xxxx@gmail.com"
    }
  }
}

postfix/error[32023]: D1D6ED112E: to=xxxxxx@gmail.com, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)

Appreciate your response!!

Thanks!!
Dherendra.

···

Hi. Seems you have wrong setup of postfix which actually received you message. And this is above functionality of this email handler to figure out suspend emails. Feel free to improve it to handle your special case. Generally you can try to use mailer.rb handler for such a case.

···

On Friday, April 25, 2014 8:17:13 AM UTC+2, dhersing wrote:

Hi,
I configure sensu server and added checks and all working fine but when I tried to add simple email handler to get email that is not working…
but not getting any error message on sensu_server.log but getting below error when I checked in maillog.

{
  "handlers": {
    "mail": {
      "type": "pipe",
      "command": "mail -s 'sensu event' xx...@gmail.com"
    }
  }
}

postfix/error[32023]: D1D6ED112E: to=xxx...@gmail.com, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)

Appreciate your response!!

Thanks!!
Dherendra.

I did not have any success with that either. I used this https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.json and this https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.rb and pointed that towards a mail server and it worked great (make sure you have the required gems installed).
Josh

···

On Friday, April 25, 2014 12:17:13 AM UTC-6, dhersing wrote:

Hi,
I configure sensu server and added checks and all working fine but when I tried to add simple email handler to get email that is not working…
but not getting any error message on sensu_server.log but getting below error when I checked in maillog.

{
  "handlers": {
    "mail": {
      "type": "pipe",
      "command": "mail -s 'sensu event' xx...@gmail.com"
    }
  }
}

postfix/error[32023]: D1D6ED112E: to=xxx...@gmail.com, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)

Appreciate your response!!

Thanks!!
Dherendra.

Thanks for reply!!..
Yes… I tried with mailer.rb handler through sensu-server and getting below output in log…

output",“handler”:{“type”:“pipe”,“command”:"/usr/local/bin/ruby /etc/sensu/handlers/mailer.rb",“name”:“mailer”},“output”:"\tfrom /etc/sensu/handlers/mailer.rb:13:in `’\n"}

So I tried to run directly…

ruby mailer.rb

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- sensu-handler (LoadError) from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:inrequire’
from mailer.rb:13:in `’

It seems it unable to load few requires…!!! and seems I am missing something in configurations!! :frowning: :frowning:

Please reply!!

Thanks!!

···

On Friday, April 25, 2014 6:12:15 PM UTC+5:30, Joshua Zitting wrote:

I did not have any success with that either. I used this https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.json and this https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.rb and pointed that towards a mail server and it worked great (make sure you have the required gems installed).
Josh

On Friday, April 25, 2014 12:17:13 AM UTC-6, dhersing wrote:

Hi,
I configure sensu server and added checks and all working fine but when I tried to add simple email handler to get email that is not working…
but not getting any error message on sensu_server.log but getting below error when I checked in maillog.

{
  "handlers": {
    "mail": {
      "type": "pipe",
      "command": "mail -s 'sensu event' xx...@gmail.com"
    }
  }
}

postfix/error[32023]: D1D6ED112E: to=xxx...@gmail.com, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)

Appreciate your response!!

Thanks!!
Dherendra.

To get mailer.rb working you can try using embedded Ruby.

Set EMBEDDED_RUBY=TRUE in: /etc/default/sensu

···

On Monday, April 28, 2014 10:44:19 AM UTC+1, dhersing wrote:

I did not have any success with that either. I used this https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.json and this https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.rb and pointed that towards a mail server and it worked great (make sure you have the required gems installed).
Josh

On Friday, April 25, 2014 12:17:13 AM UTC-6, dhersing wrote:

Hi,
I configure sensu server and added checks and all working fine but when I tried to add simple email handler to get email that is not working…
but not getting any error message on sensu_server.log but getting below error when I checked in maillog.

{
  "handlers": {
    "mail": {
      "type": "pipe",
      "command": "mail -s 'sensu event' xx...@gmail.com"
    }
  }
}

postfix/error[32023]: D1D6ED112E: to=xxx...@gmail.com, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)

Appreciate your response!!

Thanks!!
Dherendra.

Thanks for reply!!..
Yes… I tried with mailer.rb handler through sensu-server and getting below output in log…

output",“handler”:{“type”:“pipe”,“command”:"/usr/local/bin/ruby /etc/sensu/handlers/mailer.rb",“name”:“mailer”},“output”:"\tfrom /etc/sensu/handlers/mailer.rb:13:in `’\n"}

So I tried to run directly…

ruby mailer.rb

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- sensu-handler (LoadError) from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:inrequire’
from mailer.rb:13:in `’

It seems it unable to load few requires…!!! and seems I am missing something in configurations!! :frowning: :frowning:

Please reply!!

Thanks!!

On Friday, April 25, 2014 6:12:15 PM UTC+5:30, Joshua Zitting wrote:

For troubleshooting I find it easiest to use the embedded ruby directly:

/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/mailer.rb
(can't easily test handlers without passing json, plugins are easier to test)

Using the embedded sensu ruby is easy, especially if you cannot depend
on your local ruby installation being modern or having the right gems.

···

On Mon, Apr 28, 2014 at 5:51 AM, <j.a.edwards86@googlemail.com> wrote:

To get mailer.rb working you can try using embedded Ruby.

Set EMBEDDED_RUBY=TRUE in: /etc/default/sensu

On Monday, April 28, 2014 10:44:19 AM UTC+1, dhersing wrote:

Thanks for reply!!...
  Yes.. I tried with mailer.rb handler through sensu-server and getting
below output in log...

output","handler":{"type":"pipe","command":"/usr/local/bin/ruby
/etc/sensu/handlers/mailer.rb","name":"mailer"},"output":"\tfrom
/etc/sensu/handlers/mailer.rb:13:in `<main>'\n"}

So I tried to run directly...

# ruby mailer.rb

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in
`require': cannot load such file -- sensu-handler (LoadError)
        from
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from mailer.rb:13:in `<main>'

It seems it unable to load few requires.....!!! and seems I am missing
something in configurations!! :frowning: :frowning:

Please reply!!

Thanks!!

On Friday, April 25, 2014 6:12:15 PM UTC+5:30, Joshua Zitting wrote:

I did not have any success with that either. I used this
https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.json
and this
https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.rb
and pointed that towards a mail server and it worked great (make sure you
have the required gems installed).
Josh

On Friday, April 25, 2014 12:17:13 AM UTC-6, dhersing wrote:

Hi,
   I configure sensu server and added checks and all working fine but
when I tried to add simple email handler to get email that is not working...
  but not getting any error message on sensu_server.log but getting
below error when I checked in maillog.

{
  "handlers": {
    "mail": {
      "type": "pipe",
      "command": "mail -s 'sensu event' xx...@gmail.com"
    }
  }
}

postfix/error[32023]: D1D6ED112E: to=<xxx...@gmail.com>, relay=none,
delay=0.01, delays=0.01/0/0/0, dsn=4.4.3, status=deferred (delivery
temporarily suspended: Host or domain name not found. Name service error for
name=gmail.com type=MX: Host not found, try again)

Appreciate your response!!

Thanks!!
Dherendra.

Thanks @Kyle…but still didn’t get luck…I think problem could be in my gem…
please find my gem details…

RubyGems Environment:

  • RUBYGEMS VERSION: 2.2.2
  • RUBY VERSION: 1.9.3 (2014-02-24 patchlevel 545) [x86_64-linux]
  • INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1
  • RUBY EXECUTABLE: /usr/local/bin/ruby
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • SPEC CACHE DIRECTORY: /root/.gem/specs
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /usr/local/lib/ruby/gems/1.9.1
    • /root/.gem/ruby/1.9.1
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:
  • SHELL PATH:
    • /usr/bin/powervc-devtools
    • /home/pwrvcdb/sqllib/bin
    • /home/pwrvcdb/sqllib/adm
    • /home/pwrvcdb/sqllib/misc
    • /usr/lib64/qt-3.3/bin
    • /usr/local/sbin
    • /usr/local/bin
    • /sbin
    • /bin
    • /usr/sbin
    • /usr/bin
    • /usr/local/rvm/bin
    • /root/bin

gem list

*** LOCAL GEMS ***

bigdecimal (1.1.0)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.5)

Let me know if above has any problem or I need to upgrade/install some thing more!!

Thanks!!

···

On Tuesday, April 29, 2014 9:47:32 AM UTC+5:30, Kyle Anderson wrote:

For troubleshooting I find it easiest to use the embedded ruby directly:

/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/mailer.rb
(can’t easily test handlers without passing json, plugins are easier to test)

Using the embedded sensu ruby is easy, especially if you cannot depend
on your local ruby installation being modern or having the right gems.

On Mon, Apr 28, 2014 at 5:51 AM, j.a.ed...@googlemail.com wrote:

To get mailer.rb working you can try using embedded Ruby.

Set EMBEDDED_RUBY=TRUE in: /etc/default/sensu

On Monday, April 28, 2014 10:44:19 AM UTC+1, dhersing wrote:

Thanks for reply!!..
Yes… I tried with mailer.rb handler through sensu-server and getting
below output in log…

output",“handler”:{“type”:“pipe”,“command”:"/usr/local/bin/ruby
/etc/sensu/handlers/mailer.rb",“name”:“mailer”},“output”:"\tfrom
/etc/sensu/handlers/mailer.rb:13:in `’\n"}

So I tried to run directly…

ruby mailer.rb

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in
require': cannot load such file -- sensu-handler (LoadError) from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:inrequire’
from mailer.rb:13:in `’

It seems it unable to load few requires…!!! and seems I am missing
something in configurations!! :frowning: :frowning:

Please reply!!

Thanks!!

On Friday, April 25, 2014 6:12:15 PM UTC+5:30, Joshua Zitting wrote:

I did not have any success with that either. I used this
https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.json

and this
https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.rb

and pointed that towards a mail server and it worked great (make sure you
have the required gems installed).
Josh

On Friday, April 25, 2014 12:17:13 AM UTC-6, dhersing wrote:

Hi,
I configure sensu server and added checks and all working fine but
when I tried to add simple email handler to get email that is not working…
but not getting any error message on sensu_server.log but getting
below error when I checked in maillog.

{
“handlers”: {
“mail”: {
“type”: “pipe”,
“command”: “mail -s ‘sensu event’ xx...@gmail.com
}
}
}

postfix/error[32023]: D1D6ED112E: to=xxx...@gmail.com, relay=none,
delay=0.01, delays=0.01/0/0/0, dsn=4.4.3, status=deferred (delivery
temporarily suspended: Host or domain name not found. Name service error for
name=gmail.com type=MX: Host not found, try again)

Appreciate your response!!

Thanks!!
Dherendra.

Use Sensu's ruby for troubleshooting and running handlers.

Troubleshooting: /opt/sensu/embedded/bin/ruby (not system ruby or your
ruby in /usr/local/bin)

And set EMBEDDED_RUBY=TRUE in: /etc/default/sensu so Sensu uses that Ruby too.

···

On Thu, May 1, 2014 at 11:43 PM, dhersing <vision.dsin@gmail.com> wrote:

Thanks @Kyle..but still didn't get luck....I think problem could be in my
gem....
please find my gem details..

RubyGems Environment:
  - RUBYGEMS VERSION: 2.2.2
  - RUBY VERSION: 1.9.3 (2014-02-24 patchlevel 545) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/1.9.1
     - /root/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/bin/powervc-devtools
     - /home/pwrvcdb/sqllib/bin
     - /home/pwrvcdb/sqllib/adm
     - /home/pwrvcdb/sqllib/misc
     - /usr/lib64/qt-3.3/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /sbin
     - /bin
     - /usr/sbin
     - /usr/bin
     - /usr/local/rvm/bin
     - /root/bin
# gem list

*** LOCAL GEMS ***

bigdecimal (1.1.0)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.5)

Let me know if above has any problem or I need to upgrade/install some thing
more!!

Thanks!!

On Tuesday, April 29, 2014 9:47:32 AM UTC+5:30, Kyle Anderson wrote:

For troubleshooting I find it easiest to use the embedded ruby directly:

/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/mailer.rb
(can't easily test handlers without passing json, plugins are easier to
test)

Using the embedded sensu ruby is easy, especially if you cannot depend
on your local ruby installation being modern or having the right gems.

On Mon, Apr 28, 2014 at 5:51 AM, <j.a.ed...@googlemail.com> wrote:
> To get mailer.rb working you can try using embedded Ruby.
>
> Set EMBEDDED_RUBY=TRUE in: /etc/default/sensu
>
> On Monday, April 28, 2014 10:44:19 AM UTC+1, dhersing wrote:
>>
>> Thanks for reply!!...
>> Yes.. I tried with mailer.rb handler through sensu-server and getting
>> below output in log...
>>
>> output","handler":{"type":"pipe","command":"/usr/local/bin/ruby
>> /etc/sensu/handlers/mailer.rb","name":"mailer"},"output":"\tfrom
>> /etc/sensu/handlers/mailer.rb:13:in `<main>'\n"}
>>
>> So I tried to run directly...
>>
>> # ruby mailer.rb
>>
>>
>> /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in
>> `require': cannot load such file -- sensu-handler (LoadError)
>> from
>>
>> /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in
>> `require'
>> from mailer.rb:13:in `<main>'
>>
>>
>> It seems it unable to load few requires.....!!! and seems I am missing
>> something in configurations!! :frowning: :frowning:
>>
>> Please reply!!
>>
>> Thanks!!
>>
>> On Friday, April 25, 2014 6:12:15 PM UTC+5:30, Joshua Zitting wrote:
>>>
>>> I did not have any success with that either. I used this
>>>
>>> https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.json
>>> and this
>>>
>>> https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.rb
>>> and pointed that towards a mail server and it worked great (make sure
>>> you
>>> have the required gems installed).
>>> Josh
>>>
>>> On Friday, April 25, 2014 12:17:13 AM UTC-6, dhersing wrote:
>>>>
>>>> Hi,
>>>> I configure sensu server and added checks and all working fine but
>>>> when I tried to add simple email handler to get email that is not
>>>> working...
>>>> but not getting any error message on sensu_server.log but getting
>>>> below error when I checked in maillog.
>>>>
>>>> {
>>>> "handlers": {
>>>> "mail": {
>>>> "type": "pipe",
>>>> "command": "mail -s 'sensu event' xx...@gmail.com"
>>>> }
>>>> }
>>>> }
>>>>
>>>>
>>>>
>>>> postfix/error[32023]: D1D6ED112E: to=<xxx...@gmail.com>, relay=none,
>>>> delay=0.01, delays=0.01/0/0/0, dsn=4.4.3, status=deferred (delivery
>>>> temporarily suspended: Host or domain name not found. Name service
>>>> error for
>>>> name=gmail.com type=MX: Host not found, try again)
>>>>
>>>> Appreciate your response!!
>>>>
>>>> Thanks!!
>>>> Dherendra.
>>>>
>>>>