PINPOINT Alarm Email을 셋팅하면서 정말 많은 삽질을 하였다.
우선 Mysql 셋팅을 해주어야한다.
우선 Web Project 아래 두개 properties에 mysql정보를 넣어 주었다.
/web/src/main/resources/profiles/jdbc-env.properties
/web/src/main/resources/jdbc.properties
jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/pinpoint?characterEncoding=UTF-8 jdbc.username=pinpoint jdbc.password=pinpoint
그리도 해당 DB에 table 생성 - CreateTableStatement-mysql.sql, SpringBatchJobReositorySchema-mysql.sql
메뉴얼 대로 아래 정보를 수정하였다.
회사에서 사용하는 email업체 정보로 연동하였다.
/web/src/main/resources/batch.properties
#batch server ip to execute batch batch.server.ip=127.0.0.1 batch.server.env=release #smtp config pinpoint.url=http://pinpoint.site.co.kr alarm.mail.server.url=mail.xxxxx.co.kr alarm.mail.server.port=465 alarm.mail.server.username=noreply@xxxxx.co.kr alarm.mail.server.password=abcdefg1234 alarm.mail.sender.address=nreply@xxxxx.co.kr alarm.mail.transport.protocol=smtp alarm.mail.smtp.port=465 alarm.mail.smtp.auth=true alarm.mail.smtp.starttls.enable=true alarm.mail.smtp.starttls.required=false alarm.mail.debug=true #flink server list batch.flink.server=
그리고 마지막으로
/quickstart/web/pom.xml 파일에서
-Dspring.profiles.active쪽에 batch를 추가해주어야한다.
<configuration> <home>${project.build.directory}/catalina-base</home> <type>standalone</type> <properties> <cargo.servlet.port>${quickstart.web.port}</cargo.servlet.port> <cargo.rmi.port>${quickstart.web.rmi.port}</cargo.rmi.port> <cargo.tomcat.ajp.port>${quickstart.web.ajp.port}</cargo.tomcat.ajp.port> <cargo.jvmargs> -Dmaven.pinpoint.identifier=${maven.pinpoint.identifier} -Dspring.profiles.active=release,batch </cargo.jvmargs> </properties> </configuration>
그리고 재시작을 한다.
그런데 재시작 이후에는 계속 에러가 발생.. 방화벽 포트가 다 열린 상태인데요.. 발송이 안되는 것이다.
[INFO] [talledLocalContainer] DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle] [INFO] [talledLocalContainer] DEBUG SMTP: useEhlo true, useAuth true [INFO] [talledLocalContainer] DEBUG SMTP: trying to connect to host "mail.xxxxx.co.kr", port 465, isSSL false [INFO] [talledLocalContainer] DEBUG SMTP: EOF: [EOF] [INFO] [talledLocalContainer] DEBUG SMTP: could not connect to host "mail.xxxxx.co.kr", port: 465, response: -1 [INFO] [talledLocalContainer] [INFO] [talledLocalContainer] 2020-07-31 17:58:01 [ERROR](c.n.p.w.a.SpringSmtpMailSender ) can't send alarm email. Rule{ruleId='2', applicationId='CMS_DEV', serviceType='TOMCAT', checkerName='ERROR RATE', threshold=1, userGroupId='CMS_DEV', smsSend=false, emailSend=true, notes='ERROR RATE CMS_DEV'} [INFO] [talledLocalContainer] org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: mail.xxxxx.co.kr, port: 465, response: -1. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: mail.xxxxx.co.kr, port: 465, response: -1; message exception details (1) are: [INFO] [talledLocalContainer] Failed message 1: [INFO] [talledLocalContainer] javax.mail.MessagingException: Could not connect to SMTP host: mail.cntt.co.kr, port: 465, response: -1
끝없는 삽질 끝에.. 원인을 찾았다..
/web/src/main/resources/batch/applicationContext-batch-sender.xml 파일을 보면 batch.properties 설정한 값을 불러온다
<bean id="javaMailSenderImpl" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="host" value="${alarm.mail.server.url:}" /> <!--<property name="port" value="${alarm.mail.server.port:587}" />--> <property name="username" value="${alarm.mail.server.username:}" /> <property name="password" value="${alarm.mail.server.password:}" /> <property name="javaMailProperties"> <props> <prop key="mail.transport.protocol">${alarm.mail.transport.protocol:}</prop> <prop key="mail.smtp.port">${alarm.mail.smtp.port:}</prop> <prop key="mail.smtp.from">${alarm.mail.sender.address:}</prop> <prop key="mail.smtp.auth">${alarm.mail.smtp.auth:false}</prop> <prop key="mail.smtp.starttls.enable">${alarm.mail.smtp.starttls.enable:false}</prop> <prop key="mail.smtp.starttls.required">${alarm.mail.smtp.starttls.required:false}</prop> <prop key="mail.debug">${alarm.mail.debug:false}</prop> <!-- add --> <prop key="mail.smtp.socketFactory.port">${alarm.mail.smtp.port:}</prop> <prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop> </props> </property> </bean>
mail.smtp.socketFactory.port
mail.smtp.socketFactory.class
두개의 값을 추가해 주었다.
그리고 나서는 정상적으로 아래와 같은 메일을 받을 수 있었다
'개발경험 및 메모 > Pinpoint' 카테고리의 다른 글
PINPOINT 2.0.3 quickstart 설치 (0) | 2020.07.30 |
---|---|
PINPOINT 2.0.3 설치 - Web, Collector, Agent (1) | 2020.07.27 |
PINPOINT 2.0.3 설치준비 - HBASE, TOMCAT (3) | 2020.07.27 |
PINPOINT 란? (0) | 2020.07.27 |
최근댓글