This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Google Maps Integration

Orion Google Maps Hack Version 0.3, July 2012

Andrew LaGrone, SCP#1368

NOTE: There is a slightly updated, and modified version of this example here, including an instructional video on how to install: Google Maps in Orion NPM - How to Video

Description: This package will let you integrate Google Maps into your Orion NPM web console. Below (and included in the zip) you can find installation instructions. Good luck & enjoy!!!

!! Disclaimer - Use at your own risk !!

I am offering the code as open source to the community to expand and share upon the body of work.

!! Known Issues !!

My intention is/was to take the path all the way down to the building/site level, however at this time the path stops at 'City.'

At this release, the city needs to be entered as all one word (Ft_Worth, SanDiego, San_Antonio, etc).

I had some trouble getting the maps to load into new browser windows in Internet Explorer, however this works just fine in Firefox and Chrome. If you don't use IE, the drill-down behavior can be changed to launch new browser windows when drilling down from map to map. Look for the HTML code that defines target=_parent and change to target=_blank. These can be found in the MyStateHack.aspx (Line 14), MyCityStateHack, and MyBuildingCityStateHack.aspx (the "menu" pages). I chose to stay within the iFrame for navigation simply to support IE along side your favorite Brand-X browsers. I've been told that this still doesn't work in IE.

!! Requirements !!

Your Orion server will need to have Internet access (maps.google.com, wunderground.com, weather.gov) to pull the map and weather data.

!! Installation Procedure !!

Deposit the ASP Pages into the inetpub directory on the Orion Server that is hosting your Orion Web Console, creating the folder GoogleHack:

  C:\inetpub\SolarWinds\Orion\GoogleHack\

  For each ASP page, locate and configure the database connection string.

  A DB Conn String looks like:

  oConn = New System.Data.SQLClient.SQLConnection ("server=SQLSERVER\INSTANCE; initial catalog=YOURDATABASE;uid=DATABASEUSER;pwd=DATABASEUSERPASSWORD")

Open the Custom Properties Editor on the Orion server, and create Latitude, Longitude, Country, State, and City text properties for the Nodes table. Populate these properties.

  State: The Two letter state code is hard coded, so you will want to use same for your US states in Custom Properties. Just to show that I'm not entirely inflexible or consistent, our non-US sites received a three letter country code in place of the states.

  Country: MyHack.aspx uses Country to filter nodes for Country='US' - This may not be entirely necessary for you, and if no nodes exist outside of the US, remove AND Country='US' from the query (MyHack.aspx Line 20), and you can ignore using Country as a custom property.

In the Orion Web Console page where you want to add the map, customize this page and add a Custom HTML Resource to the page. Below is an example iFrame:

  <iframe src="/Orion/GoogleHack/MyHack.aspx" width="100%" frameborder=0 height=600 scrolling=no align=center></iframe>

!! Additional Notes & Hints !!

  !! -Custom Icons !!

  You can use custom icons instead of the default LEDs for status. I'm working on a more complicated use-case for this, but the path is defined in the code & it's worth mentioning because it's easy. For example, you'll see in MyHack.aspx (Line 78):

  var image_dir = '/Orion/images/StatusIcons/Small-';

  This can be manipulated into something like:

  var image_dir = '/Orion/images/StatusIcons/Small-Purple-Bunnies-';

  ...Assuming your icons all read like 'Small-Purple-Bunnies-Warning.jpg'

  !! -Finding your Lat & Long Values !!

  There are two ways I found to do this.

  1) use maps.google.com, then grab the link (like you see here: http://screencast.com/t/21QjuNvBa).

  https://maps.google.com/maps?q=austin,+tx&hl=en&sll=37.0625,-95.677068&sspn=48.15347,70.927734&t=h&hnear=Austin,+Travis,+Texas&z=11

  See the ll=37.0625,-95.677068? That's it!

  2) use http://itouchmap.com/latlong.html.

  !! -Weather On/Off or looping !!

  To change the weather portion from looping to static & back, just switch the commenting to the other link (Lines 186 & 187 from MyHack.aspx)

  To turn weather off, comment the weather section out (weather is currently enabled only on the first page because it gets too busy when you drill down). If you need an example of no weather, look at the MyStateMapHack.aspx. I've left the code in there in case I ever wanted to add it back. If you're feeling up to it, you can choose to either hard code the radar and map type, or pass it along to the next map.

GoogMapV0.3.zip
  • Works great!  How do you change the zoom level of the map.  I would like to zoom out..

  • Great to see some development on this, I seem to remember that there was previously an issue with needing a license from Google to make use of this feature. Is this still the case, or is it ok to go ahead and configure?

  • I'm not entirely sure, actually - I haven't had a lot of time to look into it in detail. I'm assuming that there may still be the issue here from where google would be concerned since nowhere in this example do I use the API key. If my assumptions are right, I'll need to introduce the use of the API key into the integration to keep google happy. I just haven't had the time to go investigate further on how to take it to that next level.

  • Line 218. It's not the easiest thing to set, so you may have to play around with the values a little. This line sets the bounds using the lat & longs assigned to your nodes, so you can apply a little math to get these where you want to start. Try modifying that line so that it resembles these settings to start: new google.maps.LatLng(1.03*minlat, 1.1*maxlon), new google.maps.LatLng(maxlat, .9*minlon). That should get you moving in the right direction.

  • Ecellant! I've been hoping for this feature for a while. I was just going through the custom property editor and noticed that if I toggle the "show advanced properties" check box, lat and long are already there. (NPM 10.2.2)

  • I need a bit of help with this.  I have done all the integration part, but it seems I am having issues connecting to my DB.  I have updated the connection strings but still get an Error: 26.  I can connect remotely to the DB using the creds I am trying in the string, but still no avail.  Here is my string below, but if I check the frame source after loading the page I see a connection error to the DB.

    oConn = New System.Data.SQLClient.SQLConnection ("server=SOLWADM4\SOLWADM4; initial catalog=NetPerfMon;uid=USERID;pwd=PASSWORD")

    Am I missing something or did the connection string change if you are using SQL 2008 STD Edition? Where can I double check the Instance name I am using is correct?

  • Seems the string didn't like me using an Active Directory NT User account to login to the DB.  I created a SQL login and now have this working.  Just to clean up my Custom Properties now.

    Thanks for the integration.

    We are buying the Google API, so we will be changing this soon and doing integration internally using the API.

  • I need some help on this.  We have nodes that exisit in the US and nodes outside the US.  I have populated all the LAT&LONG for my nodes, but only the nodes in the US will populate.  I can't seem to get any nodes from other countries to show up.  I have even removed the AND Country='US' statement, but that only took all of my nodes off the map, and I was left with nothing.

    Also, wanted to know if there is a way to show the Warning status as well.  All I get are Up or Down statuses right now.  Great integration!!  Just need a bit of help since I am not a coder and working blind.

  • Watch out using the Advanced Properties for Latitude.  This is misspelled using the pre-built Custom Property you can find under the Show Advanced Properties, and won't work unless you update the code to see the incorrect spelling.  I had to work on this for 2 hours trying to find why it wasn't pulling nodes to my map until I realized that the code was looking for Latitude and my added property from Advanced Properties in the Editor with the incorrect spelling of Lattitude.