19
19
20
20
import org .smartloli .kafka .eagle .api .email .module .ClusterContentModule ;
21
21
import org .smartloli .kafka .eagle .api .email .module .LagContentModule ;
22
+ import org .smartloli .kafka .eagle .api .im .IMFactory ;
23
+ import org .smartloli .kafka .eagle .api .im .IMService ;
22
24
import org .smartloli .kafka .eagle .api .im .IMServiceImpl ;
23
25
import org .smartloli .kafka .eagle .common .protocol .alarm .AlarmMessageInfo ;
24
26
import org .smartloli .kafka .eagle .common .util .CalendarUtils ;
32
34
*/
33
35
public class TestIM {
34
36
public static void main (String [] args ) {
37
+ testAlarmClusterByDingDingMarkDown ();
38
+ //testAlarmClusterByWeChatMarkDown();
39
+ //testConsumerHeathyByWeChat();
40
+
41
+ }
42
+
43
+ /** New alarm im api. */
44
+ private static void testAlarmClusterByWeChatMarkDown () {
45
+ AlarmMessageInfo alarmMsg = new AlarmMessageInfo ();
46
+ // FF0000 (red), 008000(green), FFA500(yellow)
47
+ alarmMsg .setTitle ("`Kafka Eagle Alarm Notice`\n " );
48
+ alarmMsg .setAlarmContent ("<font color=\" warning\" >node.shutdown [ localhost:9092 ]</font>" );
49
+ // alarmMsg.setAlarmContent("<font color=\"#008000\">node.alive [
50
+ // localhost:9092 ]</font>");
51
+ alarmMsg .setAlarmDate ("2019-10-07 21:43:22" );
52
+ alarmMsg .setAlarmLevel ("P0" );
53
+ alarmMsg .setAlarmProject ("Kafka" );
54
+ alarmMsg .setAlarmStatus ("<font color=\" warning\" >PROBLEM</font>" );
55
+ // alarmMsg.setAlarmStatus("<font color=\"#008000\">NORMAL</font>");
56
+ alarmMsg .setAlarmTimes ("current(1), max(7)" );
35
57
36
- testAlarmClusterByDingDing ();
58
+ IMServiceImpl im = new IMServiceImpl ();
59
+ im .sendJsonMsgByWeChat (alarmMsg .toWeChatMarkDown (),"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=maMN2krp0GwiyxoA6JCULLk8oLHwfnjnojeYGma_5KG5J_JHqTledeY6AHWE2rwLTF6I5yqu5LJUmUpSn7feXauFySZtnOGlAvRACz33V2UegR596xuyOT4fZIfNzB1cqJi3A-Eahbw7UVG2a8AaHvN0ZrSRPkQiqWola5p71FfCpnuDEAw63THmURdfMIcF3QB5KFzl-qHblqXfQLtpeA" );
37
60
}
38
61
39
62
/** New alarm im api. */
40
- private static void testAlarmClusterByDingDing () {
63
+ private static void testAlarmClusterByDingDingMarkDown () {
41
64
AlarmMessageInfo alarmMsg = new AlarmMessageInfo ();
42
65
// FF0000 (red), 008000(green), FFA500(yellow)
66
+ alarmMsg .setTitle ("**<font color=\" #FF0000\" >Kafka Eagle Alarm Notice</font>** \n \n " );
43
67
alarmMsg .setAlarmContent ("<font color=\" #FF0000\" >node.shutdown [ localhost:9092 ]</font>" );
44
68
// alarmMsg.setAlarmContent("<font color=\"#008000\">node.alive [
45
69
// localhost:9092 ]</font>");
@@ -50,8 +74,10 @@ private static void testAlarmClusterByDingDing() {
50
74
// alarmMsg.setAlarmStatus("<font color=\"#008000\">NORMAL</font>");
51
75
alarmMsg .setAlarmTimes ("current(1), max(7)" );
52
76
53
- IMServiceImpl im = new IMServiceImpl ();
54
- im .sendPostMsgByDingDing (alarmMsg .toDingDingMarkDown (), "" );
77
+ IMService im = new IMFactory ().create ();
78
+ im .sendPostMsgByDingDing (alarmMsg .toDingDingMarkDown (),"https://oapi.dingtalk.com/robot/send?access_token=3b7b59d17db0145549b1f65f62921b44bacd1701e635e797da45318a94339060" );
79
+ //IMServiceImpl im = new IMServiceImpl();
80
+ //im.sendPostMsgByDingDing(alarmMsg.toDingDingMarkDown(),"https://oapi.dingtalk.com/robot/send?access_token=3b7b59d17db0145549b1f65f62921b44bacd1701e635e797da45318a94339060");
55
81
}
56
82
57
83
private static void testConsumerHeathyByWeChat () {
@@ -73,8 +99,8 @@ private static void testConsumerHeathyByWeChat() {
73
99
lcm .setUser ("smartloli.org@gmail.com" );
74
100
75
101
IMServiceImpl im = new IMServiceImpl ();
76
- im .sendJsonMsgByWeChat (ccm .toWeChatMarkDown ());
77
- im .sendJsonMsgByWeChat (lcm .toWeChatMarkDown ());
102
+ im .sendJsonMsgByWeChat (ccm .toWeChatMarkDown (), "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=maMN2krp0GwiyxoA6JCULLk8oLHwfnjnojeYGma_5KG5J_JHqTledeY6AHWE2rwLTF6I5yqu5LJUmUpSn7feXauFySZtnOGlAvRACz33V2UegR596xuyOT4fZIfNzB1cqJi3A-Eahbw7UVG2a8AaHvN0ZrSRPkQiqWola5p71FfCpnuDEAw63THmURdfMIcF3QB5KFzl-qHblqXfQLtpeA" );
103
+ im .sendJsonMsgByWeChat (lcm .toWeChatMarkDown (), "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=maMN2krp0GwiyxoA6JCULLk8oLHwfnjnojeYGma_5KG5J_JHqTledeY6AHWE2rwLTF6I5yqu5LJUmUpSn7feXauFySZtnOGlAvRACz33V2UegR596xuyOT4fZIfNzB1cqJi3A-Eahbw7UVG2a8AaHvN0ZrSRPkQiqWola5p71FfCpnuDEAw63THmURdfMIcF3QB5KFzl-qHblqXfQLtpeA" );
78
104
}
79
105
80
106
private static void testClusterHeathyByDingDing () {
0 commit comments