quote:Originally posted by JMPNice function! I'm trying this out and have a question. It looks like the code is selecting how many nodes are down but in the text it states 'Number of Sites Down'. Should that say Nodes instead? Or is there some way to define a site?
quote:Originally posted by doug.rogersI have added a new resource called 04-CountofNodesDown.Resource and saved it in C:\Inetpub\SolarWinds\NetPerfMon\Resources\0-1-NodeLists.The resource is shown below.<!-- Title=Number of Down Nodes --><!-- Level=7 --><!--#include Virtual=/NetPerfMon/scripts/Resource.asp --><% Dim V1 Title=Resource.Title If Len(Title)=0 Then Title="Number of Down Nodes " SubTitle="The Following Number are Down" if Len(Resource.SubTitle)>0 Then SubTitle=Resource.SubTitle HelpPage="DownNodes" EditButton="/NetPerfMon/Resources/Filter.Edit.asp?ResourceID=" & Resource.ResourceID & "&ViewID=" & ViewID DoResourceHeader Set SQLResource = NetPerfMon.NewSQLResource SQLResource.SQL="Select COUNT(Nodes.Status) AS COS From Nodes Where Status='2'" SQLResource.Filter= Resource.GetProperty("Filter") SQLResource.Execute V1 = CInt(SQLResource.GetProperty("COS"))if V1 = 0 then%><table border="0" cellPadding="2" cellSpacing="0" width="100%"><tr><h1>All Connections UP</h1></tr></table><br><% else %><table border="0" cellPadding="2" cellSpacing="0" width="100%"><tr><h1>Number of Sites Down : <%= SQLResource.GetProperty("COS") %></h1></tr></table><br><% end if %>This can be added to any view that is being createdDoug RogersInfrastructure ManagerNetstore
Does anyone have any screenshots of this code implemented?
I just wanna get a few ideas of how to inmplement this.
Thanks.
Hi mate, I was wondering can you send me the script that counts how many nodes are down for each customer or site.
Has anyone looked at this topic in a while? It seems the file structure has changed a bunch over the years and the asp.net stuff isn't exactly working like the old asp code.
I'm trying to do some customization and the solarwinds pages are proving to be a lot more tricky than I had previously thought they would be. My only real web experience is with php/mysql and I'm struggling to dig through the db calls in order to be able to emulate what is being done.
Can someone clue me in on a basic "hello world" type sql connection that just retrieves a list of down nodes and reads them into an array and/or spits them out on a page?
Maladil,
Here is a simple page i wrote that i use in a mashup. It doesnt show nodes up or down. It shows me what nodes i have assigned to sites. But this example should be sufficient for you to go on. You can always edit the 'sql query' and the corresponding 'Container.DataItems' to return and present the data how ever you like. The alternating row color just makes it eaiser for me to read.
<%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.SqlClient" %>
<Script Runat="Server"> Sub Page_Load dim dbconn AS SqlConnection dim dbcomm AS New SqlCommand dim dbread AS SqlDataReader dim cmdSelectNodes AS String
dbconn=New SqlConnection("Server=vm-1oriondbt;uid=mashup;pwd=p@ssw0rd;database=NPMt" ) dbconn.Open() cmdSelectNodes= "Select Nodes.Caption, Nodes.IP_Address, Sites.SiteName, Nodes.SiteID From Nodes, Sites Where (Nodes.SiteID IS NOT NULL) And (Nodes.siteID = Sites.SiteID)" dbcomm=New SqlCommand(cmdSelectNodes,dbconn) dbread=dbcomm.ExecuteReader() Nodes.DataSource=dbread Nodes.DataBind() dbread.Close() dbconn.Close()End Sub
</Script>
<head> <title>SolarWinds / GoogleMaps Node Assignment</title><script type="text/javascript">function altRows(id){ if(document.getElementsByTagName){ var table = document.getElementById(id); var rows = table.getElementsByTagName("tr"); for(i = 1; i < rows.length; i++){ if(i % 2 == 0){ rows.className = "evenrowcolor"; }else{ rows.className = "oddrowcolor"; } } }}
window.onload=function(){ altRows('alternatecolor');}</script>
<style type="text/css">table.altrowstable { font-family: arial,sans-serif; font-size:13px; color:black; border-width: 2px; border-color: #787878; border-collapse: collapse;}table.altrowstable th { border-width: 2px; padding: 3px; border-style: solid; border-color: #787878;}table.altrowstable td { border-width: 2px; padding: 3px; border-style: solid; border-color: #787878;}.oddrowcolor{ background-color:#FBECDA;}.evenrowcolor{ background-color:lightgrey;}</style></head><html> <body background="../Maps/images/GoogleMapBackground.jpg"> <h2 align="center"><font color="darkblue"><b>Nodes currently assigned to sites...</b></font></h2> <form runat="server"> <asp:Repeater id="Nodes" runat="server"> <HeaderTemplate> <table width="100%" bgcolor="e0ffff" class="altrowstable" id="alternatecolor"> <tr> <th>Hostname</th> <th>IP Address</th> <th>Site Assignment</th> <th>Site ID</th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td align="leftr"><%#Container.DataItem("Caption")%></td> <td align="center"><%#Container.DataItem("IP_Address")%></td> <td align="center"><%#Container.DataItem("SiteName")%></td> <td align="center"><%#Container.DataItem("SiteID")%></td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> </form> </body></html>
scott
Thanks everyone. I got my page working as a stand alone. It was a lot harder than I thought it would be. Now I'm trying to figure out how to get it to work with a CustomHTML field. If that is too difficult, then can someone point me to a way to add the Solarwinds Header and Menu bar to the top of my custom page? Here's my code if anyone is curious.
<%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.SqlClient" %><Script Runat="Server"> Sub Page_Load dim dbconn AS SqlConnection dim dbcomm AS New SqlCommand dim dbread AS SqlDataReader dim cmdSelectNodes AS String dbconn=New SqlConnection("Server=165.X.x.x;uid=x;pwd=x;database=NetPerfMon" ) dbconn.Open() cmdSelectNodes= "Select Nodes.NodeID, Nodes.Caption, Nodes.IP_Address, Nodes.Site_ID, Nodes.Lattitude, Nodes.Longitude, Nodes.Location_Type, Nodes.Alert_Importance, Nodes.MachineType From Nodes Where ( Nodes.Status = 2 ) AND ( Nodes.Lattitude IS NOT Null)" dbcomm=New SqlCommand(cmdSelectNodes,dbconn) dbread=dbcomm.ExecuteReader() Nodes.DataSource=dbread Nodes.DataBind() dbread.Close() dbconn.Close()End Sub </Script><html><head><title>SolarWinds / GoogleMaps Node Assignment</title><link href="">code.google.com/.../default.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="">maps.google.com/.../js <form runat="server"> <asp:Repeater id="Nodes" runat="server"><HeaderTemplate><script type="text/javascript">var map = null;function initialize() { var myOptions = { zoom: 5, mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, navigationControl: true, center: new google.maps.LatLng(38, -95), mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addListener(map, 'click', function() { infowindow.close(); }); </HeaderTemplate> <ItemTemplate> var caption = "<%#Container.DataItem("Caption")%>"; var point = new google.maps.LatLng(<%#Container.DataItem("Lattitude")%>, <%#Container.DataItem("Longitude")%>); var node_url = '<b>Node : </b> <a href=""NodeID")%>"+'">'+caption+"<a/>">thwack.solarwinds.com/.../NodeDetails.aspx is down."; var contentString = '<div id="content">'+node_url+"<br />IP = <%#Container.DataItem("IP_Address")%><br />Location type = <%#Container.DataItem("Location_Type")%>"+ "<br />Device Type = <%#Container.DataItem("MachineType")%></div>"; var marker = createMarker(point, caption , contentString); </ItemTemplate> <FooterTemplate>}var infowindow = new google.maps.InfoWindow( { }); function createMarker(latlng, mark_title, html) { var contentString_marker = html; var marker = new google.maps.Marker({ position: latlng, map: map, title: mark_title }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(contentString_marker); infowindow.open(map,marker); });}</script></FooterTemplate> </asp:Repeater></form></head><body onload="initialize()"> <div id="map_canvas" style="width: 1400px; height: 800px;"></div> </body></html>