[#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}.`);
letrow=awaitR.getRow("SELECT * FROM notification_sent_history WHERE type = ? AND monitor_id = ? AND days = ?",[
for(letnotificationofnotificationList){
try{
log.debug("monitor","Sending to "+notification.name);
awaitNotification.send(JSON.parse(notification.config),`[${this.name}][${this.url}] ${certType} certificate ${certCN} will be expired in ${daysRemaining} days`);
sent=true;
}catch(e){
log.error("monitor","Cannot send cert notification to "+notification.name);
log.error("monitor",e);
}
}
if(sent){
awaitR.exec("INSERT INTO notification_sent_history (type, monitor_id, days) VALUES(?, ?, ?)",[
"certificate",
this.id,
targetDays,
]);
// Sent already, no need to send again
if(row){
log.debug("monitor","Sent already, no need to send again");