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

Dashboard Map - Timed Refresh won't occur

Votes:

0

I have a Dashboard Map I am working on, I am creating a custom object to display the time in Hours : Minutes and have the dashboard set to refresh every 60 seconds so to keep the time up to date.

The issue I am having is the Dashboard will never refresh, though as soon as it is loaded it constantly shows the buffering/loading symbol on my browser.

Code for the Custom System Time:

function renderTime(offset) {

  var currentTime = new Date();
  currentTime.setHours(currentTime.getHours() + offset);
  var diem = "AM";
  var h = currentTime.getHours();
  var m = currentTime.getMinutes();

//Defines AM/PM over 24 hour
  if (h == 0) {
    h = 12;
  } else if (h == 12){
    diem = "PM";
  } else if (h > 12, h < 24) {
    h = h - 12;
    diem = "PM";
  } 

//Adds a 0 in front of single digit hours
  if (h < 10) {
    h = "0" + h;
  }

//Adds a 0 in front of single digit minutes
  if (m < 10) {
    m = "0" + m;
  }

//Output
  var myClock = document.getElementById("clockDisplay");
  myClock.textContent = h + ":" + m + " " + diem;

//Return tag to get values in PRTG - if omit, h and m will show as NaN
  return;
}
  renderTime(+0).valueOf();

Note: I don't recall this issue happening before I started using this custom object, does JavaScript cause issues with Dashboards?

custom-object dashboard maps prtg

Created on Dec 5, 2016 8:16:34 PM



Best Answer

Accepted Answer

Votes:

1

Hey Evan,

Well, there's actually a rather easy way to implement live clocks on a map. Create a clock widget via timeanddate.com, add a Custom HTML Element to the map and enter the entire iFrame code into the HTML before block. And you got your customized live clock on the map using way less ressources.

You can sure use multiple clocks for any timezone you like. And it will probably look better than the plain javascript :)

Created on Dec 7, 2016 7:14:21 AM by  Stephan Linke [Paessler Support]



3 Replies

Votes:

0

Any javascript errors within the console when the map is open and the code applied?

Created on Dec 6, 2016 11:21:38 AM by  Stephan Linke [Paessler Support]



Votes:

0

Hi @Stephan,

It doesn't appear to be generating any kind of errors - although my Sensor's Health went into warning at 55% after having the map open for a couple minutes in the Enterprise Console. (Which has never happened before)

The map also seems to work in the Enterprise Console but the map is constantly refreshed to the point I cannot edit the map from there as it is almost instantly refreshed.

The reason I wanted to use something like the above JavaScript over using <#system type= "time"> was for multiple timezone clocks on the same map.

Created on Dec 6, 2016 2:21:18 PM



Accepted Answer

Votes:

1

Hey Evan,

Well, there's actually a rather easy way to implement live clocks on a map. Create a clock widget via timeanddate.com, add a Custom HTML Element to the map and enter the entire iFrame code into the HTML before block. And you got your customized live clock on the map using way less ressources.

You can sure use multiple clocks for any timezone you like. And it will probably look better than the plain javascript :)

Created on Dec 7, 2016 7:14:21 AM by  Stephan Linke [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.