IPAM Search - Extensions For You

OK - so IPAM, for some crazy reason, doesn't search the Display Name or Description of a subnet or supernet.  It only searches for nodes.  Which, in my opinion, is completely useless and is a major, major flaw in this software.

Before we moved forward in combining two organizations, I was tasked with coming up with a solution for IPAM software.  We settled on SW (we already use it) but we had to get this flaw fixed before we moved forward.  So - I had to figure out how to do this...

I present to you, my fellow Thwackers - a basic search function for solarwinds that allow you to search Display Names and Descriptions - and also click on those links and take you right to the source in IPAM.

Hopefully you're somewhat familiar with ASPX coding and able to follow along.  On the second page (OfficeSearchResults.aspx) you will need to make a databind to the IPAM database.  

I'm no coder, and I'm not sure I can be of much help, but I can tell you this works very well, and has allowed us to get the software to function as it should.  I can search for "10.176." and it will show me all the subnets and supernets that have 10.176. in them.. which is waaay more helpful than showing me all the nodes with 10.176 in them.  I realize this may be very sloppy code for professionals, but hey.. I'm a network guy, not a coder.

Anyway, hopefully this will translate for everyone and you can get this to work on your side and you can extend it.  I have broken this down to the basic parts here, but I've used it to include searching for extra custom fields, like State, Country, etc.  Searching in the country field for "France" -- gives me all the subnets in France.  Quite nice.  The demo below is only for Display name and Description.

--Ron

First is the search page - very basic - you can add whatever you want... here I am only searching Display Name and Description (Office Name)

<body>

<form id="form1"  method="get" action="/OfficeSearchResults.aspx" style="width: 436px">

  <table>

  <tr>

       <td>Display Name<br />

            <input type="text" class="tb5"  style="width: 198px; height: 33px" name="DisplayName" title="DisplayName" id="DisplayName" tabindex="1" />

        </td>

       <td>Office Name<br />

            <input type="text" class="tb5"  style="width: 198px; height: 33px" name="OfficeName" title="Comments" id="OfficeName" tabindex="2"/>

       </td>

  </tr>

  <tr>

       <td colspan="2"> </td>

  </tr>

  <tr>

       <td style="height: 30px" colspan="2" class="auto-style1"><input type="submit" value="Search"  tabindex="3" class="Reportbutton"></td>

  </tr>

  </table>

</form>

</body>

Next - the office search results page:

This page name is referenced above as "OfficeSearchResults.aspx"

<head>

<meta content="text/html; charset=windows-1252" http-equiv="Content-Type" />

  <title>Office Portal</title>

  <script language="javascript">

  function GoToIPAM(groupID){

      var newURL = "http://IPAM.Mycompany.com/Orion/IPAM/Subnets.aspx?opento=" + groupID;

  window.open(newURL,"_top");

  }

  </script>

</head>

<body>

<div style="position: absolute;visibility:visible;  left: 141px; top: 57px; right: 77px; height: 413px;" >

   <asp:SqlDataSource ID="SqlDataSource1" runat="server" CancelSelectOnNullParameter="False"

      ConnectionString="<%$ ConnectionStrings:IPAM_ConnectionString %>"

      SelectCommand="SELECT IPAM_GroupReportView.FriendlyName AS [Display Name],  IPAM_GroupAttrData.Common_Name as Office_Name,  IPAM_GroupReportView.GroupID

      FROM IPAM_GroupReportView LEFT OUTER JOIN IPAM_GroupAttrData ON (IPAM_GroupReportView.GroupId = IPAM_GroupAttrData.GroupId)    

      WHERE ( IPAM_GroupReportView.friendlyname like '%' + @DisplayName + '%' ) or (  IPAM_GroupAttrData.Common_Name like '%' + @OfficeName + '%')" >

  <SelectParameters>

          <asp:QueryStringParameter Name="DisplayName" QueryStringField="DisplayName" DefaultValue="" Type="String"  ConvertEmptyStringToNull="True"   />

          <asp:QueryStringParameter Name="OfficeName" QueryStringField="OfficeName" DefaultValue="" Type="String"  ConvertEmptyStringToNull="True"   />

       </SelectParameters>    

   </asp:SqlDataSource>

  <table class="tableboarders"  style="width: 658px; height: 197px; cellpadding=5px; ">

  <tr>

  <%

    Dim OfficeSearchCriteria

    If (request.querystring("Displayname")) <> "" Then

        OfficeSearchCriteria = (request.querystring("DisplayName"))

    Else

        OfficeSearchCriteria = (request.querystring("OfficeName"))

    End If

  %>

  <td  class="HeaderStyle" colspan="2" style="height: 23px; width: 1141px;">Office Search: <% response.write(OfficeSearchCriteria) %> </td>

  </tr>

  <tr>

  <td colspan="2" style="width: 1141px">

  <form id=Form1 runat="server">

    <asp:GridView runat="server" id="GridView1" DataSourceID="SqlDataSource1"  CellPadding="4"

        Font-Name="Verdana"

        Font-Size="12px"

        AutoGenerateColumns="False"

        HeaderStyle-HorizontalAlign="Center"

        HeaderStyle-Font-Bold="True"

        HeaderStyle-BackColor="Navy"

        HeaderStyle-ForeColor="White"

        AlternatingItemStyle-BackColor="#dddddd"  GridLines="None" Width="634px" Font-Names="Verdana" ForeColor="#333333">

        <AlternatingRowStyle BackColor="White" />

        <Columns>

          <asp:TemplateField HeaderText="IP Addressing" >

          <ItemTemplate>

               <a href='javascript:GoToIPAM(<%#Eval("GroupID")%>)'><%#Eval("Display Name")%></a>

          </ItemTemplate>

          </asp:TemplateField>

          <asp:TemplateField HeaderText="Office Name" >

          <ItemTemplate>

               <%#Eval("Office_Name")%>

          </ItemTemplate>

          </asp:TemplateField>

        </Columns>

    <EditRowStyle BackColor="#2461BF" />

                       <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />

  <HeaderStyle HorizontalAlign="Center" BackColor="#507CD1" Font-Bold="True" ForeColor="White"></HeaderStyle>

                  <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />

                       <RowStyle BackColor="#EFF3FB" />

                       <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />

                       <SortedAscendingCellStyle BackColor="#F5F7FB" />

                       <SortedAscendingHeaderStyle BackColor="#6D95E1" />

                       <SortedDescendingCellStyle BackColor="#E9EBEF" />

                       <SortedDescendingHeaderStyle BackColor="#4870BE" />

    </asp:GridView>

  </form>

   </td>

  </tr>

  </table>

