Developers

Node IDs

PQL identifies each node by a unique Node ID number. You can quickly get information about a specific node by using its Node ID, the unique identifying number that Paglo assigns to each node in the tree.

The id() function is especially useful to developers creating applications. The use of the pound # sign avoids creating ephemeral nodes in a query that points to nodes that don't exist outside of the query itself.


Syntax

The id function returns a tree and takes a tree parameter:

tree /#id(tree input)

Examples


Example 1: Find the Node IDs of devices

Query: What is the Node ID number of each device on my network?

 SELECT /#id 
 FROM /network/device

You can run this query right from this page, in the search field below:


Example 2: Use Node IDs of devices

Query: Tell me everything about the device with Node ID #123456.

 SELECT * 
  FROM /network/device 
   WHERE /#id = 123456

You can run this query against your own data from this page, by replacing 123456 with the Node ID of one of your own devices:


Example 3: Use IDs of interfaces

Query: Tell me everything about the interface with Node ID #123456.

 SELECT * 
  FROM /network/device/wmi/win32_logicaldisk 
   WHERE /#id = 123456

You can run this query against your own data from this page, by replacing 123456 with the Node ID of one of your own devices:


Example 4: Find system Node IDs

Query: Show me systems listed by Node ID.

SELECT /#id as id, last_seen, system/dns_name, 
  system/name, system/netbios_name, 
  join(
    interface/name,','
  ) as name, 
  join(
    interface/mac_address, ', '
  ) as mac_address 
FROM /network/device order by mac_address

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

row
   id 833
   last_seen 2008-06-06T08:59:29.0000000Z
   system/dns_name PARIS
   system/name null
   system/netbios_name null
   name null
   mac_address A3:04:05:06:07:08
row
   id 842
   last_seen 2008-06-06T02:46:18.0000000Z
   system/dns_name ROME
   system/name 5627
   system/netbios_name null
   name naf0,lo0
   mac_address B2:03:04:05:06:07
row
   id 851
   last_seen 2008-06-06T02:39:32.0000000Z
   system/dns_name DUBLIN
   system/name LP125cx/LP126cn
   system/netbios_name null
   name ncmac1,lo0
   mac_address C1:02:03:04:05:06 
   . . .

To see other PQL functions, see Functions.


How do I find out more?