# This file contains sql commands for selecting the addresses to be ICMP pinged from the 
# discovery process output tables
# the commands are seperated by ;
#
# default values will be values not selected (if they are in the end of the selection, or 
# fields containing the string '(null)'
#
# The parameters selected should be: 
#	1. nObjectId of strType = Address to monitor
#	2. strIpAddr to monitor
#	3. strHostName of address
#	4. Monitoring Frequency in seconds (optional, otherwise default taken from config.xml)
#	5. Monitoring Start Time HH:MM(optional, otherwise default taken from config.xml)
#	6. Monitoring Stop Time HH:MM(optional, otherwise default taken from config.xml)
#	7. Monitoring Timeout  (optional, otherwise default taken from config.xml)
#	8. Monitoring Retry count (optional, otherwise default taken from config.xml)
#	9. Condition group to use on this node (optional, otherwise default taken from config.xml)
#	10. Max Daily Status Change Count before an event on it
#
#   ICMP specific parameters	
#
#	11. Monitoring Count In Cycle (optional, otherwise default taken from config.xml)
#	12. Monitoring In Cycle Delay Time in sec (optional, otherwise default taken from config.xml)
#
# Additional commands supported:
#	$LoadCsvToDatabase:filename,tbl_name, Separator, is first line fields name (0|1)
#		if Separator is a comma, then just write the word comma, and it will be converted to that
#	$DeleteTable:tbl_name
#
select 
	distinct address.nObjectId, 
	address.strIpAddr, 
	address.strDNSName, 
	address.nMonitoringFrequencySec, 
	'(null)', 
	'(null)', 
	address.nTimeoutMsec, 
	address.nRetries 
FROM    tblObject address INNER JOIN 
	tblobject interface on address.nParentObjectId = interface.nParentObjectId 
WHERE 
	interface.strType = 'Interface' AND 
	address.strType = 'Address' AND
        ( 
            address.nIfIndex = -1 OR
            interface.strDescription = 'Java API discovered name'
        )