</div>

</body>

  • Hi. I am trying your sample code and so far not getting it to work.

    1) Did you have to hard code credentials in the database connect string? I have setup a Web.config file with the database server and database name but I am getting a login error now.

    2) Maybe this is not right approach but I added a custom html widget to the IPAM Summary Page and put the form html into that. However when I click on search it just reloads the same page.

    I created a directory under C:/inetpub/SW_CustomHTML and added this directory as a virtual directory under IIS called Local. I have the aspx file and the Web.config file in that directory. I updated the form to call the script at sitename:/Local.

    Anyone have suggestions?

    Thanks

    Wes

  • wow... sorry for the late response.  I'm guessing you found something else to work or abandoned this...  but yeah, I had to create a connection string on the server to the database.

  • Rather than going down this route, simply use the Widget that will provide the search function and listing for you; Custom Query.

    You will need to update the query to utilise SWQL (sorry I do not have access to an installation to recode), but should be straightforward from memory on the SWQL entity names.

    Here is a blog post on of my colleagues wrote on the use of this widget - SolarWinds Orion Custom Query Resource - A Hidden Gem! | Prosperon Networks

    GL

  • I did get it working and tweaked to meet my needs. Thanks for the example to work from.

  • This is the only technique I have found to add some useful search functionality to IPAM. Solarwinds seems to be not inclined to fix the lame search function it has now. I'm just hoping I can figure out the ASPX thing.

    Even the IPAM API has no search functionality and no way to extend it to add some. Some people have commented that IPAM is useless for providers; I think it's nearly useless as it is for any organization with more than a handful of subnets.

  • You are mistaken that the api has no ability to search.   It's not specific to the ipam section of the api,  but everything in the orion database is searchable.   I'm on my phone at the moment so I can't paste in a code example,  but I have made many search tools for ipam subnets in the past.  As mentioned in the post by m_roberts and antonis.athanasiou you can build a custom widget to search basically anything you want in orion.

    Custom aspx resources are just too much hassle compared to just loading up swql studio, hitting the search bar and finding the places in the schema where the data you need is stored.

  • It's a handy feature, but beware of the case sensitivity.

    There is a feature request for a SWQL UPPER or LOWER function to supply this kicking around.

  • SWQL has had TOUPPER() and LOWER for a while

    SWQL Functions · solarwinds/OrionSDK Wiki · GitHub

    and the swql searches are not case sensitive unless you make them that way, its just using a normal LIKE on the back end in most cases.

  • Yes, you are right, the Orion SDK can search the IPAM database. Still a little less than thrilled to have to roll our own basic search functions for an application I'm told we pay a lot of money for. But I was incorrect before.

  • To be honest with Orion it is one of the strengths/curses.  You can roll your own anything so you aren't limited to just using the tool the way the devs thought you would.  Down side is that you end up mucking around a lot reinventing parts of the program that you wish they had done your way in the first place.  EVERY chance I get I tell the UX team that every widget needs a search, and any time they think that the UI makes sense in their lab they need to see how they will use that page when they have over 10,000 of whatever that object it. 

    It's one of my own pet peeves.