Developers

PQL parent() function

The parent() function returns the parent of the node used as an argument, and the tree of that parent. This includes both the argument node and all of its siblings.


Syntax

The parent() function returns a tree and takes 2 parameters, a tree and a string:

tree parent(tree input, string input)

Examples


Example 1: Parent of in_octets node

Query: What are the parents of the in_octets nodes?

SELECT parent(in_octets)
FROM /network/device/interface

Results: Depending on the database, this query returns results similar to this:

row
  parent(in_octets)
    interface
       name vlan1
       mac_address 00:10:DB:4C:BA:68
       admin_status 2
       oper_status 2
       type 6
       speed 0
       out_errors 0
       in_errors 0
       mtu 1500
       out_octets 0
       in_octets 0
       descr vlan1
       if_index 4
row
  parent(in_octets)
    interface
       name ethernet2
       mac_address 00:10:DB:49:98:00
       admin_status 2
       oper_status 2
       type 6
       speed 10000000
       out_errors 0
       in_errors 0
       mtu 1500
       out_octets 0
       in_octets 0
       descr ethernet2
      inet
         ip_address 1.4.6.26
         netmask 255.255.255.248
       if_index 3  
    . . .

Example 2: Parents of software nodes

Query: What are the parents of the installed software nodes?

SELECT name, parent(name)
FROM /network/device/wmi/win32_product 
WHERE installdate > '20080101'

Results: Depending on the database, this query returns results similar to this:

row
   nameAltoworks Crawler
  parent(name)
    win32_product
       name Altoworks Crawler
       description Altoworks Crawler
       version 1.0.98.3306
       vendor Altoworks
       caption Altoworks Crawler
       installdate 20080418
       identifyingnumber {D074E45B-13ED-463C-898C-0A2FDC0D3A3E}
       skunumber
       installlocation C:\Program Files\Altoworks\Altoworks Crawler\
       packagecache C:\WINDOWS\Installer\b0bc08d.msi
       installstate 5 Installed
       installdate 220080418000000.000000-000
row
   nameWindows Media Encoder 9 Series
  parent(name)
    win32_product
       name Windows Media Encoder 9 Series
       description Windows Media Encoder 9 Series
       version 9.00.2980
       vendor Microsoft Corporation
       caption Windows Media Encoder 9 Series
       installdate 20080308
       identifyingnumber {E38C00D0-A68B-4318-A8A6-F7D4B5B1DF0E}
       skunumber
       installlocation
       packagecache C:\WINDOWS\Installer\a016a.msi
       installstate 5 Installed
       installdate 220080308000000.000000-000 
   . . .

Example 3: Parents of system nodes

Query: What are the parents of the system nodes with low disk space?

SELECT parent(systemname) 
FROM %free disk space% 
WHERE freespace < 1000000000
AND description = 'Local Fixed Disk'

Results: Depending on the database, this query returns results similar to this:

row 
  parent(systemname) 
    win32_logicaldisk 
       name C: 
       description Local Fixed Disk 
       size 18161414144 Bytes 
       creationclassname Win32_LogicalDisk 
       caption C:

To see other PQL functions, see Functions.


How do I find out more?