Hi All,
I wonder if anyone can help me. I am trying to setup mailer.rb as per this document: http://sensuapp.org/docs/0.16/adding_a_handler
Configuration
OS: CentOS 7 x86_64
SENSU VERSION 0.17.0
I have followed the steps but cant seem to get it to work without an error. I have set sensu to use the embedded ruby version in /etc/sensu/default and dowloaded the mail gem to embedded ruby.
I have created a test log entry and am seeing the following:
[root@ln01 ~]# cat ./test.log | /opt/sensu/embedded/bin/ruby -d/etc/sensu/handlers/mailer.rb
ExceptionRuntimeError' at /opt/sensu/embedded/bin/ruby - invalid option -/ (-h will show valid options) /opt/sensu/embedded/bin/ruby: invalid option -/ (-h will show valid options) (RuntimeError) [root@ln01 ~]# cat ./test.log | /opt/sensu/embedded/bin/ruby -d /etc/sensu/handlers/mailer.rb Exception
LoadError’ at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems.rb:1087 - cannot load such file – rubygems/defaults/operating_system
ExceptionLoadError' at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems.rb:1096 - cannot load such file -- rubygems/defaults/ruby Exception
LoadError’ at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53 - cannot load such file – sensu-handler
Using Ext extension for JSON.
ExceptionLoadError' at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53 - cannot load such file -- mail Exception
NameError’ at /opt/sensu/embedded/lib/ruby/2.0.0/psych/core_ext.rb:16 - methodto_yaml' not defined in Object Exception
NameError’ at /opt/sensu/embedded/lib/ruby/2.0.0/psych/core_ext.rb:29 - methodyaml_as' not defined in Module Exception
NameError’ at /opt/sensu/embedded/lib/ruby/2.0.0/psych/deprecated.rb:80 - undefined methodto_yaml_properties' for class
Object’
/etc/sensu/handlers/mailer.rb:26: warning: method redefined; discarding old call
/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/exim.rb:44: warning: previous definition of call was here
/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mixlib-cli-1.5.0/lib/mixlib/cli.rb:50: warning: instance variable @separate_default_options not initialized
ExceptionErrno::ENOENT' at /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-plugin/utils.rb:14 - No such file or directory - /etc/sensu/config.json Exception
TypeError’ at /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:125 - no implicit conversion of nil into String
/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:125:in+': no implicit conversion of nil into String (TypeError) from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:125:in
filter_silenced’
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:31:infilter' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:54:in
block in class:Handler’
I hope someone can help as this is driving me up the wall. I am also not overly familiar with Ruby. Thanks for any replies in advance!