This article applies as of PRTG 22
Defining viewport size for the HTTP Full Web Page sensor
If you use the HTTP Full Web Page sensor with the headless webkit engine PhantomJS, you can create a visual history of web pages. However, if the monitored web page adapts itself based on the user agent screen size, the stored screenshots of the page might appear in the wrong size.
For example, the HTTP Full Web Page sensor stores the screenshots of specific web pages only in mobile format, but screenshots of other web pages in the desired desktop size.
To render page screenshots in a common desktop size with the HTTP Full Web Page sensor, you must define the viewport size for the layout process. The sensor then simulates the window size like in a common browser.
For details about this PhantomJS property, see the PhantomJS API Reference web page.
How to set the viewport size for PRTG
PRTG provides a configurable .jscript file for the PhantomJS engine that the HTTP Full Web Page sensor uses. There, you must insert the desired size parameters into the viewportSize property. Follow the steps below.
Note: If you manually define the viewport size for the PhantomJS API of PRTG, the file size of the screenshots increases and a large amount of disk space is used. In extreme cases, this might result in broken HTTP Full Web Page sensors on the affected probe. However, if you enable the Render and store a screenshot of most recent result as JPG option, there is usually no issue.
- Stop the PRTG probe service on the probe system with the affected HTTP Full Web Page sensor.
- On the probe system, go to the \Sensor System subfolder of the PRTG program directory.
- Open the file phloadspeed.js with an editor.
- Add the viewport size property:
page.viewportSize = {width: 1280, height: 1024};
- Set width and height according to your needs.
- Save your changes.
- Restart the probe service.
The upper part of phloadspeed.js should then look like this (perhaps without user name and password):
var page = require('webpage').create(),
system = require('system'),
t, resultfile, address;
var currentUrl = "",
userName = '',
passWord = '';
page.viewportSize = {width: 1280, height: 1024};
The HTTP Full Web Page sensor now creates screenshots rendered in the defined viewport size.
Add comment