1 Reply Latest reply on May 12, 2018 10:34 PM by wfriesn1

    IPAM Search - Extensions For You

    TinyElvis

      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>

        • Re: IPAM Search - Extensions For You
          wfriesn1

          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