第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

將 Golang 模板中的對(duì)象置零

將 Golang 模板中的對(duì)象置零

Go
胡說(shuō)叔叔 2022-12-19 17:57:00
{{ define "default.message" }}{{- if gt (len .Alerts.Firing) 0 -}}{{- range $index, $alert := .Alerts.Firing -}}{{- if eq $index 0 -}}Detail: {{ $alert.Labels.alertname }}# Here I'm going to zero $alert{{- end }}{{- end }}{{- end }}{{- end }}你好,我想歸零.Alerts.Firing,這也是$alert在迭代之后。我是golang的新手,請(qǐng)幫忙,謝謝。補(bǔ)充:其實(shí)就是一個(gè)Prometheusalert模板。原始日期由創(chuàng)建alertmanager并發(fā)送至receiver(微信)。這是微信模板    {{ define "wechat.default.message" }}    {{- if gt (len .Alerts.Firing) 0 -}}    {{- range $index, $alert := .Alerts.Firing -}}    {{- if eq $index 0 -}}    Detail: {{ $alert.Labels.alertname }}    {{- end }}    ---- Problem started ------    Message: {{ $alert.Annotations.description }}    Time: {{ ($alert.StartsAt.Add 28800e9).Format "2006-01-02 15:04:05" }}    {{ if gt (len $alert.Labels.instance) 0 }}ip: {{ $alert.Labels.instance }};{{- end }}    {{- if gt (len $alert.Labels.namespace) 0 }}namespace: {{ $alert.Labels.namespace }};{{- end }}    {{- if gt (len $alert.Labels.node) 0 }}Node: {{ $alert.Labels.node }};{{- end }}    {{- if gt (len $alert.Labels.pod_name) 0 }}Pod: {{ $alert.Labels.pod_name }}{{- end }}    -----------------    {{ $alert :="" }}    {{- end }}    {{- end }}    {{- if gt (len .Alerts.Resolved) 0 -}}    {{- range $index, $alert := .Alerts.Resolved -}}    {{- if eq $index 0 }}    !!!! Problem resolved !!!!!    Detail: {{ $alert.Labels.alertname }}    {{- end }}    Started_at: {{ ($alert.StartsAt.Add 28800e9).Format "2006-01-02 15:04:05" }}    Resolved_at: {{ ($alert.StartsAt.Add 28800e9).Format "2006-01-02 15:04:05" }}    -------    {{ if gt (len $alert.Labels.instance) 0 -}}ip: {{ $alert.Labels.instance }};{{- end }}    {{- if gt (len $alert.Labels.namespace) 0 -}}namespace: {{ $alert.Labels.namespace }};{{- end }}    {{- if gt (len $alert.Labels.node) 0 -}}Node: {{ $alert.Labels.node }};{{- end }}    {{- if gt (len $alert.Labels.pod_name) 0 -}}Pod: {{ $alert.Labels.pod_name }}{{- end }}    {{ $alert :="" }}所以很難看到發(fā)送的原始數(shù)據(jù)alertmanager。我能看到的只有這個(gè)模板渲染的結(jié)果。請(qǐng)看下面。
查看完整描述

1 回答

?
九州編程

TA貢獻(xiàn)1785條經(jīng)驗(yàn) 獲得超4個(gè)贊

只是 relealize 它不能通過(guò)零對(duì)象來(lái)解決。因?yàn)椋?/p>

  1. 無(wú)法在微信中保留最后一個(gè)“已解析”的主機(jī) 232.20。

  2. 下次原始數(shù)據(jù)仍包含“已解析”主機(jī) 232.20,因此無(wú)法以任何方式將其刪除。

  3. 所以輸出也不能改變。

謝謝。


查看完整回答
反對(duì) 回復(fù) 2022-12-19
  • 1 回答
  • 0 關(guān)注
  • 71 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)