# This file contains sql commands for selecting the addresses and the OIDs to be collected using SNMP  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 = Interface of the Node to monitor - important for snmp status monitor only
#	2. strIpAddr of Node (strType = Node) to monitor
#	3. strHostName of Node
#	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, or NONE)
#		This condition group will work on all OIDs on the same node.
#	10. Max Daily Status Change Count before an event on it(optional for oper+admin status)
#
#  snmp specific parameters
#	11. SNMP Version
#	12  SNMP Community/User
#	13. SNMP Password (used by SNMPV3 can be split to auth_path#priv_path)
#	14. OID Nick-Name
#	15. OID Type (Field|Table)
#	16. OID Value - if Field then the full value
#	17. OID_Key - value which is appended to OID if there is one, for example ifIndex
#
# 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 
	Interface.nObjectId,
	Node.strIpAddr,
	Node.strDNSName,
	'(null)' ,
	'(null)' ,
	'(null)',
	'(null)',
	'(null)',
	'(null)',
	'(null)',
	Node.nSNMPVersion,
	Node.strCommunity,
	Node.strPassword,
	'JILROY_IF_STATUS',
	'Field',
	'1.3.6.1.2.1.2.2.1.7.#1.3.6.1.2.1.2.2.1.8.',
	Interface.nIfIndex,
	Interface.strName
FROM 
	tblObject Node INNER JOIN
	tblObject Interface ON Node.nObjectId = Interface.nParentObjectId
WHERE
	Node.strType = 'Node'  AND
	Interface.strType = 'Interface' AND
	Node.nObjectId = Interface.nParentObjectId AND
	Node.strCommunity IS NOT NULL
