AgentCfgSyncMap.xml 6.53 KB
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd" >
<sqlMap namespace="AGENT_CFG_SYNC">
	<typeAlias alias="agentCollConfig"
		type="com.sitech.ibnms.config.sync.db.domain.AgentCollConfig" />

	<select id="selectMqDetailList"
		resultClass="com.sitech.ibnms.config.sync.db.domain.MQDetail"
		parameterClass="java.lang.String">
		select t1.ID, t1.PORT, t1.STATUS, t2.IP_ADDR IP
		  from TB_CFG_DEPLOY_MQ t1, TB_ASSET_HOST t2
		 where t1.ENV_ID = t2.UNIT_ID
		 and t1.type = #mqType#
	</select>
	
	<select id="selectMqDetailByAgentId"
		resultClass="com.sitech.ibnms.config.sync.db.domain.MQDetail"
		parameterClass="java.lang.String">
		select t5.*
		  from (select t1.ID, t1.PORT, t1.STATUS, t2.IP_ADDR IP
		          from TB_CFG_DEPLOY_MQ t1, TB_ASSET_HOST t2
		         where t1.ENV_ID = t2.UNIT_ID) t5,
		       (select t4.mq_id
		          from TB_CFG_DEPLOY_AGENT t3, TB_CFG_DEPLOY_WORKSTATION t4
		         where t3.Workstation_Id = T4.ID
		           and t3.ID = '$value$') t6
		 where t5.id = t6.mq_id
	</select>
	
	

	<select id="selectAgentDetail"
		resultClass="com.sitech.ibnms.config.sync.db.domain.AgentDetail"
		parameterClass="java.util.HashMap">
		select t1.ID, t1.ENV_ID UNIT_ID,t1.JMX_PORT, t2.IP_ADDR IP from
		TB_CFG_DEPLOY_AGENT t1, TB_ASSET_HOST t2 where t1.ENV_ID =
		t2.UNIT_ID and t1.ID = #AGENT_ID#
	</select>

	<select id="getDevCollList" resultClass="agentCollConfig"
		parameterClass="java.util.HashMap">
		select t1.MODEL_ID MBEAN_ID, OBJECT_NAME, CLASS_NAME, ''
		SCHEDULE_ID, METHOD_NAME FUNCTION, null BEGIN_TIME, null
		END_TIME, 0 REPEAT_COUNT, INTERVAL as INTERVAL, null CRONTAB,
		DEVICE_ID from TB_CFG_AGENT_CLLLIST t1, TB_CFG_CLLMODEL t2 where
		t1.AGENT_ID = #AGENT_ID# and t1.MODEL_ID = t2.MODEL_ID and
		t1.ENABLE = 1
	</select>

    <select id="selectLinkCollList" resultClass="java.util.HashMap"
            parameterClass="java.util.HashMap">
		SELECT T1.LINK_ID, T1.AGENT_ID_A, T1.PERIOD_ID,T2.DEVICE_ID, T2.IP_ADDR, T2.SEQ_NO
  FROM TB_BJ_NETLINK_PROBE T1, TB_BJ_NETLINK_PROBE_NEXTHOP T2
 WHERE T1.LINK_ID = T2.LINK_ID
   AND T1.AGENT_ID_A = #AGENT_ID#
 ORDER BY T2.SEQ_NO
	</select>

	<select id="getDevCollListSpec" resultClass="agentCollConfig"
		parameterClass="java.util.HashMap">
		select t1.MODEL_ID MBEAN_ID, OBJECT_NAME, CLASS_NAME, ''
		SCHEDULE_ID, METHOD_NAME FUNCTION, null BEGIN_TIME, null
		END_TIME, 0 REPEAT_COUNT, INTERVAL as INTERVAL, null CRONTAB,
		DEVICE_ID from TB_CFG_AGENT_CLLLIST t1, TB_CFG_CLLMODEL t2 where
		t1.AGENT_ID = #AGENT_ID# and t1.MODEL_ID = #MBEAN_ID# and
		t1.MODEL_ID = t2.MODEL_ID and t1.DEVICE_ID = #DEVICE_ID# and
		t1.ENABLE = 1
	</select>
	<select id="getDevParamList" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		select PARAM_NAME, PARAM_VALUE from TB_CFG_AGENT_CLLPARAM where
		AGENT_ID = #AGENT_ID# and MODEL_ID = #MODEL_ID# and DEVICE_ID =
		#DEVICE_ID#
	</select>
	<select id="getBusiCollList" resultClass="agentCollConfig"
		parameterClass="java.util.HashMap">
		select t1.MBEAN_ID, OBJECT_NAME, CLASS_NAME, SCHEDULE_ID,
		FUNCTION, null BEGIN_TIME, null END_TIME, REPEAT_COUNT,
		INTERVAL, CRONTABTODO CRONTAB from TB_CFG_SERVICE_SCHEDULE t1,
		TB_CFG_SERVICE_MBEAN t2 where t1.AGENT_ID = #AGENT_ID# and
		t1.MBEAN_ID = t2.MBEAN_ID and t1.ENABLE = 1
	</select>
	<select id="getBusiCollListSpec" resultClass="agentCollConfig"
		parameterClass="java.util.HashMap">
		select t1.MBEAN_ID, OBJECT_NAME, CLASS_NAME, SCHEDULE_ID,
		FUNCTION, null BEGIN_TIME, null END_TIME, REPEAT_COUNT,
		INTERVAL, CRONTABTODO CRONTAB from TB_CFG_SERVICE_SCHEDULE t1,
		TB_CFG_SERVICE_MBEAN t2 where t1.AGENT_ID = #AGENT_ID# and
		t1.MBEAN_ID = t2.MBEAN_ID and t1.SCHEDULE_ID = #SCHEDULE_ID# and
		t1.ENABLE = 1
	</select>
	<select id="getBusiParamList" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		select PARAM_NAME, PARAM_VALUE from TB_CFG_SERVICE_PARAM where
		AGENT_ID = #AGENT_ID# and SCHEDULE_ID = #SCHEDULE_ID#
	</select>
	<select id="getDevCheckList" resultClass="agentCollConfig"
		parameterClass="java.util.HashMap">
		select t1.MBEAN_ID, t1.OBJECT_NAME, t1.CLASS_NAME, t1.JOB_ID
		SCHEDULE_ID, t1.METHOD_NAME FUNCTION, null BEGIN_TIME, null
		END_TIME, 0 REPEAT_COUNT, INTERVAL, null CRONTAB from
		TB_CFG_CHECK_JOB t1, TB_CFG_CHECK_DEPLOY t2 where t1.JOB_ID =
		t2.JOB_ID and t2.AGENT_ID = #AGENT_ID# and t1.ENABLE = 1
	</select>

	<select id="selectTbCfgEventByAgentId"
		resultClass="com.sitech.ibnms.config.sync.db.domain.TbCfgEvent"
		parameterClass="java.util.HashMap">
		select distinct t.*
		  from tb_cfg_event t,
		       (select agent_id,
		               unit_id,
		               substr(unit_id, 0, decode(instr(unit_id, ':'), 0, length(unit_id), instr(unit_id, ':') - 1)) kbp_class,
		               decode(instr(unit_id, ':'), 0, '', substr(unit_id, instr(unit_id, ':') + 1)) device_id
		          from v_agent_res) v
		 where t.ENABLE = 1
		   and t.IS_ORG_TYPE = 1
		   and v.agent_id = #AGENT_ID#
		   and v.UNIT_ID is not null
		   and (t.unit_id like v.kbp_class || '%' || v.DEVICE_ID || '%')

	</select>
	<select id="queryAgentIdByUnitId"  resultClass="java.lang.String" parameterClass="java.util.HashMap">
		select v.AGENT_ID
		  from V_AGENT_RES v
		 where v.UNIT_ID is not null
		   and #UNIT_ID# like v.UNIT_ID || '%'
	</select>

    <select id="getActProvince"  resultClass="java.lang.String" parameterClass="java.util.HashMap">
		SELECT T.DICT_VALUE FROM TB_SYS_DICT T WHERE T.ID = '406001'
	</select>
	
	<!-- select net device interfaces to be collect -->
	<select id="getNetIfList" resultClass="java.util.HashMap" parameterClass="java.util.HashMap">
		select UNIT_ID from TB_ASSET_ROUTER_IF where EXT_UNIT_ID = #DEVICE_ID#
	</select>
	
	<select id="selectCronTask" resultClass="java.util.HashMap"
		parameterClass="java.lang.String">
		select 'XNSDFSFIW1K3H32421J2NJG23' MBEAN_ID,
		       'Crontab:type=MBean' OBJECT_NAME,
		       'com.sitech.ismp.coll.cron.CronSchedule' CLASS_NAME,
		       t.GUID SCHEDULE_ID,
		       'execCronSchedule' FUNCTION,
		       null BEGIN_TIME,
		       null END_TIME,
		       0 REPEAT_COUNT,
		       0 INTERVAL,
		       t.PERIOD_ID CRONTAB,
		       t.CURR_VERSION,
           s.script_name
		  from TB_CC_CRONTAB_TASK_HOST t, TB_CC_CRONTAB_SCRIPT s
		 where t.curr_version=s.curr_version and t.STATUS = 1 
		   and t.AGENT_ID = #agentId#
	</select>
	
	<select id="selectCronTaskContent" resultClass="java.lang.String"
		parameterClass="java.lang.String">
		select c.countent from tb_cc_crontab_script_content c where c.id=#version# order by seq asc
	</select>
</sqlMap>