# Campfire handler

**URL:** <https://discourse.sensu.io/t/campfire-handler/139>\
**Category:** Sensu Classic (EOL)\
**Created:** [February 10, 2014, 2:04am UTC](https://discourse.sensu.io/t/campfire-handler/139 "2014-02-10T02:04:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke\_Tymowski](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@Luke\_Tymowski](https://discourse.sensu.io/u/Luke_Tymowski)\
**Post date:** [February 10, 2014, 2:04am UTC](https://discourse.sensu.io/t/campfire-handler/139/1 "2014-02-10T02:04:36Z")

</div>

Hello,

I’m having trouble getting the Campfire handler to work.

Sensu: 0.12

Ruby: embedded

/etc/sensu/conf.d/campfire.json

{

“campfire”: {

```
"room": "Alerts",

"room_id" : "999999"

"account": "myaccount",

"token": "my campfire token"

```

}

}

/etc/sensu/conf.d/handler\_campfire.json

{

“handlers”: {

“campfire”: {

“type”: “pipe”,

```
  "command": "/etc/sensu/handlers/campfire.rb"

```

}

}

}

In /var/log/sensu/sensu-server.log I see

{“timestamp”:“2014-02-10T01:52:51.329483+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/ **campfire**.rb",“name”:“ **campfire** ”},“output”:"/etc/sensu/handlers/ **campfire**.rb:35:in `room': undefined method`’ for nil:NilClass (NoMethodError)\n"}

{“timestamp”:“2014-02-10T01:52:51.329723+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/ **campfire**.rb",“name”:“ **campfire** ”},“output”:"\tfrom /etc/sensu/handlers/ **campfire**.rb:52:in `block in handle’\n"}

{“timestamp”:“2014-02-10T01:52:51.329835+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/ **campfire**.rb",“name”:“ **campfire** ”},“output”:"\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:66:in `timeout’\n"}

{“timestamp”:“2014-02-10T01:52:51.329938+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/ **campfire**.rb",“name”:“ **campfire** ”},“output”:"\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:97:in `timeout’\n"}

{“timestamp”:“2014-02-10T01:52:51.330031+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/ **campfire**.rb",“name”:“ **campfire** ”},“output”:"\tfrom /etc/sensu/handlers/ **campfire**.rb:51:in `handle’\n"}

{“timestamp”:“2014-02-10T01:52:51.330126+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/ **campfire**.rb",“name”:“ **campfire** ”},“output”:"\tfrom /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-0.2.2/lib/sensu-handler.rb:41:in `block in class:Handler’\n"}

If I try /opt/sensu/embedded/bin/ruby /etc/sensu/handlers/campfire.rb I get nothing.

I’ve got the mailer.rb handler working. But after a few hours I’ve not gotten any further with campfire.

Any ideas?

thanks,

Luke

---

<div class="post-metadata">

**Author:** ![Nick\_Stielau](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nick\_Stielau](https://discourse.sensu.io/u/Nick_Stielau)\
**Post date:** [February 10, 2014, 5:09pm UTC](https://discourse.sensu.io/t/campfire-handler/139/2 "2014-02-10T17:09:09Z")

</div>

Hey Luke,

Your config looks OK to me, not sure what the issue is. You can always try piping an example JSON payload to the handler [1] (just running it directly probably won’t do much). You might try to debug the configs while your at it, i.e. ‘puts settings.inspect’ in the #room method.

Good luck!

[1] [example json data passed into Sensu handlers via STDIN · GitHub](https://gist.github.com/joemiller/1723079/)

> **···**
>
> On Sunday, February 9, 2014 6:04:36 PM UTC-8, Luke Tymowski wrote:
> 
> > Hello,
> 
> > 
> 
> > I’m having trouble getting the Campfire handler to work.
> 
> > Sensu: 0.12
> 
> > Ruby: embedded
> 
> > 
> 
> > /etc/sensu/conf.d/campfire.json
> 
> > {
> 
> > “campfire”: {
> 
> > ```
> > "room": "Alerts",
> > 
> > ```
> 
> > ```
> > "room_id" : "999999"
> > 
> > ```
> 
> > ```
> > "account": "myaccount",
> > 
> > ```
> 
> > ```
> > "token": "my campfire token"
> > 
> > ```
> 
> > }
> 
> > }
> 
> > /etc/sensu/conf.d/handler\_campfire.json
> 
> > {
> 
> > “handlers”: {
> 
> > “campfire”: {
> 
> > “type”: “pipe”,
> 
> > ```
> > "command": "/etc/sensu/handlers/campfire.rb"
> > 
> > ```
> 
> > }
> 
> > }
> 
> > }
> 
> > 
> 
> > In /var/log/sensu/sensu-server.log I see
> 
> > {“timestamp”:“2014-02-10T01:52:51.329483+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/ **campfire**.rb”,“name”:“ **campfire** ”},“output”:“/etc/sensu/handlers/ **campfire**.rb:35:in `room': undefined method `’ for nil:NilClass (NoMethodError)\n”}
> 
> > {“timestamp”:“2014-02-10T01:52:51.329723+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/ **campfire**.rb”,“name”:“ **campfire** ”},“output”:“\tfrom /etc/sensu/handlers/ **campfire**.rb:52:in `block in handle’\n”}
> 
> > {“timestamp”:“2014-02-10T01:52:51.329835+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/ **campfire**.rb”,“name”:“ **campfire** ”},“output”:“\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:66:in `timeout’\n”}
> 
> > {“timestamp”:“2014-02-10T01:52:51.329938+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/ **campfire**.rb”,“name”:“ **campfire** ”},“output”:“\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:97:in `timeout’\n”}
> 
> > {“timestamp”:“2014-02-10T01:52:51.330031+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/ **campfire**.rb”,“name”:“ **campfire** ”},“output”:“\tfrom /etc/sensu/handlers/ **campfire**.rb:51:in `handle’\n”}
> 
> > 
> 
> > {“timestamp”:“2014-02-10T01:52:51.330126+0000”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/ **campfire**.rb”,“name”:“ **campfire** ”},“output”:“\tfrom /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-0.2.2/lib/sensu-handler.rb:41:in `block in class:Handler’\n”}
> 
> > 
> 
> > If I try /opt/sensu/embedded/bin/ruby /etc/sensu/handlers/campfire.rb I get nothing.
> 
> > I’ve got the mailer.rb handler working. But after a few hours I’ve not gotten any further with campfire.
> 
> > 
> 
> > Any ideas?
> 
> > 
> 
> > thanks,
> 
> > 
> 
> > Luke

---

<div class="post-metadata">

**Author:** ![Luke\_Tymowski](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@Luke\_Tymowski](https://discourse.sensu.io/u/Luke_Tymowski)\
**Post date:** [February 10, 2014, 5:16pm UTC](https://discourse.sensu.io/t/campfire-handler/139/3 "2014-02-10T17:16:57Z")

</div>

> Your config looks OK to me, not sure what the issue is. You can always  
> try piping an example JSON payload to the handler [1] (just running it  
> directly probably won't do much). You might try to debug the configs while  
> your at it, i.e. 'puts settings.inspect' in the #room method.

Actually, my problem was with my config. ☹  
/etc/sensu/conf.d/campfire.json

{

&nbsp;&nbsp;"campfire": {

&nbsp;&nbsp;&nbsp;&nbsp;"room": "Alerts",

&nbsp;&nbsp;&nbsp;&nbsp;"room\_id" : "999999"

&nbsp;&nbsp;&nbsp;&nbsp;"account": "myaccount",

&nbsp;&nbsp;&nbsp;&nbsp;"token": "my campfire token"

&nbsp;&nbsp;}  
}

Notice the missing comma on the room\_id line.  
Saw that first thing this morning but didn't/couldn't see it on the weekend.

But I now have two other problems. Sensu is posting to Campfire every 15  
occurrences, but my check says to notify on every 1 occurrence. The mailer  
handler is behaving as expected here. Is this a bug?

And I've got what looks like Ruby SSL errors.

{"type":"pipe","command":"/etc/sensu/handlers/\*campfire\*.rb","name":"  
\*campfire\*"},"output":"/opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:918:in  
`connect': SSL\_connect returned=1 errno=0 state=SSLv3 read server  
certificate B: certificate verify failed  
(Faraday::Error::ConnectionFailed)\n"}

Fletcher talks about that problem here, I think:

> <https://gist.github.com/fnichol/867550>

Luke

---

<div class="post-metadata">

**Author:** ![Nick\_Stielau](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nick\_Stielau](https://discourse.sensu.io/u/Nick_Stielau)\
**Post date:** [February 10, 2014, 5:54pm UTC](https://discourse.sensu.io/t/campfire-handler/139/4 "2014-02-10T17:54:00Z")

</div>

Look at the ‘refresh’ attribute. Set it equal to the interval to get alerts updates every run. The “occurences” attribute is the time to the first alert, whereas “refresh” is the time between updates (i.e. re-handling).

I made a PR to help with the debugging UX, but it really could be more helpful with JSON. I’ll take a look at that as well.

[https://github.com/sensu/sensu-plugin/pull/62](https://github.com/sensu/sensu-plugin/pull/62)

> **···**
>
> On Mon, Feb 10, 2014 at 9:16 AM, Luke Tymowski [ltymowski@gmail.com](mailto:ltymowski@gmail.com) wrote:
> 
> > 
> 
> –
> 
> ☮
> 
> Nick Stielau  
> 206-245-7991
> 
> > Your config looks OK to me, not sure what the issue is. You can always try piping an example JSON payload to the handler [1] (just running it directly probably won’t do much). You might try to debug the configs while your at it, i.e. ‘puts settings.inspect’ in the #room method.
> 
> Actually, my problem was with my config. ☹
> 
> /etc/sensu/conf.d/campfire.json
> 
> {
> 
> “campfire”: {
> 
> “room”: “Alerts”,
> 
> “room\_id” : “999999”
> 
> “account”: “myaccount”,
> 
> “token”: “my campfire token”
> 
> }
> 
> }
> 
> Notice the missing comma on the room\_id line.
> 
> Saw that first thing this morning but didn’t/couldn’t see it on the weekend.
> 
> But I now have two other problems. Sensu is posting to Campfire every 15 occurrences, but my check says to notify on every 1 occurrence. The mailer handler is behaving as expected here. Is this a bug?
> 
> And I’ve got what looks like Ruby SSL errors.
> 
> {“type”:“pipe”,“command”:“/etc/sensu/handlers/ **campfire**.rb”,“name”:“ **campfire** ”},“output”:“/opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:918:in `connect’: SSL\_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Faraday::Error::ConnectionFailed)\n”}
> 
> Fletcher talks about that problem here, I think:
> 
> [https://gist.github.com/fnichol/867550](https://gist.github.com/fnichol/867550)
> 
> Luke

---

<div class="post-metadata">

**Author:** ![Nick\_Stielau](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nick\_Stielau](https://discourse.sensu.io/u/Nick_Stielau)\
**Post date:** [February 10, 2014, 6:06pm UTC](https://discourse.sensu.io/t/campfire-handler/139/5 "2014-02-10T18:06:36Z")

</div>

Here’s a pass at better JSON error messages:  
[https://github.com/sensu/sensu-plugin/pull/63](https://github.com/sensu/sensu-plugin/pull/63)

> **···**
>
> On Mon, Feb 10, 2014 at 9:54 AM, Nick Stielau [nick.stielau@gmail.com](mailto:nick.stielau@gmail.com) wrote:
> 
> > Look at the ‘refresh’ attribute. Set it equal to the interval to get alerts updates every run. The “occurences” attribute is the time to the first alert, whereas “refresh” is the time between updates (i.e. re-handling).
> 
> > I made a PR to help with the debugging UX, but it really could be more helpful with JSON. I’ll take a look at that as well.
> 
> > 
> 
> > [https://github.com/sensu/sensu-plugin/pull/62](https://github.com/sensu/sensu-plugin/pull/62)
> 
> –
> 
> ☮
> 
> Nick Stielau  
> 206-245-7991
> 
> On Mon, Feb 10, 2014 at 9:16 AM, Luke Tymowski [ltymowski@gmail.com](mailto:ltymowski@gmail.com) wrote:
> 
> > 
> 
> ☮
> 
> Nick Stielau  
> 206-245-7991
> 
> –
> 
> > Your config looks OK to me, not sure what the issue is. You can always try piping an example JSON payload to the handler [1] (just running it directly probably won’t do much). You might try to debug the configs while your at it, i.e. ‘puts settings.inspect’ in the #room method.
> 
> Actually, my problem was with my config. ☹
> 
> /etc/sensu/conf.d/campfire.json
> 
> {
> 
> “campfire”: {
> 
> “room”: “Alerts”,
> 
> “room\_id” : “999999”
> 
> “account”: “myaccount”,
> 
> “token”: “my campfire token”
> 
> }
> 
> }
> 
> Notice the missing comma on the room\_id line.
> 
> Saw that first thing this morning but didn’t/couldn’t see it on the weekend.
> 
> But I now have two other problems. Sensu is posting to Campfire every 15 occurrences, but my check says to notify on every 1 occurrence. The mailer handler is behaving as expected here. Is this a bug?
> 
> And I’ve got what looks like Ruby SSL errors.
> 
> {“type”:“pipe”,“command”:“/etc/sensu/handlers/ **campfire**.rb”,“name”:“ **campfire** ”},“output”:“/opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:918:in `connect’: SSL\_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Faraday::Error::ConnectionFailed)\n”}
> 
> Fletcher talks about that problem here, I think:
> 
> [https://gist.github.com/fnichol/867550](https://gist.github.com/fnichol/867550)
> 
> Luke

---

<div class="post-metadata">

**Author:** ![jspaleta](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/jspaleta/32/141_2.png) [@jspaleta](https://discourse.sensu.io/u/jspaleta)\
**Post date:** [November 22, 2018, 2:05am UTC](https://discourse.sensu.io/t/campfire-handler/139/6 "2018-11-22T02:05:06Z")

</div>

Closed on November 22, 2018, 2:05am UTC


