What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How can I change the size of PhantomJS full web page screenshots?

Votes:

0

I would like to change the default viewport size of web page screenshots that are downloaded with the HTTP Full Web Page sensor in PhantomJS mode. The screenshots have the wrong window size. For example, for some monitored web pages they only appear in mobile format.

How can I get a common desktop size for the created screenshots?

custom http http-full-web-page phantomjs prtg screenshots sensor web-page

Created on Apr 28, 2014 1:12:57 PM by  Gerald Schoch [Paessler Support]

Last change on Mar 24, 2022 10:18:16 AM by  Frank Hadasch [Paessler Support] (0) 1



1 Reply

Accepted Answer

Votes:

0

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.

  1. Stop the PRTG probe service on the probe system with the affected HTTP Full Web Page sensor.
  2. On the probe system, go to the \Sensor System subfolder of the PRTG program directory.
  3. Open the file phloadspeed.js with an editor.
  4. Add the viewport size property:
    page.viewportSize = {width: 1280, height: 1024};
    1. Set width and height according to your needs.
    2. Save your changes.
  5. 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.

Created on Apr 28, 2014 1:15:11 PM by  Gerald Schoch [Paessler Support]

Last change on Jan 3, 2023 10:05:45 AM by  Brandy Greger [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.