cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 12

NCM Global Device Defaults Table & Connection Profile in SWQL

Jump to solution

I found the Global Device Defaults in the NCM_GlobalSettings table through SQL Server Management Studio but cannot find it in SWQL Studio.  Does anyone know the table name in SWQL Studio?

Also trying to find where the Connection Profiles are stored in SWQL Studio.  Found this one through SQL SMS as well at NCM_ConnectionProfiles.  Does anyone know the table name in SWQL Studio?

Maybe while I am at it, I should also ask if there is a way in SWQL to search all tables for a field name or value.  Anyone help with that?

Tags (3)
0 Kudos
1 Solution

Dealing with XML is messy, and dealing with this particular XML is worse than usual because "ID" is a keyword and appears both as an attribute and an element name.  But here is how you could extract the ID and name from the connection profiles:

Import-Module SwisPowerShell


# Connect to SWIS.

$hostname = "myserver"

$username = "admin"

$password = "mySecretPassword"

$swis = Connect-Swis -host $hostname -Username $Username -Password $Password


# Get the connection profiles.

$profiles = Invoke-SwisVerb $swis Cirrus.Nodes GetAllConnectionProfiles @()


# Extract the ID and name for each profile.  Write them out.

foreach ($profile in $profiles.ConnectionProfile) {

    $id = ($profile.ChildNodes | Where-Object LocalName -EQ "ID").InnerText

    $name = $profile.Name.InnerText


    Write-Host "$id : $name"

}

View solution in original post

12 Replies
Level 12

Bump...  See middle paragraph from original post for still unanswered question.  TIA

0 Kudos

when you searched SWQL Stuido for connectionprofile, there should have been a few hits.

0 Kudos

Hits reveal columns in Cirrus.NodeProperties, Cirrus.Nodes and NCM.NodeProperties as well as verbs in CirrusNodes.  However all of those just hold the integer referencing the Connection Profile and none show the details of that Connection Profile.  I want the ability to translate from the integer to the name of the Connection Profile.

0 Kudos

I see what you mean. I recommend invoking the verb: GetAllConnectionProfiles

Try this in Python:

profiles = swis.invoke('Cirrus.Nodes', 'GetAllConnectionProfiles')

Then print out the results and manipulate the data as needed.

Cheers

0 Kudos

Appreciate the help @clarv02!!!

In PowerShell I used:

          $Profiles = Invoke-SwisVerb $OrnSwis Cirrus.Nodes GetAllConnectionProfiles @()

and piping to Out-String gives me:

          Id                              : 1

          Size                          : 1

          xmlns                        : http://schemas.datacontract.org/2004/07/SolarWinds.InformationService.Contract

          d1p1                          : http://schemas.solarwinds.com/2007/08/informationservice/propertybag

          i                                 : http://www.w3.org/2001/XMLSchema-instance

          z                                : http://schemas.microsoft.com/2003/10/Serialization/

          ConnectionProfile      : ConnectionProfile

However I am not seeing the Profile "Name" there which is what I am trying to get to.  Also not seeing the other columns seen through SQL in NCM.ConnectionProfiles.

Will admit that I am new to manipulating XmlElement as well.  Maybe that is why I am not seeing what I am looking for.

Have also been trying to figure out how to extract from an XmlElement with no luck.  Everything I have been able to find on working with XmlElement is assuming you know the Xml structure because you have a file you imported to PowerShell to do what they are  talking about.  Obviously this XmlElement did not come from a file.

If you can help me out with these challenges, I would be greatly appreciated.

0 Kudos

Dealing with XML is messy, and dealing with this particular XML is worse than usual because "ID" is a keyword and appears both as an attribute and an element name.  But here is how you could extract the ID and name from the connection profiles:

Import-Module SwisPowerShell


# Connect to SWIS.

$hostname = "myserver"

$username = "admin"

$password = "mySecretPassword"

$swis = Connect-Swis -host $hostname -Username $Username -Password $Password


# Get the connection profiles.

$profiles = Invoke-SwisVerb $swis Cirrus.Nodes GetAllConnectionProfiles @()


# Extract the ID and name for each profile.  Write them out.

foreach ($profile in $profiles.ConnectionProfile) {

    $id = ($profile.ChildNodes | Where-Object LocalName -EQ "ID").InnerText

    $name = $profile.Name.InnerText


    Write-Host "$id : $name"

}

View solution in original post

Perfect...!!!  Worked like a champ.

0 Kudos

sorry my PowerShell skills are beginner, and all the SolarWinds API work I've done has been in Python. Here's what I get back from invoking GetAllConnectionProfiles in Python:

(scrubbed of course)

a list of dictionaries, each one representing a Connection Profile, like this one:

{'EnableLevel': '<No Enable Login>',

  'EnablePassword': 'someCrypticPwd',

  'ExecuteScriptProtocol': 'SSH auto',

  'ID': 4,

  'Name': 'theProfileName',

  'Password': 'someCrypticPwd',

  'RequestConfigProtocol': 'SSH auto',

  'SSHPort': 22,

  'TelnetPort': 23,

  'TransferConfigProtocol': 'SSH auto',

  'UseForAutoDetect': False,

  'UserName': 'some_user'}

0 Kudos
Level 12

Never mind on the GlobalSettings question.  Figures as soon as I post it, after looking for several hours over several days, there it is.  Found at Cirrus.GlobalSettings.  Was looking previously under NCM.  Still would like the other question answered if possible.

0 Kudos

0FE3D8A5-9601-4AFC-B08B-FB4D2B284ECD.jpeg

There is a search function. It’s easy to overlook:

sorry about the massive screenshot. I didn't look nearly that huge on my phone.

0 Kudos

Wow clarv02​... LOL.  I searched through all the menus and found nothing.  Now you point it out and it is plain as day, right in front of my face.  Thanks.

0 Kudos