Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix webhook notice error #1504

Merged
merged 3 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ protected String renderContent(NoticeTemplate noticeTemplate, Alert alert) throw
model.put("thresholdId", thresholdId);
}
}

model.put("alarmId", alert.getId());
model.put("status", alert.getStatus());
model.put("monitorIdLabel", bundle.getString("alerter.notify.monitorId"));
Expand Down Expand Up @@ -127,7 +126,6 @@ public void onEvent(SystemConfigChangeEvent event) {
log.info("{} receive system config change event: {}.", this.getClass().getName(), event.getSource());
this.bundle = ResourceBundleUtil.getBundle("alerter");
}

}


19 changes: 9 additions & 10 deletions manager/src/main/resources/templates/2-WebhookTemplate.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"alarmId": ${alarmId},
"target": "${target}",
<#if (thresholdId??)>"thresholdId": ${thresholdId},</#if>
"priority": ${priorityValue},
<#if alarmId??>"alarmId": ${alarmId},</#if>
<#if thresholdId??>"thresholdId": "${thresholdId}",</#if>
<#if priorityValue??>"priority": ${priorityValue},</#if>
"content": "${content}",
"status": ${status},
"times": ${times},
<#if status??>"status": ${status},</#if>
<#if times??>"times": ${times},</#if>
"triggerTime": "${triggerTime}",
<#if (restoreTime??)>"restoreTime": "${restoreTime}",</#if>
<#if (tags??)>
<#if restoreTime??>"restoreTime": "${restoreTime}",</#if>
<#if tags??>
"tags": {
<#list tags as key,value>
"${key}": "${value}",
"${key}": "${value}"<#if key_has_next>,</#if>
</#list>
}
</#if>
}</#if>
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.dromara.hertzbeat.manager.service;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.assertj.core.util.Maps;
import org.dromara.hertzbeat.common.entity.alerter.Alert;
import org.dromara.hertzbeat.common.entity.manager.NoticeReceiver;
Expand All @@ -23,7 +22,6 @@

import java.util.List;
import java.util.Map;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
Expand Down
Loading