sensu-plugins / sensu-plugins-mailer

This plugin is an email handler for Sensu.
http://sensu-plugins.io
MIT License
17 stars 37 forks source link

handler-mailer.rb with Office365 - 504 5.7.4 Unrecognized authentication type #66

Open MisterDeeds opened 6 years ago

MisterDeeds commented 6 years ago

handler-mailer.rb with Office365 - 504 5.7.4 Unrecognized authentication type

Hello everybody

I'm trying to connect the handler-mailer plugin with Office365. Unfortunately, the following error message always appears:

{"timestamp":"2018-02-18T18:19:01.319729+0100","level":"error","message":"handler output","handler":{"type":"pipe","command":"/opt/sensu/embedded/bin/handler-mailer.rb","name":"mailer"},"event":{"id":"7698933b-981e-4793-80f8-7a1a091d4df8"},"output":["/opt/sensu/embedded/lib/ruby/2.4.0/net/smtp.rb:981:incheck_auth_response': 504 5.7.4 Unrecognized authentication type [VI1P195CA0020.EURP195.PROD.OUTLOOK.COM] (Net::SMTPAuthenticationError)\n\tfrom /opt/sensu/embedded/lib/ruby/2.4.0/net/smtp.rb:736:in auth_plain'\n\tfrom /opt/sensu/embedded/lib/ruby/2.4.0/net/smtp.rb:728:inauthenticate'\n\tfrom /opt/sensu/embedded/lib/ruby/2.4.0/net/smtp.rb:565:in do_start'\n\tfrom /opt/sensu/embedded/lib/ruby/2.4.0/net/smtp.rb:518:instart'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in deliver!'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mail-2.6.3/lib/mail/message.rb:2141:indo_delivery'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mail-2.6.3/lib/mail/message.rb:238:in deliver'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mail-2.6.3/lib/mail/mail.rb:140:indeliver'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-mailer-2.0.1/bin/handler-mailer.rb:272:in block in handle'\n\tfrom /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:93:inblock in timeout'\n\tfrom /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:33:in block in catch'\n\tfrom /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:33:incatch'\n\tfrom /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:33:in catch'\n\tfrom /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:108:intimeout'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-mailer-2.0.1/bin/handler-mailer.rb:271:in handle'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-1.4.5/lib/sensu-handler.rb:99:inblock in '\nwarning: event filtering in sensu-plugin is deprecated, see http://bit.ly/sensu-plugin\nwarning: occurrence filtering in sensu-plugin is deprecated, see http://bit.ly/sensu-plugin\n"]}`

This is my handler.json config file

{
    "mailer" :  {
        "admin_gui" : "https://monitoring.xyz.com:8080",
        "mail_from": "no-reply@xyz.com",
        "mail_to": [
            "user1@xyz.com",
            "user2@xyz.com"
        ],
        "delivery_method": "smtp",
        "authentication": "login",
        "smtp_enable_starttls_auto": "true",
        "smtp_address": "smtp.office365.com",
        "smtp_port": "587",
        "smtp_domain": "office365.com",
        "smtp_username" : "no-reply@xyz.com",
        "smtp_password" : "XXXXXXXXX"
    },
    "handlers": {
        "mailer": {
            "type": "pipe",
            "command": "/opt/sensu/embedded/bin/handler-mailer.rb"
            }
    }
}

Can anybody help me further?

Thank you and best regards

Lars

MisterDeeds commented 6 years ago

Hello everybody

I tested it further and that's how it works for me. Maybe it will help somebody

        "mailer" :  {
            "admin_gui" : "https://monitoring.xyz.com:8080",
            "mail_from": "no-reply@xyz.com",
            "mail_to": [
                "user1@xyz.com",
                "user2@xyz.com"
            ],
            "delivery_method": "smtp",
            "smtp_enable_starttls_auto": "true",
            "smtp_authentication": "login",
            "smtp_address": "smtp.office365.com",
            "smtp_port": "587",
            "smtp_domain": "smtp.office365.com",
            "smtp_username" : "no-reply@xyz.com",
            "smtp_password" : "XXXXXX"
        }

Best regards

Lars

asachs01 commented 6 years ago

@MisterDeeds since you were able to get the mailer to work by changing the authentication type, are you comfortable closing this out?