Skip to content

Instantly share code, notes, and snippets.

@jc1518
Last active December 6, 2018 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jc1518/20fcecd8388ddda0d5efe6c519afb749 to your computer and use it in GitHub Desktop.
Save jc1518/20fcecd8388ddda0d5efe6c519afb749 to your computer and use it in GitHub Desktop.
Nodejs JMX query sample
/**
* 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