Last active
December 6, 2018 05:51
-
-
Save jc1518/20fcecd8388ddda0d5efe6c519afb749 to your computer and use it in GitHub Desktop.
Nodejs JMX query sample
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
/** | |
* Check confluence jmx status | |
*/ | |
'use strict'; | |
const exec = require('child_process').exec; | |
module.exports = function (robot) { | |
function app_status (app, msg) { | |
var child = exec('cd ' + __dirname + '; ./' + app + '_status.sh', function (error, stdout, stderr) { | |
if (error) { | |
console.log(error); | |
msg.send("`oops, something went wrong!`"); | |
} | |
process.stdout.write(stdout); | |
process.stderr.write(stderr); | |
msg.send("```https://"+app+"\n"+stdout+"```"); | |
}); | |
} | |
robot.respond(/confluence status/i, function (msg) { | |
msg.send("Let me check Confluence for you, please wait..."); | |
app_status('confluence', msg); | |
}); | |
robot.hear(/Confluence long response time is detected/ig, function (msg) { | |
msg.send("Let me check how Confluence is doing, please wait..."); | |
app_status('confluence', msg); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment