Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uptime
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tools
uptime
Commits
547c66db
Commit
547c66db
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
New plugin for reports via PhantomJS
parent
44379e28
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
package.json
+17
-16
17 additions, 16 deletions
package.json
plugins/reporting/index.js
+42
-0
42 additions, 0 deletions
plugins/reporting/index.js
plugins/reporting/phantomjs-script.js
+18
-0
18 additions, 0 deletions
plugins/reporting/phantomjs-script.js
with
77 additions
and
16 deletions
package.json
+
17
−
16
View file @
547c66db
...
...
@@ -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
"
,
"
feedpars
er
"
:
"
^
1.1.
4
"
,
"
node-mattermost
"
:
"
^
0.
0
.1
"
,
"
github
"
:
"
^5.3.3
"
"
semv
er
"
:
"
1.1.
0
"
,
"
socket.io
"
:
"
0.
9
.1
7
"
,
"
webpagetest
"
:
"
0.2.0
"
},
"devDependencies"
:
{
"
mocha
"
:
"
1.7.x
"
,
...
...
This diff is collapsed.
Click to expand it.
plugins/reporting/index.js
0 → 100644
+
42
−
0
View file @
547c66db
/**
* 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
());
});
});
};
This diff is collapsed.
Click to expand it.
plugins/reporting/phantomjs-script.js
0 → 100644
+
18
−
0
View file @
547c66db
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
();
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment