Open tarvip opened 7 years ago
That's a smart observation @tarvip. The line is https://github.com/sensu-plugins/sensu-plugins-twilio/blob/master/bin/handler-twiliosms.rb#L46 I believe. The only thing I can't tell is whether that is intended to return false
here or true
. I leave that to people who know this plugin 😄
This is one of those moments when we feel the pain of limited test coverage. Two things if you have the time:
Tagging @Evesy as well since he recently worked on this plugin too. Cheers to you both!
candidate['sensu_level'] >= @event['check']['status']
should return true (along with some other conditionals) for a candidate to be sent an SMS.
Assuming I'm correct in thinking that a sensu_level
of 2 is supposed to represent 'critical only' alerts, and 1 represents both critical and warning alerts; then it makes sense that it should be <= rather than >=
Let's assume I have set recipient's
sensu_level
to1
(warnings and criticals should be forwarded) and alert comes in where status is2
There is following condition in code:
candidate['sensu_level'] >= @event['check']['status']
this means1 >= 2
, which is obviouslyfalse
. I think there should be<=
, in this case1<=2
istrue
and if OK message comes in then1<=0
which isfalse
.