Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.