cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Product Manager
Product Manager

ASP.NET GURU Needed for NetBotz Orion integration help

Jump to solution

I've been asked to find a way to more tightly integrate our NetBotz/WallBotz units into Orion. We already have the Custom MIB's working great and we are actively working on alert configurations. The one thing I can't seem to figure out is how to include the Camera image in the Node details page of Orion using the custom HTML resource object.


You can access the live image from any NetBotz directly at the URL below.


http://netbot.nameor.ip/images/nbOwlEnc_0_CAMERA/QVGA/campic.jpg


This would be a simple html client side include if it wasn't for the basic auth on the NetBotz unit. (Prompts for NetBotz username & password). I've researched potential easy fix solutions such as passing the username & password in the url but that feature isn't supported by the NetBotz units.


I've been playing around using the WebClient in ASP.NET. I know what I'm trying to do can be done, but I'm afraid I'm not knowledgeable enough in ASP.NET to get it working.


I don't have anything more then a very basic understanding... For instance.. 



  wc.DownloadFile ("http://netbot.nameor.ip/images/nbOwlEnc_0_CAMERA/QVGA/campic.jpg",
                   "campic.jpg");


The code above theoretically should download the file I need...



   string username = "NetBotzusername";
  string password = "NetBotzpassword";
  wc.Credentials = new NetworkCredential (username, password);


and the code above should define the username and password to be used to download the image from the NetBotz.


Are there any ASP gurus out there who might know how to retrieve an image from a remote web server that's behind basic auth and display it? Any help would be appreciated. Thanks.


Tags (1)
0 Kudos
1 Solution

I finally got it working guys!  Javascript was not working out for me so I took a step back and approached the problem a little differently.

Here are the steps you need to follow:

1. On the monitoring page you want to display your Netbotz stream, hit the Cutomize Page button.
2. Press the Green + sign and add a Custom HTML box under the Miscellaneous category.
3. Now go back to the the monitoring page and hit the edit button on the HTML box you just added.
4. Add this code.  This code is set to poll the image from your Solarwinds server every 1 second.  Replace "solarwindsserver" with the name of your server in both URLs:

<!-- Netbotz Image Refresh Code Begin -->
      
      <IMG src="http://solarwindsserver/networkatlas/campic.jpg" name="refresh">
      <SCRIPT language="JavaScript" type="text/javascript">
      <!--
      var t = 1 // interval in seconds
      image = "http://solarwindsserver/networkatlas/campic.jpg" //name of the image
      function Start() {
      tmp = new Date();
      tmp = "?"+tmp.getTime()
      document.images["refresh"].src = image+tmp
      setTimeout("Start()", t*1000)
      }
      Start();
      // -->
      </SCRIPT>

<!-- Netbotz Image Refresh Code End -->


Now you need to setup the image to be staged in the Inetpub directory on the Solarwinds server:

