Showing
6 changed files
with
23 additions
and
76 deletions
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | 17 | ||
18 | <aop:config> | 18 | <aop:config> |
19 | <aop:pointcut id="monitorDaoPoint" | 19 | <aop:pointcut id="monitorDaoPoint" |
20 | - expression="execution(* com.monitor.*.mapper.*.*(..))"/> | 20 | + expression="execution(* com.monitor.mysql.mapper.*.*(..)) or execution(* com.monitor.zabbix.mapper.*.*(..))"/> |
21 | <aop:advisor pointcut-ref="monitorDaoPoint" advice-ref="dataSourceMethodInterceptor"/> | 21 | <aop:advisor pointcut-ref="monitorDaoPoint" advice-ref="dataSourceMethodInterceptor"/> |
22 | </aop:config> | 22 | </aop:config> |
23 | 23 |
@@ -6,6 +6,17 @@ datasources: | @@ -6,6 +6,17 @@ datasources: | ||
6 | username: ops | 6 | username: ops |
7 | password: t5/oMgwUCmO/GeMHBAQ2Cg== | 7 | password: t5/oMgwUCmO/GeMHBAQ2Cg== |
8 | 8 | ||
9 | + zabbix: | ||
10 | + servers: | ||
11 | + - 10.66.0.191:3306 | ||
12 | + - 10.66.0.191:3306 | ||
13 | + username: zabbix_ops | ||
14 | + password: YQ7VlkwN1Mum/fjaZARkKg== | ||
15 | + daos: | ||
16 | + - com.monitor.zabbix.mapper.ZabbixHistoryMapper | ||
17 | + - com.monitor.zabbix.mapper.ZabbixHostMapper | ||
18 | + - com.monitor.zabbix.mapper.ZabbixItemMapper | ||
19 | + | ||
9 | yohobuy_logs: | 20 | yohobuy_logs: |
10 | servers: | 21 | servers: |
11 | - 192.168.102.219:3306 | 22 | - 192.168.102.219:3306 |
@@ -6,6 +6,17 @@ datasources: | @@ -6,6 +6,17 @@ datasources: | ||
6 | username: root | 6 | username: root |
7 | password: t5/oMgwUCmO/GeMHBAQ2Cg== | 7 | password: t5/oMgwUCmO/GeMHBAQ2Cg== |
8 | 8 | ||
9 | + zabbix: | ||
10 | + servers: | ||
11 | + - 192.168.102.76:3306 | ||
12 | + - 192.168.102.76:3306 | ||
13 | + username: root | ||
14 | + password: t5/oMgwUCmO/GeMHBAQ2Cg== | ||
15 | + daos: | ||
16 | + - com.monitor.zabbix.mapper.ZabbixHistoryMapper | ||
17 | + - com.monitor.zabbix.mapper.ZabbixHostMapper | ||
18 | + - com.monitor.zabbix.mapper.ZabbixItemMapper | ||
19 | + | ||
9 | yohobuy_logs: | 20 | yohobuy_logs: |
10 | servers: | 21 | servers: |
11 | - 192.168.102.219:3306 | 22 | - 192.168.102.219:3306 |
monitor-service-zabbix/src/main/resources/com/monitor/zabbix/mapper/ZabbixHistoryMapper.xml
deleted
100644 → 0
1 | -<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | -<mapper namespace="com.monitor.zabbix.mapper.ZabbixHistoryMapper"> | ||
4 | - <resultMap id="dHistoryInfoMapper" type="com.monitor.zabbix.model.ZabbixDHistoryInfo"> | ||
5 | - <result column="itemid" property="itemId" jdbcType="INTEGER"/> | ||
6 | - <result column="value" property="value" jdbcType="DOUBLE"/> | ||
7 | - </resultMap> | ||
8 | - | ||
9 | - <resultMap id="uHistoryInfoMapper" type="com.monitor.zabbix.model.ZabbixUHistoryInfo"> | ||
10 | - <result column="itemid" property="itemId" jdbcType="INTEGER"/> | ||
11 | - <result column="value" property="value" jdbcType="BIGINT"/> | ||
12 | - </resultMap> | ||
13 | - | ||
14 | - <select id="queryDHistoryInfo" resultMap="dHistoryInfoMapper"> | ||
15 | - select | ||
16 | - itemid,`value` | ||
17 | - from history | ||
18 | - where itemid = #{itemId,jdbcType=INTEGER} | ||
19 | - order by clock desc limit 1; | ||
20 | - </select> | ||
21 | - | ||
22 | - <select id="queryUHistoryInfo" resultMap="uHistoryInfoMapper"> | ||
23 | - select itemid,`value` | ||
24 | - from history_uint | ||
25 | - where itemid = #{itemId,jdbcType=INTEGER} | ||
26 | - order by clock desc limit 1; | ||
27 | - </select> | ||
28 | - | ||
29 | - | ||
30 | -</mapper> |
monitor-service-zabbix/src/main/resources/com/monitor/zabbix/mapper/ZabbixHostMapper.xml
deleted
100644 → 0
1 | -<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | -<mapper namespace="com.monitor.zabbix.mapper.ZabbixHostMapper"> | ||
4 | - <resultMap id="hostInfoMapper" type="com.monitor.zabbix.model.ZabbixHostInfo" > | ||
5 | - <id column="interfaceid" property="interfaceId" jdbcType="INTEGER" /> | ||
6 | - <result column="hostid" property="hostId" jdbcType="INTEGER" /> | ||
7 | - <result column="ip" property="ip" jdbcType="VARCHAR" /> | ||
8 | - </resultMap> | ||
9 | - | ||
10 | - <select id="queryHostInfo" resultMap="hostInfoMapper"> | ||
11 | - select | ||
12 | - interfaceid,hostid,ip | ||
13 | - from interface | ||
14 | - where ip IN | ||
15 | - <foreach collection="list" index="index" item="item" close=")" open="(" separator=","> | ||
16 | - #{item} | ||
17 | - </foreach> | ||
18 | - </select> | ||
19 | - | ||
20 | - <select id="queryAllHostInfo" resultMap="hostInfoMapper"> | ||
21 | - SELECT interfaceid,hostid,ip FROM `interface` ; | ||
22 | - </select> | ||
23 | -</mapper> |
monitor-service-zabbix/src/main/resources/com/monitor/zabbix/mapper/ZabbixItemMapper.xml
deleted
100644 → 0
1 | -<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | -<mapper namespace="com.monitor.zabbix.mapper.ZabbixItemMapper"> | ||
4 | - <resultMap id="itemResultMapper" type="com.monitor.zabbix.model.ZabbixItemInfo"> | ||
5 | - <id column="itemid" property="itemId" jdbcType="INTEGER"/> | ||
6 | - <result column="hostid" property="hostId" jdbcType="INTEGER"/> | ||
7 | - <result column="value_type" property="valueType" jdbcType="VARCHAR"/> | ||
8 | - <result column="key_" property="keyName" jdbcType="VARCHAR"/> | ||
9 | - </resultMap> | ||
10 | - | ||
11 | - <select id="queryItemInfo" resultMap="itemResultMapper"> | ||
12 | - select | ||
13 | - itemid,hostid,key_,value_type | ||
14 | - from items | ||
15 | - where hostid IN | ||
16 | - <foreach collection="list" index="index" item="item" close=")" open="(" separator=","> | ||
17 | - #{item} | ||
18 | - </foreach> | ||
19 | - AND | ||
20 | - (key_ LIKE 'system.cpu.util%' OR key_ LIKE 'vm.memory%' OR key_ like 'net.if%') | ||
21 | - </select> | ||
22 | -</mapper> |
-
Please register or login to post a comment