Rediscover display names

To the Ipswitch web site

Ipswitch Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Rediscover display namesExpand / Collapse
Author
Message
Posted 3/14/2007 9:11:06 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 3/11/2008 11:05:03 AM
Posts: 13, Visits: 8
One of my locations has 50+ switches and they decided to change their hostname naming convention. Now I have a bunch of misnamed devices in whatsup. The display name is typically discovered during the initial discovery if SNMP is configured; however, is there a way to "re-discover" the display name of the device while still maintaining all of its monitors, actions, etc such as through a polling script? I can obviously manually change each individual switch display name, but that would be time consuming.

Thanks,
-Andy
Post #29626
Posted 3/14/2007 10:52:51 AM


Time Traveler

Time TravelerTime TravelerTime TravelerTime TravelerTime TravelerTime TravelerTime TravelerTime Traveler

Group: Forum Members
Last Login: Today @ 1:50:07 PM
Posts: 348, Visits: 6,611

Hi!

Download the script "Update Name" from the Ipswitch Active Script page ( http://www.ipswitch.com/support/whatsup_professional/scripts/index.asp ), or just cut and paste it into WhatsUp ;-) :

// Name: Update device name
// Description: Update device name based on SNMP sysName variable
// Language: JScript

var oSnmpRqst =  new ActiveXObject("CoreAsp.SnmpRqst") ;

var nDeviceID = Context.GetProperty("DeviceID") ;

var oResult = oSnmpRqst.Initialize(nDeviceID) ;

if (oResult.Failed) {
  Context.SetResult(1, "Initialization error " ) ;
}
else {
 var oResult = oSnmpRqst.Get("1.3.6.1.2.1.1.5.0"); // sysName.0
 if (oResult.Failed) {
 Context.SetResult(1, "Couldn't get sysName.0 variable" ) ;
 }
 else {
    var oDb = Context.GetDB ;
    
    if (oDb == null) {
     Context.SetResult(1, "DB Connection error" ) ;
    }
    else {
     var oRs = new ActiveXObject("ADODB.Recordset");
     var sSql = "UPDATE Device SET sDisplayName='" + oResult.GetPayload + "' WHERE nDeviceID = " + nDeviceID;
     oDb.Execute (sSql) ;
    } 
   }
}

Regards, LLS71



---
Leonardo Schieder
A. PORR AG - http://www.porr.at
System Management

http://www.xing.com/go/invita/7686498

Post #29639
Posted 3/15/2007 2:20:57 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 3/11/2008 11:05:03 AM
Posts: 13, Visits: 8
Perfect, that did exactly what I needed it to. Very helpful little script.
Thank you.
Post #29743
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Dave, Mark Singh, kevin r gillis, Jason Benton, Brandon Felger, Ben Henderson, Tripp Allen, Will Sansbury, Jason Williams, Hush, FTPplanet.com, Hugh Garber, George Dailey, WUP-PM, mmulryan@ipswitch.com, mswimm

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 2:15pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.141. 10 queries. Compression Enabled.