Closed arnabnandy1706 closed 5 years ago
Have you gone through all the configuration steps at https://github.com/StackStorm-Exchange/stackstorm-sensu#configure-sensu-to-send-events-to-stackstorm?
Make sure that your handler is properly configured (including credentials), and that Sensu is running that handler when events of interest are triggered.
Hello @LindsayHill ,
I have configured as per the document. Below are the Handler files:
[root@sensu-host conf.d]# cat st2_handler.json
{
"st2_handler": {
"st2_username": "st2admin"
"st2_password": "*********"
"st2_api_key": "",
"st2_api_base_url": "https://stackstorm-host/api/",
"st2_auth_base_url": "https://stackstorm-host/auth"
}
}
[root@sensu-host conf.d]# cat handler_st2.json
{
"handlers": {
"st2": {
"type": "pipe",
"command": "/opt/sensu/embedded/bin/st2_handler.rb"
}
}
}
When I am testing getting below the error:
[root@sensu-host conf.d]# echo '{"client": {"name": 1}, "check":{"name": 2}, "id": "12345"}' | /opt/sensu/embedded/bin/st2_handler.rb --unauthed
Traceback (most recent call last):
File "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-stackstorm-0.1.1/lib/sensu-plugins-stackstorm/../../bin/st2_handler.py", line 433, in <module>
main(payload=payload, verbose=args.verbose, unauthed=args.unauthed, ssl_verify=args.ssl_verify)
File "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-stackstorm-0.1.1/lib/sensu-plugins-stackstorm/../../bin/st2_handler.py", line 417, in main
_set_config_opts(unauthed=unauthed, verbose=verbose, ssl_verify=ssl_verify)
File "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-stackstorm-0.1.1/lib/sensu-plugins-stackstorm/../../bin/st2_handler.py", line 391, in _set_config_opts
SENSU_HOST = Config['api'].get('host', 'localhost')
**AttributeError: 'NoneType' object has no attribute 'get**
Please help !
Thanks Arnab
Looks like your Sensu system doesn't have an API configuration scope defined. Should be something like /etc/sensu/conf.d/api.json
{
"api": {
"bind": "0.0.0.0",
"port": 4567,
"host": "localhost"
}
}
Thanks @LindsayHill ,
It's working fine now.
I have created a rule like below, but the rule is not getting triggered when an event is getting triggered in Sensu.
Please Help !
Below is the
handler_st2.json
in Sensu Server.Thanks, Arnab