gpt4 book ai didi

ruby-on-rails - Sensu Emailer `parse_options':无效选项:-j(OptionParser::InvalidOption)

转载 作者:行者123 更新时间:2023-12-04 06:30:17 25 4
gpt4 key购买 nike

尝试为 sensu 设置亚马逊 ses

设置 1
我有

handler-mailer.rb -j mailme_using_amazonses in my config.json



handler-mailer.rb在我的 /etc/sensu/plugins文件夹

当我在命令行上运行时,出现错误
ruby /etc/sensu/plugins/handler-mailer.rb -j mailme_using_amazonses
/var/lib/gems/1.9.1/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:230:in `parse_options': invalid option: -j (OptionParser::InvalidOption)
from /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.3/lib/sensu-handler.rb:18:in `initialize'
from /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.3/lib/sensu-handler.rb:78:in `new'
from /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.3/lib/sensu-handler.rb:78:in `block in <class:Handler>'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- erubis (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /etc/sensu/plugins/handler-mailer.rb:20:in `<main>'

我的 mailme_using_amazonses 有以下内容
{
"handlers": {
"mailer-ses": {
"mail_from": "from@example.com",
"mail_to": "to@example.com",
"use_ami_role": true,
"secret_key": "MyKey",
"access_key": "MyAccess",
"region": "us-west-2"
}
}
}

设置 2
config.json我有以下
{
.. other config ..
"handlers": {
"handler-ses": { **HERE I ALSO TRIED "ses"**
"mail_from": "from@example.com",
"mail_to": "to@example.com",
"use_ami_role": true,
"access_key": "accesskey",
"secret_key": "secretekey",
"region": "us-west-2",
"subscriptions": {
"subscription_name": {
"mail_to": "teamemail@example.com"
}
}
}
}
}

当我重新启动时 sensu-server我收到以下错误
configuration is invalid
{
"errors":[
{
"object":{
"mail_from":"from@example.com",
"mail_to":"to@example.com",
"use_ami_role":true,
"access_key":"accesskey",
"secret_key":"secretkey",
"region":"us-west-2",
"subscriptions":{
"subscription_name":{
"mail_to":"teamemail@example.com"
}
},
"name":"handler-ses"
},
"message":"handler type must be a string"
},
{
"object":{
"mail_from":"from@example.com",
"mail_to":"to@example.com",
"use_ami_role":true,
"access_key":"accesskey",
"secret_key":"secretkey",
"region":"us-west-2",
"subscriptions":{
"subscription_name":{
"mail_to":"teamemail@example.com"
}
},
"name":"handler-ses"
},
"message":"unknown handler type"
}
]
}

我在这里错过了什么?

最佳答案

我解决了这个问题。我读了 handler-ses.rb文件。这里注意到配置应该在 ses.json .我复制了 设置 2 来自 config.json 的 ses 配置json 转换成 ses.json并将其放在 /etc/sensu/handers 下文件夹。错误消失了。我还没有收到电子邮件。

收到 ses 后会更新这个答案电子邮件工作。

关于ruby-on-rails - Sensu Emailer `parse_options':无效选项:-j(OptionParser::InvalidOption),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40149278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com