1. Download wget 1.11.4 (http://users.ugent.be/~bpuype/wget/)
2. Copy wget to the Inetpub folder.  I chose to put in in an existing directory:  C:\Inetpub\SolarWinds\NetworkAtlas
3. Create a new file in this directory called cam.vbs.  The contents of this VBscript file should be:

Set WshShell = WScript.CreateObject("WScript.Shell")
Do
      WshShell.Run ("wget -m -nd --http-user=admin --http-passwd=password http://xxx.xxx.xxx.xxx/images/nbEyeEnc_0_CAMERA/VGA/campic.jpg")
      WScript.Sleep(1000)
Loop

Depending on what model Netbotz or Wallbotz you have, the URL will change.  nbEyeEnc_0 denotes the integrated cam on a Netbotz.  You can easily grab your exact URL by logging into the Netbotz normally and right clicking, going to properites, and copying the URL for the image you want.  The VBscript uses wget to go out to the Netbotz, authenticate, and download the image to the Solarwinds web server every 1 second.  You can adjust the time by changing the 1000 to however many milliseconds you want.

4. Now create a scheduled task in Task Scheduler and point it at C:\Inetpub\SolarWinds\NetworkAtlas\cam.vbs.  Set it to run on system startup.  Run it manually if you like to get it going.

Done!  Now if you visit your monitoring page, you should see a live stream from your locked down NetBotz!  Added bonus your camera credentials are not exposed in your code in plain text and the performance hit on the server from this script running every second is only 6 MB.

View solution in original post

0 Kudos
4 Replies

I understand this post is pretty old, so please don't flame me.

 

The solution provided works well. But is there a tweak that can be made to the code that will also allow it to work in Internet Explorer?  My workstation is currently running IE8.

I figure a lot of users will be using IE by default.

Thank you for all your time and help!

Regards,

Kenny

0 Kudos
Level 8

Was anyone ever able to get an APC Netbotz to pass credentials?  I read in this thread and it looks passing credentials in the URL works in Firefox but not in IE.

http://www.apc-forums.com/thread.jspa?threadID=3117&tstart=0

The only option is to write a script for this that holds the credentials and passes them.

0 Kudos

It seems the only way to pass Netbotz credentials is using Java script:

http://www.peej.co.uk/articles/http-auth-with-html-forms.html

0 Kudos

I finally got it working guys!  Javascript was not working out for me so I took a step back and approached the problem a little differently.

Here are the steps you need to follow:

1. On the monitoring page you want to display your Netbotz stream, hit the Cutomize Page button.
2. Press the Green + sign and add a Custom HTML box under the Miscellaneous category.
3. Now go back to the the monitoring page and hit the edit button on the HTML box you just added.
4. Add this code.  This code is set to poll the image from your Solarwinds server every 1 second.  Replace "solarwindsserver" with the name of your server in both URLs:

<!-- Netbotz Image Refresh Code Begin -->
      
      <IMG src="http://solarwindsserver/networkatlas/campic.jpg" name="refresh">
      <SCRIPT language="JavaScript" type="text/javascript">
      <!--
      var t = 1 // interval in seconds
      image = "http://solarwindsserver/networkatlas/campic.jpg" //name of the image
      function Start() {
      tmp = new Date();
      tmp = "?"+tmp.getTime()
      document.images["refresh"].src = image+tmp
      setTimeout("Start()", t*1000)
      }
      Start();
      // -->
      </SCRIPT>

<!-- Netbotz Image Refresh Code End -->


Now you need to setup the image to be staged in the Inetpub directory on the Solarwinds server:

1. Download wget 1.11.4 (http://users.ugent.be/~bpuype/wget/)
2. Copy wget to the Inetpub folder.  I chose to put in in an existing directory:  C:\Inetpub\SolarWinds\NetworkAtlas
3. Create a new file in this directory called cam.vbs.  The contents of this VBscript file should be:

Set WshShell = WScript.CreateObject("WScript.Shell")
Do
      WshShell.Run ("wget -m -nd --http-user=admin --http-passwd=password http://xxx.xxx.xxx.xxx/images/nbEyeEnc_0_CAMERA/VGA/campic.jpg")
      WScript.Sleep(1000)
Loop

Depending on what model Netbotz or Wallbotz you have, the URL will change.  nbEyeEnc_0 denotes the integrated cam on a Netbotz.  You can easily grab your exact URL by logging into the Netbotz normally and right clicking, going to properites, and copying the URL for the image you want.  The VBscript uses wget to go out to the Netbotz, authenticate, and download the image to the Solarwinds web server every 1 second.  You can adjust the time by changing the 1000 to however many milliseconds you want.

4. Now create a scheduled task in Task Scheduler and point it at C:\Inetpub\SolarWinds\NetworkAtlas\cam.vbs.  Set it to run on system startup.  Run it manually if you like to get it going.

Done!  Now if you visit your monitoring page, you should see a live stream from your locked down NetBotz!  Added bonus your camera credentials are not exposed in your code in plain text and the performance hit on the server from this script running every second is only 6 MB.

View solution in original post

0 Kudos