our system is running sensu server service with a user called “sensu”,
$ ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
(we are using sensu go v5.20)
hence all the sensu related files are all belongs to this sensu user, for example:
drwx------. 2 sensu sensu 196 Aug 10 16:43 conf.d
-rw-r–r-- 1 sensu sensu 6094 Aug 10 16:43 sensu_go_mail_template.erb
-rw-r–r-- 1 sensu sensu 681 Aug 10 16:43 sensu_go_slack_template.json
and now I can see the checks is running and provide event periodically, seeing from sensuctl event list:
api-checker test-01-capabilities_check CheckJson OK: valid JSON returned 0 false 2020-08-10 16:45:12 +0000 UTC
handlers are also setup, seeing from sensuctl handler list:
Now, if I trigger the event manually, i can received the email alert, by runnning these commands: $ sensuctl event info api-checker test-01-capabilities_check --format json #saved the result into event file $ cat event | /opt/sensu-plugins-ruby/embedded/bin/handler-mailer.rb -j test-mail -c html -s ‘[Sensu]’ --map-go-event-into-ruby
However… if I doing the last step to let it run the checks and alert by itself, I can see there is an event, I can see there is an handler existing, but no alert get triggered. I’m wondering if I missed some configurations or anything else?
You could provide us your check configuration, using something like sensuctl check info test-01-capabilities_check --format yaml ?
Also, you should definitely take a look at your backend logs, and possibly increase the verbosity of those logs to debug; you should see some entries around the execution of this handler if everything goes well.
if you are running the command manually on a different host than where the handler runs… make sure the backend host has the necessary smtp server configuration. You may need to adjust the backend host configuration to ensure the smtp server is accessible
Run manually as the sensu user under sudo if possible? It could be that your regular user running manually has additional privileges or settings that the sensu user doesn’t have.
the handler set is like this, so far there are four handlers and none of them is working (the debug handler is cat some outputs from the troubleshooting page in the sensugo document, command: cat > /var/log/sensu/debug-event.json)
type: Handler
api_version: core/v2
metadata:
created_by: sensu
labels:
sensu.io/managed_by: sensuctl
name: handler-tests
namespace: test
spec:
env_vars: null
filters: null
handlers:
- mailer
- pagerduty
- slack-integration-tests
- debug-handler
runtime_assets: null
secrets: null
timeout: 0
type: set
type: Handler
api_version: core/v2
metadata:
created_by: sensu
labels:
sensu.io/managed_by: sensuctl
name: mailer
namespace: test
spec:
command: /opt/sensu-plugins-ruby/embedded/bin/handler-mailer.rb -j test-mail -c
html -s '[Sensu]' --map-go-event-into-ruby
env_vars: null
filters: null
handlers: null
runtime_assets:
- sensu-plugins-http
- sensu-ruby-runtime
secrets: null
timeout: 0
type: pipe
and it is writing an event info to this file, so it should be somewhere stuck in executing the handler.
Is it possible to be related with etcd’s setting?
hi @palourde ,
I set up a backend log, and it shows shutting down scheduler, what does this mean? (the check is in published status when restart the server)
2020-08-12T20:39:48.034838+00:00 poc-sensu-go-srv-1f4w sensu-backend[4526]: {"component":"schedulerd","level":"warning","msg":"shutting down scheduler","name":"test-01-capabilities_check","namespace":"test","scheduler_type":"round-robin interval","time":"2020-08-12T20:39:48Z"}
You want to adjust the log-level config attribute of sensu-backend to debug, restart the backend(s) and look at the logs; you may filter by the handler name to make it easier to see what’s happening. At some point you should see some information about the handler being executed with its output.