Path Scoped Projection - GoToAssist Monitoring

GoToAssist Monitoring Service Status

Service Fully Operational

***Our GoToAssist maintenance window is Wednesday or Friday 6:00am-10:00am GMT. A maintenance generally results in 5-10 minutes of downtime during the beginning of the maintenance window.***

Updated: Wed, Oct 17 2012 2:27 PM RSS Feed

Find an Answer

Search GoToAssist Monitoring articles, videos and user guides   Your search term must have 2 or more characters.

Browse Articles

Path Scoped Projection

Like the path-scoped predicate, the path-scoped projection is a tool for limiting the search to find more relevant information without losing the relationships between different pieces of information.

Example 1: Projecting the path through the SELECT clause

A simple example of a path-scoped projection is the following query where the path projects through — or restricts — the SELECT clause:

SELECT interface/(mac_address, name)                
FROM /network/device

This query finds the name and MAC address of each interface on every device on the network. When run against the sample database, this query returns the following results:

row
  interface/(mac_address, name)
    item
      mac_address 01:01:02:03:04:05
      name eth0
row
  interface/(mac_address, name)
    item
      mac_address 02:A1:A2:A3:A4:A4
      name eth0
    item
      mac_address 03:A1:A2:A3:A4:A5
      name eth1
row
  interface/(mac_address, name)
    item
      mac_address 04:A1:A2:A3:A4:A8
      name eth0
    item
      mac_address 05:A1:A2:A3:A4:A9
      name eth1
row
  interface/(mac_address, name)
    item
      mac_address 06:13:72:F3:0A:F5
      name eth0
    item
      mac_address 07:13:72:F3:0A:F6
      name eth1
row
  interface/(mac_address, name)
    item
      mac_address 08:16:CB:FF:FE:66
      name eth0
    item
      mac_address 09:16:CB:FF:FE:67
      name eth1
    item
      mac_address 10:16:CB:FF:FE:68
      name eth2
    item
      mac_address 11:16:CB:FF:FE:69
      name eth3
row
  interface/(mac_address, name)
    item
      mac_address 12:10:D8:99:2B:C2
      name eth0
    item
      mac_address 13:10:D8:99:2B:C1
      name eth1 

Example 2: Fetching history with path-scoped projection

In a second example of path-scoped projection, the query fetches the revision history of the name and MAC address of interfaces, and outputs the history per interface:

