Submit a ticketCall us

Training ClassSign up for Network Performance Monitor (NPM) and Scalability instructor-led classes

Attend our instructor-led classes, provided by SolarWinds® Academy, to discuss the more advanced monitoring mechanisms available in NPM as well as how to tune your equipment to optimize its polling capabilities. NPM classes offered:
NPM Custom Monitoring and Polling
Orion Platform Scalability

Reserve your seat.

Home > Success Center > Kiwi CatTools > Kiwi CatTools Documentation > Kiwi CatTools 3.11 Administrator Guide > API > CatTools API Classes > CatTools Device class > Sample code for using the CatTools API Device object

Sample code for using the CatTools API Device object

Table of contents
No headers
Created by Caroline Juszczak, last modified by Caroline Juszczak on Jun 28, 2016

Views: 290 Votes: 0 Revisions: 1

Sample VB code showing you how to use the Device object of the CatTools API to add, edit or delete an entry in the database.

 

Add

Dim DB As CatToolsAPI.Database

Dim Device As CatToolsAPI.Device

 

Set DB = New CatToolsAPI.Database

If DB.OpenConnection Then

Set Device = DB.Devices.AddNew("Cisco.Router.General")

If Not Device Is Nothing Then

Device.Name = "My Device 01"

Device.HostAddress = "192.168.1.1"

Device.Group = "My Test Group"

Device.RequireVTYLogin = True

Device.VTYPass = "My Password"

Device.ConnectionMethod = "Telnet"

If DB.Devices.SaveDevice(Device) Then

Debug.Print Device.Name & " saved to the database OK."

Else

Debug.Print "Adding " & Device.Name & " failed: " & DB.ErrDescription

End If

Else

Debug.Print "Creation of a new device failed: " & DB.ErrDescription

End If

Else

Debug.Print "DB connection failed: " & DB.ErrDescription

End If

 

Set Device = Nothing

Set DB = Nothing

 

Edit

Dim DB As CatToolsAPI.Database

Dim Devices As CatToolsAPI.Devices

Dim Device As CatToolsAPI.Device

 

Set DB = New CatToolsAPI.Database

If DB.OpenConnection Then

Set Devices = DB.Devices

Set Device = Devices.GetByName("My Device 01")

If Not Device Is Nothing Then

Debug.Print Device.Name & " Loaded OK"

Device.AAAPassword = "My New Password "

If Devices.SaveDevice(Device) Then

Debug.Print ??Device.Name & " saved OK"

Else

Debug.Print Device.Name & " NOT saved: " & DB.ErrDescription

End If

Else

Debug.Print "Device not found"

End If

Else

Debug.Print "DB connection failed: " & DB.ErrDescription

End If

 

Set Device = Nothing

Set Devices = Nothing

Set DB = Nothing

 

Delete

Dim DB As CatToolsAPI.Database

 

Set DB = New CatToolsAPI.Database

If DB.OpenConnection Then

If DB.Devices.DeleteByName("My Device 01") Then

Debug.Print "Deleted OK"

Else

Debug.Print "Delete failed: " & DB.ErrDescription

End If

Else

Debug.Print "DB connection failed: " & DB.ErrDescription

End If

 

Set DB = Nothing

Last modified

Tags

Classifications

Public