34 Replies Latest reply on Dec 19, 2016 11:13 AM by familyofcrowes

    Help converting ASP Resource to ASP.NET

    jbaulsir

      Can some help me convert this ASP Resource to ASP.NET?

      We're on the verge of upgrading to 9.5 but don't want to lose this functionality.

      It puts the HP Management Homepage on the node details page.

      JB

        • Re: Help converting ASP Resource to ASP.NET
          vhcato

          JB,

          We too have number of custom ASP resources that need to be converted. Some are very simple, and others are quite extensive and complex. I have yet to crack the code required to make them work now that the ASP proxy has been removed from 9.5, but if I figure it out, I'll certainly circle back around to this post again.

          Wish I could help... :(

          • Re: Help converting ASP Resource to ASP.NET
            tdanner

            Sure. I attached an asp.net version. Hopefully this will be helpful to others with resources to convert. Note: I added ".txt" to the end of the filename to make the forum happy. The proper file name should be "HPManagementHomePage.ascx". ASP.NET resources must have a .ascx extension.

            I should also point out that this resource is simple enough that you don't really need to bother with code at all. The Custom HTML Resource can do this job just fine. Add a Custom HTML Resource to your view, then click its EDIT button and enter this text:

                    <table width="100%">
                        <tr>
                            <td colspan="4">
                                <table border="0" cellpadding="2" cellspacing="0" width="100%">
                                    <tr>
                                        <td class="Property" width="10"> </td>
                                        <td class="PropertyHeader">HP Management Homepage</td>
                                        <td class="Property"> </td>
                                        <td class="Property"><a href="https://${IP_Address}:2381" target="_blank">https://${IP_Address}:2381</a> </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>

            The "${IP_Address}" macros will get replaced with the IP Address of the current node. This will work just fine in any version of Orion.

              • Re: Help converting ASP Resource to ASP.NET
                jrutski

                Tim- thanks for the input. Just to clarify:

                The old *.Resource files that were the classic ASP files must now be *.ascx files.

                Also, I assume as before they go in the respective location with respect to the type of view that they will be added to (summary, node details, etc)? -> .\Inetpub\SolarWindsNPM\Orion\NetPerfMon\Resources\*******

                  • Re: Help converting ASP Resource to ASP.NET
                    tdanner

                    Yes, that's right. Actually, in your path (.\Inetpub\SolarWindsNPM\Orion\NetPerfMon\Resources\*******) the "*******" doesn't affect what type of view they go in. That's controlled by the "RequiredInterfaces" property in the code for the resource. The "*******" directory just controls what group they go in on the Add Resource to View page.

                      • Re: Help converting ASP Resource to ASP.NET
                        jrutski

                        One last (and EXTREMELY complicated) question about the new .NET resources.

                        We used a classic ASP resource and several static tables in the database to create a sort of system inventory that was tied to each node- it just displayed some simple stats such as CPU type, Memory installed, etc. Being that my .NET knowledge accounts to about zero, I'm stabbing in the dark here.

                        With the classic ASP, the 'NetPerfMon.NewSQLResource' was used a ton...and I'm at a loss as to how to replicate that functionality. I can't find a similar function- I assume it's all embeded in the DLLs or somewhere else. While I'm sure it would be possible to set up a new connection to the DB simply to read some static data, I figured it would be easier to use something like the NewSQLResource...is there such a thing?

                        Thanks!

                        • Re: Help converting ASP Resource to ASP.NET
                          ecornwell

                          I was afraid the old .resource files would go away.  I did something special where I took the code from the interface details Min/Max/Average bps In/Out resource and put it in the Current Percent Utilization of Each Interface resource so that we could click a single link and get a current graph of each interface. 

                          It ended up working beautifully for some of the veiws we wanted.  I thought I looked at the .Net code for it but it was much more complicated.  I think I got lucky with the other.  I was hoping SW would add that as an option sometime.

                          Here is the file...

                            • Re: Help converting ASP Resource to ASP.NET
                              tdanner

                              ecornwall,

                              It sounds like you built a resource that you can stick on a Node Details view and get one chart for each interface on that node. Is that right?

                              I whipped up something like that (attached). It could be a lot fancier, but this gives you a basic one-chart-per-interface resource in a fairly small amount of code. This uses some of the techniques I used earlier in this thread: an ASP.NET Repeater control for a dealing with a sequence of items and the "CurrentNode" snippet.

                              The new stuff in this one: calling GetInterfaces() on the node to get a list of interfaces that can be bound to the Repeater, and building an <img> tag in the body of the Repeater. I took the URL for the image tag by copying the URL of the kind of chart I wanted, finding the spot in the URL that had the interface id (looks like "I:683") and replacing it with <%# Eval("NetObjectID") %>, which will get substituted for the current interface by the Repeater control.

                                • Re: Help converting ASP Resource to ASP.NET
                                  jrutski

                                  Tim- Thanks again for your help!!  I've been working with one of our web developers and learning some .NET...I must say it's MUCH nicer and easier to use once you know what you're doing. I will now be converting all of the old custom resources.

                                  Oh yea...and they're all in VB!!!

                                  • Re: Help converting ASP Resource to ASP.NET
                                    ecornwell

                                    That is correct!

                                    We actually had a link to it from the node details page so it didn't load every time.  We were really used to the view that MRTG with routers2.cgi gave us and wanted to do something emulate that.  If you looked at the one I did it was pretty simple.  We've been able to diagnose some random problems looking at all the ports on the switch at the same time before so we like to have the ability.

                                    I appreciate you working that up for me!  I think many in the coummunity will as well.  If it was something that could be easily added to the main product I think it could be helpful!

                                    • Re: Help converting ASP Resource to ASP.NET

                                      I'm also looking to replace MRTG... a co-worker wants to see the recent bandwidth utilization for all of our MPLS routers.  I was hoping to check out this code to see if it gets me closer to what I want, but I can't figure out where to put it and how to use it... some help?

                                      thanks

                                        • Re: Help converting ASP Resource to ASP.NET
                                          MathieuJM

                                          Hi,

                                          I would like to know how to use the TrafficOfEachInterface.ascx.txt file in order to try it.

                                           Regards

                                            • Re: Help converting ASP Resource to ASP.NET
                                              ecornwell

                                              Hello,

                                              First you'll need to remove the .txt extension.  After that there are a couple different ways you can do it, so I'll share what I did.

                                              1. Change 1 line in the file - Listed Below
                                              2. Put the file in: c:\Inetpub\SolarWinds\Orion\NetPerfMon\Resources\NodeDetails
                                              3. Create a new view with the TrafficOfEachInterface add and using a single column
                                              4. Edit the Node detials view and add a "User Links" object
                                              5. Edit the user links so that the first link is the link to the view you created
                                              6. (Optional) Change the title under User links to "Additional Node Resources"

                                              The line that needs changed is:

                                               

                                               



                                              protected override string DefaultTitle
                                                  {
                                                      get { return "HP Managememt Homepage"; }
                                                  }

                                               

                                               



                                              To something like:

                                               



                                              protected override string DefaultTitle
                                                  {
                                                      get { return "All Interface Traffic Chart"; }
                                                  }

                                               

                                               



                                              I hope that helps!

                                          • Re: Help converting ASP Resource to ASP.NET
                                            ecornwell

                                            The new stuff in this one: calling GetInterfaces() on the node to get a list of interfaces that can be bound to the Repeater, and building an <img> tag in the body of the Repeater. I took the URL for the image tag by copying the URL of the kind of chart I wanted, finding the spot in the URL that had the interface id (looks like "I:683") and replacing it with <%# Eval("NetObjectID") %>, which will get substituted for the current interface by the Repeater control.

                                            This has been working great but I ran into a use case where I need to set the date range for farther back.  (7 days, 30 days, etc.)  Would it be difficult to add the same drop down that is shown on the normal interface screen so that all the charts are updated to that same range?  I did some looking but I don't know nearly enough coding to get it to work.

                                            Thanks!

                                          • Re: Help converting ASP Resource to ASP.NET
                                            cweeklund

                                            What exactly do I need to do with that file to use that 98-interfaceutilizationchart view?  I tried saving it to a resources directory as an ascx file, but it doesn't show up as an available option when I choose to add to my views.

                                             

                                            Thanks!

                                    • Re: Help converting ASP Resource to ASP.NET
                                      ioan_bucsa

                                      So I've take a ASP.NET resource, modified it a bit and tried to add it to my website.

                                       

                                      I saved it as 06-<Resource_Name>.ascx under \Inetpup\SolarWinds\Resources\0-1-NodeLists. I then lauched the Configuration Wizard to recompile the website and after it's done it just deletes my file and I cannot find it under Resources.

                                       

                                      What am I doing wrong?

                                       

                                      PS: I'm using NPM 12.0.1.