Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Campfire plugin for the uptime project - https://github.com/fzaninotto/uptime
/**
* Campfire plugin for the uptime project - https://github.com/fzaninotto/uptime
*
* This index.js files goes to a directory `plugins/campfire` in your installation of uptime.
*
* Notifies all events (up, down, paused, restarted) to campfire
*
* This plugin has a dependency on `ranger`.
* Add this to the "dependencies" object in your `package.json` file :
*
* "ranger": "0.2.4"
*
*
* To enable the plugin, call init() from plugins/index.js
* exports.init = function() {
* require('./campfire').init();
* }
*
* Example configuration
*
* campfire:
* room: 1 # Must be the room id, not it's name
* account: uptime
* token: abcd
*
* event:
* up: true
* down: true
* paused: false
* restarted: false
*/
var config = require('config').campfire;
var CheckEvent = require('../../models/checkEvent');
var ranger = require('ranger');
exports.init = function() {
CheckEvent.on('afterInsert', function(checkEvent) {
if (!config.event[checkEvent.message])
return;
checkEvent.findCheck(function(err, check) {
if (err)
return console.error(err);
var message = "[Uptime] The application " + check.name + " just went to status " + checkEvent.message
var room_id = config.room;
var account = config.account;
var token = config.token;
var client = ranger.createClient(account, token);
client.room(room_id, function (room) {
room.speak(message);
});
});
});
console.log('Enabled Campfire notifications');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.