-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot get anything to send to notifications #24
Comments
Same here, spent all day trying to get this working. Worked through several of the setup issue and no longer getting error messages, but still nothing is posting to Slack. Using "proxy_address" in my slack handler config, but when running TCPDUMP I show nothing going outbound to the proxy server.... frustrated |
Took me quite some time but the config format below is working. *Edited for a formatting abomination I missed earlier /etc/sensu/conf.d/handlers# cat slack.json
|
Same problem here: no notifications in slack, no help in logs, no help in docs. :( I tried the configuration that @tpacpdan suggested. I also confirmed that I can Out of ideas ... |
I actually did get this to work. I will try and explain the setup for the community version I used. Server SetupAssuming you installed the Sensu Community server the default way on ubuntu 14.04. These docs will probably help regardless of setup, but that's what I used. First you need to install the slack plugin (gem) Add the handler and config
Because I found the frequency of the alerts obnoxious I created a "handle_when" filter that mimics the enterprise handle_when functionality Sensu has documented. Either add my handle when filter or remove the filters array from your slack config above. If you use the enterprise version then you can leave the config above alone and ignore my handle_when config.
Sensu ClientIn my client config I have installed the client the documented way for sensu on another Ubuntu 14.04 machine. I setup checks like:
My API check process is something like
I'm running an API process with supervisord and using the check-process-status.sh file to check that the process is up. Even though supervisor is meant to keep the process running I want Sensu to notify me in the event that it is down. If the script exits with status 0 then the state is considered OK, otherwise it's 2 CRITICAL. Sensu recommends Nagios style exit codes for state: To test this you could clean out my bash file and either exit 0 or 2. Tweak the handle_when filter to change how often messages are sent to slack. My setup is to send an alert after 3 concurrent states changed and then once every 30 checks afterwards until the state changes to OK. |
Also, I went through the source and found out I could replace the slack payload with my own Ruby templates. In case anyone wants to do that you can: Change the slack handler config on sensu server to something like:
You need to create those two files being referenced. Make sure those files are readable to everyone.
I believe what I put in here is what the default uses. You can customize either of these to make the message look like you want. Note that @event is the sensu event object so you have access to anything included in your event including details from the client config. You can use that to customize the slack messages even further. |
@mneil glad you figured it out. I know we have documented some stuff around this a bit more but if you think there is anything we should add please open up a PR and ping me. |
Thanks for looking at this. I've spent a good day and a half trying to make this work. No matter what settings I use, where I put the files, or how I configure the thing sends messages. I've resorted to simply trying to make it post a message to requestb.in to make sure that it will send any message. The documentation on setting up handlers is not very detailed in Sensu. The link you have to installation really just says, install a gem :). I read through the sensu handler docs and check docs. I had the default handler working to just pipe commands to cat. I have also setup other handlers and checks. But sending to Slack fails silently. I'm sure I'm missing something or have done this wrong. I would love to have more details on how to actually set this up. I am not using the Enterprise server. Here are the details.
Setup:
I tried putting the config in the handler folder. Since that didn't work I ended up with the following in
/etc/sensu/config.json
.In the sensu server logs I get messages like this
So I see that it is sending something, or trying to, to the slack handler. Heeding the warning, 180 occurrences, I left it on overnight. I run the check every 10 seconds. That's every 30 minutes. This morning I have nothing logged to requestb.in.
I have another check running that logs this
This other check, which should send to slack, also does not trigger any messages to requestb.in. I have also left this running for over 12 hours.
Hopefully this is enough info understand what is happening and not too much info to overwhelm. I really would love to get this working. If sensu enterprise is required that is also an option for me.
The text was updated successfully, but these errors were encountered: