[#2593] renamed the method `sendCertNotification` to better represent what id does. Evaluate certificate expiry from all certs in chain. Send a separate notification for every cert in chain, including cert type and CN.
log.debug("monitor",`No need to send cert notification for ${certInfo.certType} certificate "${subjectCN}" (${certInfo.daysRemaining} days valid) on ${targetDays} deadline.`);
}else{
log.debug("monitor",`call sendCertNotificationByTargetDays for ${targetDays} deadline on certificate ${subjectCN}.`);
log.debug("monitor",`No need to send cert notification. ${daysRemaining} > ${targetDays}`);
return;
}
if(notificationList.length>0){
letrow=awaitR.getRow("SELECT * FROM notification_sent_history WHERE type = ? AND monitor_id = ? AND days = ?",[
letrow=awaitR.getRow("SELECT * FROM notification_sent_history WHERE type = ? AND monitor_id = ? AND days = ?",[
"certificate",
"certificate",
@ -1175,7 +1185,7 @@ class Monitor extends BeanModel {
for(letnotificationofnotificationList){
for(letnotificationofnotificationList){
try{
try{
log.debug("monitor","Sending to "+notification.name);
log.debug("monitor","Sending to "+notification.name);
awaitNotification.send(JSON.parse(notification.config),`[${this.name}][${this.url}] Certificate will be expired in ${daysRemaining} days`);
awaitNotification.send(JSON.parse(notification.config),`[${this.name}][${this.url}] ${certType} certificate ${certCN} will be expired in ${daysRemaining} days`);
sent=true;
sent=true;
}catch(e){
}catch(e){
log.error("monitor","Cannot send cert notification to "+notification.name);
log.error("monitor","Cannot send cert notification to "+notification.name);
@ -1190,9 +1200,6 @@ class Monitor extends BeanModel {
targetDays,
targetDays,
]);
]);
}
}
}else{
log.debug("monitor","No notification, no need to send cert notification");