Here is a net_connect based query example:
SELECT 'DC' as location, sum(a.online) as online, sum(a.offline) as offline, sum(a.online+a.offline) as total
FROM
(SELECT REPLACE(one.target, ':ping', '') as target,
CASE WHEN two.samplevalue IS NOT NULL then 1 else 0 END as online,
CASE WHEN two.samplevalue IS NULL then 1 else 0 END as offline
FROM S_QOS_DATA one
JOIN S_QOS_SNAPSHOT two ON two.table_id=one.table_id
WHERE one.qos = 'QOS_NET_CONNECT' AND (one.target LIKE '%SITE%' OR one.target LIKE '%WAN%')
) a
Here is an snmpcollector example:
SELECT 'DC' as location, sum(a.online) as online, sum(a.offline) as offline, sum(a.online+a.offline) as total
FROM
(SELECT one.source, one.target,
CASE WHEN two.samplevalue = 1 then 1 else 0 END as online,
CASE WHEN two.samplevalue <> 1 then 1 else 0 END as offline
FROM S_QOS_DATA one
JOIN S_QOS_SNAPSHOT two ON two.table_id=one.table_id
WHERE one.qos = 'QOS_INTERFACE_ADMINSTATUSPOLLABLE'
) a
and another
SELECT 'DC' as location, sum(a.online) as online, sum(a.offline) as offline, sum(a.online+a.offline) as total
FROM
(SELECT one.source, one.target,
CASE WHEN two.samplevalue = 1 then 1 else 0 END as online,
CASE WHEN two.samplevalue <> 1 then 1 else 0 END as offline
FROM S_QOS_DATA one
JOIN S_QOS_SNAPSHOT two ON two.table_id=one.table_id
WHERE one.qos = 'QOS_INTERFACE_OPERSTATUSPOLLABLE'
) a
If you wanted to see the detail of the snmpcollector query with ifAlias:
SELECT one.source, one.target, four.ci_attr_value,
CASE WHEN two.samplevalue = 1 then 1 else 0 END as online,
CASE WHEN two.samplevalue <> 1 then 1 else 0 END as offline
FROM S_QOS_DATA one
JOIN S_QOS_SNAPSHOT two ON two.table_id=one.table_id
JOIN CM_CONFIGURATION_ITEM_METRIC three ON three.ci_metric_id=one.ci_metric_id
JOIN CM_CONFIGURATION_ITEM_ATTRIBUTE four ON four.ci_id=three.ci_id and four.ci_attr_key = 'ifAlias'
WHERE one.qos = 'QOS_INTERFACE_ADMINSTATUSPOLLABLE'