Sample device queries

You can use queries similar to these examples to identify devices that meet certain criteria, for example, devices that have been found by the finders.

Sample: Identifying which devices have been found by the finders

The following example shows how to identify devices that have been found by the finders.

select * from finders.processing;
go
....
{
                m_UniqueAddress='172.20.12.253';
                m_Protocol=1;
                m_Creator='IpRoutingTable';
}
{
                m_UniqueAddress='172.20.22.61';
                m_Protocol=1;
                m_Creator='IpRoutingTable';
}
{
                m_UniqueAddress='172.20.0.221';
                m_Protocol=1;
                m_Creator='IpRoutingTable';
}
{
                m_UniqueAddress='10.10.35.17';
                m_Creator='PingFinder';
}

The above query shows the devices discovered by the Ping finder as well as devices reported as a result of connections discovered by the IpRoutingTable Discovery agent.

Sample: Identifying devices that have been sent to the Details agent

The following example shows how to identify devices that have been sent to the Details agent.

select * from Details.despatch;
go
.................................................................
................................
{
                m_UniqueAddress='10.10.38.82';
}
{
                m_UniqueAddress='10.10.38.83';
}
.....
.....
{
                m_UniqueAddress='10.10.38.84';
}
{
                m_UniqueAddress='10.10.38.87';
}
{
                m_UniqueAddress='10.10.38.88';
}
{
                m_UniqueAddress='10.10.38.89';
}
{
                m_UniqueAddress='10.10.38.90';
}

Sample: Identifying devices that have been returned from the Details agent

To identify which devices have returned from the Details agent, query the returns table of the Details agent, as shown below.

select * from Details.returns;
go
.................................................................
................................
{
                m_UniqueAddress='10.10.8.255';
                m_UpdAgent='Details';
                m_HaveAccess=1;
                m_Description='Ascend Max-HP T1/PRI S/N;
                m_ObjectId='1.3.6.1.4.1.529.1.2.6';
                m_LastRecord=1;
}
{
                m_UniqueAddress='10.10.9.1';
                m_UpdAgent='Details';
                m_Name='minotaur.Kazeem.San.COM';
                m_HaveAccess=0;
                m_LastRecord=1;
}
.....
.....
{
                m_UniqueAddress='10.10.9.2';
                m_UpdAgent='Details';
                m_Name='cyclops.Kazeem.San.COM';
                m_HaveAccess=0;
                m_LastRecord=1;
}
{
                m_UniqueAddress='10.10.9.3';
                m_UpdAgent='Details';
                m_Name='centaur.Kazeem.San.COM';
                m_HaveAccess=0;
                m_LastRecord=1;
}

Sample: Identifying all devices discovered until now

The following example shows how to identify all known network entities.

select m_Name, m_ObjectId, m_UniqueAddress
from workingEntities.finalEntity;
go
..................................
{
                m_Name='10.10.8.255';
                m_ObjectId='1.3.6.1.4.1.529.1.2.6';
                m_UniqueAddress='10.10.8.255';
}
{
                m_Name='minotaur.Kazeem.San.COM';
                m_UniqueAddress='10.10.9.1';
}
.....
.....
{
                m_Name='cyclops.Kazeem.San.COM';
                m_UniqueAddress='10.10.9.2';
}

Sample: Identifying which agents have discovered devices

The following example shows how to identify the agents that have discovered devices.

select m_Name, m_Creator
from workingEntities.finalEntity;
go
..................................
{
                m_Name='b11-m1-2611.Kazeem.San.COM[ 0 [ 2 ] ]';
                m_Creator='IpRoutingTable';
}
{
                m_Name='b-ayo.Kazeem.San.COM';
                m_Creator='Details';
}
{
                m_Name='b11-m1-2611.Kazeem.San.COM[ 0 [ 1 ] ]';
                m_Creator='IpRoutingTable';
}
.....
.....
{
                m_Name='b11-m1-2611.Kazeem.San.COM';

Sample: Determining the different types of interfaces discovered

The following example shows how to identify the interface types on each discovered device. Use the select DISTINCT keyword to deduplicate the multiple interface type entries that are stored for each device in the workingEntities.finalEntity table.

select DISTINCT m_LocalNbr->m_IfType, m_ObjectId
from workingEntities.finalEntity
where m_EntityType = 2;
go
..................................
{
        m_IfType=166;
        m_ObjectId='1.3.6.1.4.1.9.1.222';
}
{
        m_IfType=6;
        m_ObjectId='1.3.6.1.4.1.9.1.222';
}
{
        m_IfType=1;
        m_ObjectId='1.3.6.1.4.1.9.1.222';
}
{
        m_IfType=6;
        m_ObjectId='1.3.6.1.4.1.9.1.310';
}
{
        m_IfType=22;
        m_ObjectId='1.3.6.1.4.1.9.1.310';
}
..................................

Sample: Monitoring agents in the current phase

Use the following example query to identify which agents the current phase is waiting on before it can complete. The following example query does this by listing the names of all the agents that finish in the current phase and that meet the following criteria:
  • The agent is valid. (m_State <> 0)
  • The agent is currently in use. (m_State <> 1)
  • The agent status is not yet complete. (m_State <> 4)
select m_Name from agents.status
where 
m_State <> 0 AND 
m_State <> 1 AND 
m_State <> 4 AND 
m_CompletionPhase IN (( select m_Phase from disco.status )) ;

Once you have identified which agents still need to complete in the current phase, use the following query to determine which devices those agents are working on.

select 
    m_Name, 
    m_UniqueAddress, 
    m_ObjectId, 
    m_Description 
from 
    <agentName>.despatch 
where 
    m_UniqueAddress NOT IN
    (( select m_UniqueAddress from <agentName>.returns where m_LastRecord = 1 )) ;