Community
Zenoss Newsletter

Monitored by Zenoss
SourceForge.net Logo
Views

Edit history

Edit: -1 of 1
Time: 2008-09-18 07:29:45
Note: /production/www/portal/public-website/community/manage_importObject

changed:
-
<p>Here in the office we've got the Zenoss dashboard up on a large LCD on the wall so we can keep an eye on our servers.  As a service to the people here that commute into Dallas on the way home I have added Google's traffic reports to the maps portlet on the dashboard.</p>

<p>Fortunately the traffic reports are already built into the Google <maps API.  Unfortunately it only displays the traffic lines if your zoom is close enough and/or the map is large enough.  Since zenoss auto-zooms to show all your locations on the map this won't work well if you are monitoring locations outside your metro area.</p>

<p>This is a pretty simple hack, but it does involved editing a javascript file in the template.  The usual disclaimers apply, backup your files, and expect the hack to disappear when you upgrade zenoss.</p>

<p>Find geomap-2.1.js, it should be in Zenwidgets/skins/zenui/javascript/.  It's exact location may vary depending on how you installed zenoss and which system you are using.</p>

<p>At the top add a new variable for the traffic overlay.</p>

<blockquote><pre>
@@ -1,4 +1,6 @@
 var Class = YAHOO.zenoss.Class;
+var trafficOverlay = new GTrafficOverlay();
+
</pre></blockquote>

<p>Then down in the doDraw function we need to update the overlay and add it to the map.</p>

<blockquote><pre>
@@ -150,6 +152,8 @@
         for (j=0;j&lt;linkdata.length;j++) {
             x.addPolyline(linkdata[j]);
         }
+        trafficOverlay = new GTrafficOverlay();
+        x.map.addOverlay(trafficOverlay);
         d = x.lock.acquire();
         d.addCallback(x.saveCache);

</pre></blockquote>

<p>Browsers can be persistent at caching the javascript files.  You may need to clear your cash and shift-reload the dashboard before you see the changes.</p>

<p>If it doesn't work check the js file in your browser and make sure it isn't cached:<br />
http://YOUR.ZENOSS.SERVER:8080/zport/dmd/Locations/javascript/geomap-2.1.js</p>

<p>Here is how it looks on our monitor in the office:
<img src="http://antonolsen.com/wp-content/uploads/2008/02/zenosstraffic.png" /></p>