SELECT interface/(name, mac_address#history) 
FROM /network/device

Here is a view of part of the results of this query when run against the sample database:

row
  interface/(name, history(mac_address))
    item
      name eth0
        history
          when 2008-04-06T00:21:52.518887Z
          mac_address null
        history
          when 2008-04-06T07:33:52.518887Z
          mac_address null
        history
          when 2008-04-06T14:45:52.518887Z
          mac_address null
        history
          when 2008-04-06T21:57:52.518887Z
          mac_address null
        history
          when 2008-04-07T05:09:52.518887Z
          mac_address null
        history
          when 2008-04-07T12:21:52.518887Z
          mac_address null 
  . . .

Example 3: Losing relationships between data

Similar to the path-scoped predicate, you run into trouble if you request the same information this way:

SELECT interface/mac_address, interface/name        
FROM /network/device

This query fetches the MAC address of each interface on each device, and the name of each interface on each device, but the resulting output does not reflect the relationship between the MAC address and name. When run against the sample database, this query returns the following uncorrelated results:

row
  interface/mac_address 01:01:02:03:04:05
  interface/name eth0
row
  interface/mac_address
    mac_address 02:A1:A2:A3:A4:A4
    mac_address 03:A1:A2:A3:A4:A5
  interface/name
    name eth0
    name eth1
row
  interface/mac_address
    mac_address 04:A1:A2:A3:A4:A8
    mac_address 05:A1:A2:A3:A4:A9
  interface/name
    name eth0
    name eth1
row
  interface/mac_address
    mac_address 06:13:72:F3:0A:F5
    mac_address 07:13:72:F3:0A:F6
  interface/name
    name eth0
    name eth1
row
  interface/mac_address
    mac_address 08:16:CB:FF:FE:66
    mac_address 09:16:CB:FF:FE:67
    mac_address 10:16:CB:FF:FE:68
    mac_address 11:16:CB:FF:FE:69
  interface/name
    name eth0
    name eth1
    name eth2
    name eth3
row
  interface/mac_address
    mac_address 12:10:D8:99:2B:C2
    mac_address 13:10:D8:99:2B:C1
  interface/name
    name eth0
    name eth1 

So instead of writing SELECT interface/mac_address, interface/name, use a path-scoped projection by writing SELECT interface/(mac_address, name) to get correlated results as in Example 1.

Example 4: Limiting searches at the wrong node

You might also retain the relationship discussed in Example 3 by limiting the selection in the FROM clause like this:

SELECT mac_address, name 
FROM /network/device/interface                     

When run against the sample database, this query returns correlated results, but much more limited than those of Example 1:

row
  mac_address 01:01:02:03:04:05
  name eth0
row
  mac_address 02:A1:A2:A3:A4:A4
  name eth0
row
  mac_address 03:A1:A2:A3:A4:A5
  name eth1
row
  mac_address 04:A1:A2:A3:A4:A8
  name eth0
row
  mac_address 05:A1:A2:A3:A4:A9
  name eth1
row
  mac_address 06:13:72:F3:0A:F5
  name eth0
row
  mac_address 07:13:72:F3:0A:F6
  name eth1
row
  mac_address 08:16:CB:FF:FE:66
  name eth0
row
  mac_address 09:16:CB:FF:FE:67
  name eth1
row
  mac_address 10:16:CB:FF:FE:68
  name eth2
row
  mac_address 11:16:CB:FF:FE:69
  name eth3
row
  mac_address 12:10:D8:99:2B:C2
  name eth0
row
  mac_address 13:10:D8:99:2B:C1
  name eth1 

What if you also want to know the name of the device, as well as the interface on the device? This query won't give you that information, because you have limited the search to the interface node in the FROM clause. To include the name of the device on which each interface resides, see Example 5.

Example 5: Limiting searches at the right node

To get any information about the device, such as its name, you must select from the device node, not from the interface node. In other words, you need to include a path-scoped projection like the one used in Example 1:

SELECT interface/(mac_address, name), name          
FROM /network/device

When run against the sample database, this query returns correlated results:

row
  interface/(mac_address, name)
    item
      mac_address 01:01:02:03:04:05
      name eth0
  name null
row
  interface/(mac_address, name)
    item
      mac_address 02:A1:A2:A3:A4:A4
      name eth0
    item
      mac_address 03:A1:A2:A3:A4:A5
      name eth1
  name null
row
  interface/(mac_address, name)
    item
      mac_address 04:A1:A2:A3:A4:A8
      name eth0
    item
      mac_address 05:A1:A2:A3:A4:A9
      name eth1
  name null
row
  interface/(mac_address, name)
    item
      mac_address 06:13:72:F3:0A:F5
      name eth0
    item
      mac_address 07:13:72:F3:0A:F6
      name eth1
  name null
row
  interface/(mac_address, name)
    item
      mac_address 08:16:CB:FF:FE:66
      name eth0
    item
      mac_address 09:16:CB:FF:FE:67
      name eth1
    item
      mac_address 10:16:CB:FF:FE:68
      name eth2
    item
      mac_address 11:16:CB:FF:FE:69
      name eth3
  name null
row
  interface/(mac_address, name)
    item
      mac_address 12:10:D8:99:2B:C2
      name eth0
    item
      mac_address 13:10:D8:99:2B:C1
      name eth1
  name null 

Example 6: Abbreviating the projected path

This query uses .. to abbreviate the projected path. The query extracts information about environment variables on systems for which GoToAssist has WMI information, which can be useful in understanding how running processes behave.

SELECT ../win32_operatingsystem/csname as "System",
       name as "Environment Variable Name",
       variablevalue as "Environment Variable Value" 
FROM /network/device/wmi/win32_environment 
ORDER BY 1

Depending on the database, this query fetches information about names and dynamic values such as PATH, TEMP, WINDIR, and so on, and displays the correlated results in ascending order by system name, similar to this:

row
  System JAKARTA
  Environment Variable Name TMP
  Environment Variable Value %USERPROFILE%\Local Settings
row
  System KATHMANDU
  Environment Variable Name ComSpec
  Environment Variable Value %SystemRoot%\system32\cmd.exe
row
  System LISBON
  Environment Variable Name Path
  Environment Variable Value %SystemRoot%\system32
etsnmp\bin
row
  System MILAN
  Environment Variable Name windir
  Environment Variable Value %SystemRoot%
row
  System TAIPEI
  Environment Variable Name FP_NO_HOST_CHECK
  Environment Variable Value NO 
  . . .

Related topics

| Views: 1101 | Last Updated: Thu, May 09 2013 2:29 PM

Is this article helpful?