Created
November 10, 2014 09:51
-
-
Save ashikawa/6322dc88aaefacccbfc0 to your computer and use it in GitHub Desktop.
Hubot - UptimeRobot - Webhook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = require('url'); | |
module.exports = (robot) -> | |
robot.router.get "/uptimerobot/:room", (req, res) -> | |
{room} = req.params; | |
{monitorID, monitorURL, monitorFriendlyName, alertType, alertDetails, monitorAlertContacts} = url.parse(req.url, true).query | |
status = switch alertType | |
when '0' then 'paused' | |
when '1' then 'not checked yet' | |
when '2' then 'up' | |
when '8' then 'seems down' | |
when '9' then 'down' | |
robot.send {room: room}, """ | |
Monitor is #{status} | |
#{monitorFriendlyName} (#{monitorURL}) | |
""" | |
res.end "OK" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment