Skip to content
Snippets Groups Projects
Commit 547c66db authored by jurgenhaas's avatar jurgenhaas
Browse files

New plugin for reports via PhantomJS

parent 44379e28
No related branches found
No related tags found
No related merge requests found
......@@ -4,28 +4,29 @@
"version": "3.2.0",
"author": "Jürgen Haas",
"dependencies": {
"mongoose": "4.7.0",
"mongoose-lifecycle": "1.0.0",
"express": "3.2.0",
"express-partials": "0.1.1",
"async": "0.1.22",
"config": "0.4.32",
"connect-flash": "0.1.0",
"ejs": "0.8.3",
"config": "0.4.32",
"async": "0.1.22",
"socket.io": "0.9.17",
"semver": "1.1.0",
"express": "3.2.0",
"express-partials": "0.1.1",
"feedparser": "^1.1.4",
"github": "^5.3.3",
"hipchatter": "0.2.0",
"jira-connector": "^1.9.0",
"js-yaml": "2.1.0",
"moment": "2.1.0",
"nodemailer": "0.3.35",
"mongoose": "4.7.0",
"mongoose-lifecycle": "1.0.0",
"net-ping": "1.1.7",
"js-yaml": "2.1.0",
"webpagetest": "0.2.0",
"node-mattermost": "^0.0.1",
"nodemailer": "0.3.35",
"phantomjs-prebuilt": "^2.1.14",
"pushover-notifications": "0.1.5",
"hipchatter": "0.2.0",
"jira-connector": "^1.9.0",
"request": "^2.65.0",
"feedparser": "^1.1.4",
"node-mattermost": "^0.0.1",
"github": "^5.3.3"
"semver": "1.1.0",
"socket.io": "0.9.17",
"webpagetest": "0.2.0"
},
"devDependencies": {
"mocha": "1.7.x",
......
/**
* Reporting plugin
*
* Use PhantomJS to produce reports about checks and deliver them to some channels.
*
* Installation
* ------------
*
* Usage
* -----
*/
var fs = require('fs');
var ejs = require('ejs');
var yaml = require('js-yaml');
var express = require('express');
var Check = require('../../models/check');
var Ping = require('../../models/ping');
exports.initWebApp = function(options) {
var api = options.api;
var config = options.config;
var dashboard = options.dashboard;
Ping.on('afterInsert', function(ping) {
Check.findById(ping.check, function(err, check) {
if (err) {
return;
}
if (!check) {
return;
}
// Create the report
var phantomjs = require('phantomjs-prebuilt'),
path = require('path'),
program = phantomjs.exec(path.join(__dirname, 'phantomjs-script.js'), config['url'], config['basicAuth']['username'], config['basicAuth']['password'], check._id, check.name, 'month', Date.now());
});
});
};
var page = require('webpage').create(),
system = require('system'),
args = system.args,
url = args[1],
username = args[2],
password = args[3],
check = args[4],
name = args[5],
type = args[6],
date = args[7],
fullUrl = url + '/dashboard/checks/' + check + '?type=' + type + '&date=' + date;
page.settings.userName = username;
page.settings.password = password;
page.open(fullUrl, function() {
page.render('/var/log/nodejs/reports/' + name + '.png');
phantom.exit();
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment