Git Product home page Git Product logo

calert's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ’ฌ Ask me about Devops, DNS, Monitoring, Self Hosting and such.
  • ๐Ÿ“ซ How to reach me: Twitter
  • ๐Ÿ˜„ Pronouns: he/him

calert's People

Contributors

alexandermarston avatar aslafy-z avatar bop0hz avatar donbowman avatar dreamblack86 avatar dsteininger86 avatar lnagy-ftmo avatar megarrusvakarian avatar mpv avatar mr-karan avatar oliverbr avatar pslattery avatar sabretus avatar uantbou avatar umomany avatar weibo-zhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

calert's Issues

error preparing message" error="template: message.tmpl: \"message.tmpl\" is an incomplete or empty template

I have implemented the helm chart based out of the repo and getting this error whenever alert manager is trying to dispatch an alert. Can you please provide me any help and below is the mentioned error.

time="2023-05-31T14:15:13Z" level=error msg="Error parsing values in template" error="template: message.tmpl: "message.tmpl" is an incomplete or empty template"
time="2023-05-31T14:15:13Z" level=error msg="error preparing message" error="template: message.tmpl: "message.tmpl" is an incomplete or empty template"

$ cat message.tmpl (Output from the pod)
({{.Labels.severity | toUpper }}) {{ .Labels.alertname | Title }} - {{.Status | Title }}
{{ range .Annotations.SortedPairs -}}
{{ .Name | Title }}: {{ .Value}}
{{ end -}}

Configuration option server.socket is ignored

I would like to use calert with a UNIX domain socket.

It is documented in the README that a socket can be specified with the server.socket configuration option.

However, I have grepped through the source code for socket and I can see that the value of server.socket is only used when it is printed to the log with sysLog.Printf and the value is not used for anything else.

I would suggest that either the server.socket configuration option is removed (because it currently does nothing), or support should be added so that a domain socket can be used instead of a TCP port.

For example, in an Nginx configuration you can specify the syslog server as either an domain or IP address with an optional port, or alternatively as a UNIX domain socket (see here for the relevant docs). If something similar was implemented here, to use a UNIX domain socket you would write something like address = "unix:/tmp/calert.sock" instead of address = ":6000". This would allow a socket to be used instead of a TCP port.

Missing message.tmpl file when using image v1.2.2 in a kubernetes deployment

Hi there

First of all: Thanks for this app!

I am currently experiencing an error when updating the deployment to use the image version 1.2.2 instead of 1.0.0-stable. I use the image in a Kubernetes deployment, just like the one in your kustomize folder.

The error I am getting when using kubectl logs is the following:

ERR: 2021/05/05 07:32:05 /home/karan/Projects/calert/helper.go:25: Error reading template open message.tmpl: no such file or directory
ERR: 2021/05/05 07:32:05 /home/karan/Projects/calert/main.go:44: Error while processing request: open message.tmpl: no such file or directory

The /ping healthcheck is working. Everything should be configured correctly, room name, url etc.

With version 1.0.0-stable everything worked perfectly fine.

Any ideas? Am I missing something in my Kubernetes resources?

UPDATE:
I was able to get it running by just adding the message.tmpl file in the container root /. How can bis be fixed in the image?

4096 character limit

There should probably be an option to "truncate" the message to 4095 characters to prevent this sort of error... alternatively add the same limit and not accept a message that long to pass on?

ERR: 2020/04/01 21:53:03 /calert/notification.go:48: Error sending alert Webhook API error: {
  "error": {
    "code": 400,
    "message": "Message is longer than 4096 characters",
    "status": "INVALID_ARGUMENT"
  }
}

Problem acknowledging active alerts and creating flood in channels

Hello Mr. Karan :)

I am using calert 2.0.2 in my kube-prometheus-stack deployment (31.0.0) to send the alerts from alertmanager to Google Chat receivers.
I use the prometheus-telegram-bot 1.0.0. as well.

Google Chat receivers works properly with 99% alerts/rules, but I have a problem with an specific alertmanager rule:

image

- alert: CollectorsMetricsInputInfo expr: sum by (collector, namespace, component, container) (round(increase(collector_inputcount[4h]))) == 0 for: 24h labels: severity: info {{- if .Values.kubeprometheusstack.defaultRules.additionalRuleLabels }} {{ toYaml .Values.kubeprometheusstack.defaultRules.additionalRuleLabels | indent 8 }} {{- end }} annotations: summary: Collector pod did not receive messages for 4 hours message: Collector {{{{}}$labels.container{{}}}} in namespace {{{{}}$labels.namespace{{}}}} from {{{{}}$labels.component{{}}}} has NO INPUT messages since 4 hours ago.

This rule give me alerts like this:

collectorinfoalerts

As I said, these rule/alerts works properly with Telegram receivers, but not with Google Chat. In Google Chat, I get a huge flood of the same alert message repeating (maybe 100 in a row, in less than 5 minutes), continuously, some with "resolved" status, but most like "firing".

gchatalertscollector

The only way to avoid that flood is to silence this alerts in AlertManager.

Meanwhile, the behavior with prometheus-telegram-bot is normal.

To me, it looks related to the way to identify what alert is new and what is not, or their fingerprint, according to #25, but I am unable to see what is wrong with this kind of rule.

A few calert pod logs; I don't see anything strange on it; but you can see how is dispatching new messages to the chat almost each 30 seconds, and always the same alerts:

2022/04/04 06:29:59 [google-chat-bot-7fc5cfb54-f5ngv/krB1cViUTd-010859] "POST http://google-chat-bot:6000/dispatch HTTP/1.1" from 110.124.152.4:34410 - 200 40B in 7.066438793s
time="2022-04-04T06:29:59Z" level=info msg="dispatching new alert" receiver=default-alertmanager-config-alert-info
time="2022-04-04T06:29:59Z" level=info msg="dispatching alerts" count=10
time="2022-04-04T06:29:59Z" level=info msg="dispatching alerts to google chat" count=10

2022/04/04 06:30:05 [google-chat-bot-7fc5cfb54-f5ngv/krB1cViUTd-010860] "POST http://google-chat-bot:6000/dispatch HTTP/1.1" from 110.124.152.4:34482 - 200 40B in 6.447221446s
time="2022-04-04T06:30:05Z" level=info msg="dispatching new alert" receiver=default-alertmanager-config-alert-info
time="2022-04-04T06:30:05Z" level=info msg="dispatching alerts" count=10
time="2022-04-04T06:30:05Z" level=info msg="dispatching alerts to google chat" count=10

2022/04/04 06:30:11 [google-chat-bot-7fc5cfb54-f5ngv/krB1cViUTd-010861] "POST http://google-chat-bot:6000/dispatch HTTP/1.1" from 110.124.152.4:34578 - 200 40B in 6.297160372s
time="2022-04-04T06:30:11Z" level=info msg="dispatching new alert" receiver=default-alertmanager-config-alert-info
time="2022-04-04T06:30:11Z" level=info msg="dispatching alerts" count=10
time="2022-04-04T06:30:11Z" level=info msg="dispatching alerts to google chat" count=10

Would you be so kind to guide me on what might be going on?
I would like these alerts to reach both, Telegram and Google Chat, but the flood makes the Google chat channel unusable.

If you need any extra information please let me know.

A lot of thanks!!! :)

Referencing attributes from alertmanager payload in message.tmpl

Hello, given that the alert manager payload looks like this:

{
  "version": "4",
  "groupKey": [<string>](https://prometheus.io/docs/alerting/latest/configuration/#string),              // key identifying the group of alerts (e.g. to deduplicate)
  "truncatedAlerts": [<int>](https://prometheus.io/docs/alerting/latest/configuration/#int),          // how many alerts have been truncated due to "max_alerts"
  "status": "<resolved|firing>",
  "receiver": [<string>](https://prometheus.io/docs/alerting/latest/configuration/#string),
  "groupLabels": <object>,
  "commonLabels": <object>,
  "commonAnnotations": <object>,
  "externalURL": [<string>](https://prometheus.io/docs/alerting/latest/configuration/#string),           // backlink to the Alertmanager.
  "alerts": [
    {
      "status": "<resolved|firing>",
      "labels": <object>,
      "annotations": <object>,
      "startsAt": "<rfc3339>",
      "endsAt": "<rfc3339>",
      "generatorURL": [<string>](https://prometheus.io/docs/alerting/latest/configuration/#string),      // identifies the entity that caused the alert
      "fingerprint": [<string>](https://prometheus.io/docs/alerting/latest/configuration/#string)        // fingerprint to identify the alert
    },
    ...
  ]
}

How can I reference commonAnnotations or externalURL inside message.tmpl file?

reusing threads on alert updates

Wondering if it is possible to send messages concerning the same issue to the same chat thread?

eg. Have the "Resolved" alert go to the same thread as the "Firing" alert.

no provider available for room

Error LOG

(*Notifier).Dispatch","file":"/home/runner/work/calert/calert/internal/notifier/notifier.go","line":41},"msg":"dispatching alerts","count":1}
{"time":"2024-03-26T17:01:19.101881613Z","level":"ERROR","source":{"function":"github.com/mr-karan/calert/internal/notifier.(*Notifier).Dispatch","file":"/home/runner/work/calert/calert/internal/notifier/notifier.go","line":45},"msg":"no provider available for room","room":"cattle-monitoring-system/alertas/alertas"}
{"time":"2024-03-26T17:01:19.102244707Z","level":"ERROR","source":{"function":"main.handleDispatchNotif.func1","file":"/home/runner/work/calert/calert/cmd/handlers.go","line":109},"msg":"error dispatching alerts","error":"no provider configured for room: cattle-monitoring-system/alertas/alertas"}

AlertManager Config

apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: alertas
  namespace: cattle-monitoring-system
spec:
  receivers:
    - name: alertas
      webhookConfigs:
        - url: http://caalert-calert:6000/dispatch
  route:
    groupBy:
      - job
    groupInterval: 5m
    groupWait: 30s
    receiver: alertas
    repeatInterval: 12h

ConfigMap

   [providers.alertas]
  
    type = "google_chat"
  
    endpoint =
    "https://chat.googleapis.com/v1/spaces/XXXXXXXXXXXXXXXXXXXXXXXXX"
  
    max_idle_conns = 50
  
    timeout = "30s"
  
    proxy_url = ""
  
    template = "static/message.tmpl"
  
    thread_ttl = "12h"
  
    dry_run = "false"

context deadline exceeded (Client.Timeout exceeded while awaiting headers)

@mr-karan After upgrading to v1.2.0, I haven't yet received any alerts, only a log message like this:

ERR: 2020/05/20 14:42:48 /home/karan/Projects/calert/main.go:44: Error while processing request: Post "https://chat.googleapis.com/v1/spaces/AAAAAAAA11/messages?key=mykeyhere&token=mytokenhere%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

Alert template error

Alert templating *({{.Labels.severity | toUpper }}) fails when you don't have severity in alert rules into a string.

Example:

        - alert: High Node CPU Usage
          annotations:
            summary: Example summary
          expr: |
            <Example Expr>
          for: 5m
          labels:
            team: devops
            severity: "critical"

This will pass but

        - alert: High Node CPU Usage
          annotations:
            summary: Example summary
          expr: |
            <Example Expr>
          for: 5m
          labels:
            team: devops
            severity: critical # without quotes

This fails with msg="Error parsing values in template" error="template: message.tmpl:1:23: executing \"message.tmpl\" at <toUpper>: invalid value; expected string"

Update on the project status

Firstly, everyone using this project, thanks a lot! It's been a while since I've worked on this code-base since my original needs were met on v1 and I've just gotten busy with other things. This was also kind of my first bigger OSS codebase in Golang when I initially started working 3 years back.

I've a lot to improve in terms of docs/semantics and I'm planning for a full rewrite major version (v2). Stuff I've in mind:

  • Add metrics to the library itself, so users can see how many alerts were sent/errors etc.
  • Use koanf instead of viper and make existing config easier
  • Use providers package interface for notifications. I am thinking to extend cAlert beyond Google Chat and add Rocketchat support as well. I'll have to do a feasibility check on this, but with this change, I'll be happy to accept PRs for other notification providers as well if someone's interested in.
  • Automated releases using GitHub Actions
  • And ofcourse, cleanup the code structure :)

I expect a v2 alpha at-least by end of February. If there's a feature you'd like to see, please mention it here and I'll add in my roadmap if it's feasible for me to implement.

Thanks!

Templating - reReplaceAll not defined

Hi! I need to replace space in the alertname with %20 but the function "reReplaceAll" is appearing as not defined.
I tested with urlquery and it replace " " with +, but with this I need to replace + with %20.

Do you guys know how can I use the function reReplaceAll? I checked and it was implemented by the alertmanager lib here.

Error:
time="2023-05-26T13:04:08Z" level=fatal msg="error initialising google chat provider" error="template: message.tmpl:28: function \"reReplaceAll\" not defined"

Template:

{{- define "alert_silence_link" -}}
{{- if eq .Status "firing" -}}
{{ template "externalURL" . }}/#/silences/new?filter=%7B
{{- range .Labels.SortedPairs -}}
{{- if ne .Name "alertname" -}}
{{- .Name }}%3D%22{{ urlquery .Value | reReplaceAll "\+" "%20" }}%22%2C%20
{{- end -}}
{{- end -}}
alertname%3D%22{{ urlquery .Labels.alertname | reReplaceAll "\+" "%20" }}%22%7D
{{- end -}}
{{- end -}}

Input emoticon on json

hi how to put the emoticon on json I try explicitly put โš ๏ธ but on google chat doesn't show the emoticon.

Log messages should not contain the path of the source files on the build machine

When I run calert from the terminal I get log messages such as these (ignoring the ERR messages which were due to a typo in my configuration file):

$ ./calert
SYS: 2022/01/31 02:44:44 /home/karan/Code/Personal/calert/main.go:154: listening on :6000 | /tmp/calert.sock
ERR: 2022/01/31 02:44:46 /home/karan/Code/Personal/calert/helper.go:26: Error reading template open /etc/calert/message.tmpl: no such file or directory
ERR: 2022/01/31 02:44:46 /home/karan/Code/Personal/calert/main.go:46: Error while processing request: open /etc/calert/message.tmpl: no such file or directory

The log messages contain the paths such as /home/karan/Code/Personal/. These paths should not be included in the logs. For example, the logs from alertmanager do not contain such paths.

Many thanks.

executing \"message.tmpl\" at <toUpper>: invalid value; expected string

Hi,

first of all thanks for this project!

I am trying to set this up in our cluster and get this error for my test alert:

calert-6b5574c764-mzq5z time="2022-11-30T15:25:43Z" level=error msg="Error parsing values in template" error="template: message.tmpl:1:24: executing \"message.tmpl\" at <toUpper>: invalid value; expected string"
calert-6b5574c764-mzq5z time="2022-11-30T15:25:43Z" level=error msg="error preparing message" error="template: message.tmpl:1:24: executing \"message.tmpl\" at <toUpper>: invalid value; expected string"

This is how message.tmpl within the container looks like:

root@calert-6b5574c764-mzq5z:/app# cat static/message.tmpl
*({{ .Labels.severity | toUpper }}) {{ .Labels.alertname | Title }} - {{ .Status | Title }}*
{{ range .Annotations.SortedPairs -}}
{{ .Name | Title }}: {{ .Value}}
{{ end -}}

The configmap :

Data
====
config.toml:
----
[app[]
address = "0.0.0.0:6000"
server_timeout = "60s"
enable_request_logs = true
log = "debug"
[providers.cp[]
type = "google_chat" # Type of provider. Currently supported value is `google_chat`.
endpoint = "<webhook>" # Google Chat Webhook URL
max_idle_conns =  50 # Max idle connections in the HTTP Client.
timeout = "30s" # Timeout for making requests to Provider.
template = "static/message.tmpl" # Path to specify the message template path.
thread_ttl = "12h" # Timeout to keep active alerts in memory. Once this TTL expires, a new thread will be created.
dry_run = true

message.tmpl:
----
*({{ .Labels.severity | toUpper }}) {{ .Labels.alertname | Title }} - {{ .Status | Title }}*
{{ range .Annotations.SortedPairs -}}
{{ .Name | Title }}: {{ .Value}}
{{ end -}}


BinaryData
====

calert v2.0.4

Any hint is appreciated!

BUG: Config from Env-Variables

Hi @mr-karan thanks for your great project.
I think I noticed a little bug and documentation typo:

  • Bug: I was not able to use it with environment variables. I think calert searches always the config-file because I constantly get the error panic: open config.sample.toml: no such file or directory even If I set the env-vars.
  • Doc: In the documentation the prefix is CALERT_ but in the codes it looks like the prefix should be CALERTS_. (I am not a Go programmer, so excuse me if i am wrong.)

Gchat thread doesn't works

Hi,

Yesterday i did mutiple tests and i have upgraded the version of calert to 2.0.6 to test the new functionality of gchat thread like the following example :

image

but when i have tried to do this with calert and gchat in thread channel gchat (same channel like the example above) it's doesn't works :

image

our configuration alertmanager :

image

our configuration calert :

image

We have try to change the group by to this :

- receiver: 'google-chat' group_by: [...] matchers: - severity =~ "warning|critical"

but nothing changed

if you have any idea or this not yet impleted in calert for this functionality or if it's need a specific configuration.

thank you in advance.

JSON special characters show up escaped

Hi @mr-karan,
Thanks for making calert, we just deployed it at Pix4D and we're really happy with it!

We noticed the following issue. Take an alert where, for example, the summary field contains " characters:

# test-payload.json
{
    "alerts": [
        {
            "status": "firing",
            "annotations": {
                "summary": "Server \"foo\" is down"
            }
        }
    ]
}

Now send this to calert

curl -XPOST -d @test-payload.json http://localhost:6000/create?room_name=test -i

The following message shows up in the targeted Hangouts Chat channel (using the default message template):

summary: Server &#34;foo&#34; is down

In this case, I'd expect the double quotes to be kept and not escaped.

ConfigMap -> Secret

The Google Chat webhook might be consider something to treat as a secret.

What's your view on deploying it as a kind: Secret instead of kind: ConfigMap?

Alerts templating

Hi there! This issue is related to #62

I am curious about templating opportunities provided by your solution, but struggling to find any. By looking at calert message.tmpl it seems to be supporting Markdown, which is fine, but looks a little bit limited. Are there any plans to work on templating capability of Calert overall?

Thanks

Redirecting Alert to a Google Chat Room with Spaces in its Name.

Hi. I have been using CAlert quite actively. It's working like a charm, but for the Google Chat Rooms whose name has space in it, it fails. No alert is redirected to that chat.
Is there any workaround for it?

For eg. The redirection would work fine for the name - "ChatRoom", but would fail for "Chat Room".

What is the url of the helm chart repository?

This is not an issue, it's just a question but I couldn't find where to raise a discussion, I would like to know what is the url of the chart to display it or is it only allowed manually?

It would be nice to have the Calert in Artifact Hub

Hi, Is it possible for you to put your helm in artifact hub? Because It helps a lot for us to get the helm available for deploy.
Because there are people uploading your helm, but, doing that wrong, by uploading unavailable helm package, like this, and It is bad for the community that wants a lot your Calert Helm.

Alertmanager grouping is not working on Calert 2.0.2

Prometheus 2.35.0
Alertmanager 0.24.0
Calert 2.0.2

After I upgraded the Calert from 1.2.4 to 2.0.2, Alertmanager grouped alerts are no longer being sent to a unique Google chat thread.

On Calert 1.2.4

Calert-1 2 4

On Calert 2.0.2

Calert-2 0 2

Note1: I noted that if I removed the "fingerprint" field of the Alertmanager JSON test payload or use the same "fingerprint" value for the grouped alerts, then the alerts go to the same thread. Actually, this is not possible because Alertmanager generates different fingerprints for different alerts in the same group.

Note2: The Calert threading support seems to be working correctly, I mean, the "Firing" and "Resolved" alerts are being sent to the same Google chat thread (one thread for each alert in the group, unfortunately).

Implement leader election

The thread memory feature does not work well when using multiple replicas.
Implementing leader election and forward inbound requests to the leader could solve this issue.

Error when upgrade to v1.2.0

I deployed calert by helm and got the error when use v1.2.0 as below:

ERR: 2020/05/16 14:03:25 /home/karan/Projects/calert/main.go:90: Error reading config: Config File "config" Not Found in "[/]"

Error msg="error dispatching alerts" error="no provider configured for room: calert"

Hi , First I wanted to thank you for creating the helm chart and writing this useful project .
I have an issue when i try to integrate the calert with alertmanager I use kube-prometheus-stack helm chart , im getting this error at the calert pod logs : level=error msg="error dispatching alerts" error="no provider configured for room: calert"

this is the error im getting in alertmanager pod logs : receiver=calert integration=webhook[0] msg="Notify attempt failed, will retry later" attempts=1 err="unexpected status code 500: http://calert:6000/dispatch"

here is the calert chart values :

app:
address: "0.0.0.0:6000" # Address of the HTTP Server.
server_timeout: "60s" # Server timeout for HTTP requests.
enable_request_logs: true # Whether to log incoming HTTP requests or not.
log: "debug" # Use debug to enable verbose logging. Can be set to info otherwise.

providers:
prod_alerts:
type: "google_chat" # Type of provider. Currently supported value is google_chat.
endpoint: "https://chat.googleapis.com/v1/spaces/My_space/messages?key=key&token=token%3D" # Google Chat Webhook URL
max_idle_conns: 50 # Max idle connections in the HTTP Client.
timeout: "30s" # Timeout for making requests to Provider.
#proxy_url: "http://internal-squid-proxy.com:3128" # Specify proxy_url as your proxy endpoint to route all HTTP requests to the provider via a proxy.
template: "static/message.tmpl" # Path to specify the message template path.
thread_ttl: "12h" # Timeout to keep active alerts in memory. Once this TTL expires, a new thread will be created.
dry_run: false

templates:
message.tmpl: |
({{.Labels.severity | toUpper }}) {{ .Labels.alertname | Title }} - {{.Status | Title }}
{{ range .Annotations.SortedPairs -}}
{{ .Name | Title }}: {{ .Value}}
{{ end -}}

args:

  • "--config=/app/static/config.toml"

service:
type: ClusterIP
port: 6000

here is the alertmanager chart values :

alertmanager:

enabled: true

apiVersion: v2

config:
global:
resolve_timeout: 5m
inhibit_rules:
- source_matchers:
- 'severity = critical'
target_matchers:
- 'severity =~ warning|info'
equal:
- 'namespace'
- 'alertname'
- source_matchers:
- 'severity = warning'
target_matchers:
- 'severity = info'
equal:
- 'namespace'
- 'alertname'
- source_matchers:
- 'alertname = InfoInhibitor'
target_matchers:
- 'severity = info'
equal:
- 'namespace'
route:
group_by: ['namespace']
group_wait: 30s
group_interval: 60s
repeat_interval: 3h
receiver: 'calert'
routes:
- receiver: 'null'
matchers:
- alertname =~ "InfoInhibitor|Watchdog"
- receiver: 'calert'
receivers:
- name: 'null'
- name: 'calert'
webhook_configs:
- url: 'http://calert:6000/dispatch'
templates:
- '/etc/alertmanager/config/*.tmpl'

I would be happy to receive direction on how to solve this error thank you .

Error sending alert: Message is longer than 4096 characters

Quite often we're getting this error (when there's multiple critical alerts firing), and sadly they don't get propagated due to Google Chat preventing larger messages:

ERR: 2020/05/19 16:01:06 /calert/notification.go:48: Error sending alert Webhook API error: {
  "error": {
    "code": 400,
    "message": "Message is longer than 4096 characters",
    "status": "INVALID_ARGUMENT"
  }
}
ERR: 2020/05/19 16:01:06 /calert/main.go:44: Error while processing request: Error while sending alert

Have you also seen this yet?
Any ideas on solutions/workarounds?

InvalidValue Error in Template

Hi,

Thanks for your great work.I am trying to Implement calert with prometheus alertmanager. I am getting following error when alertmanager pushed alert to calert

ERROR[2024-02-16T09:59:13Z] Error parsing values in template error="template: message.tmpl:1:78: executing "message.tmpl" at : invalid value; expected string"
ERROR[2024-02-16T09:59:13Z] error preparing message error="template: message.tmpl:1:78: executing "message.tmpl" at : invalid value; expected string"

It will be great if you can guide me

Error parsing values

Greetings and pardon my lack of knowledge with go.

I'm receiving an endless stream of errors regarding the message.tmpl

ERR: 2023/01/02 16:10:45 /home/karan/Code/Personal/calert/main.go:46: Error while processing request: template: message.tmpl:1:78: executing "message.tmpl" at <toUpper>: invalid value; expected string

I'm using the example provided and wondering why the error when parsing toUpper

Here's my message.tmpl

*{{ .Labels.alertname | Title }} - {{.Status | Title }} ({{.Labels.severity | toUpper }})*
{{ range .Annotations.SortedPairs -}}
{{ .Name }}: {{ .Value}}
{{ end -}}

Any help would be appreciated!

run container with a nonroot user

Hello,
Thank you for the projet.
Could you use a nonroot user to run it ?

RUN groupadd -g 999 appgroup && \ useradd -r -u 999 -g appgroup appuser USER appuser

regards

Enable helm chart repository

This is a followup of #56, #48, #50

The URL https://mr-karan.github.io/calert/charts gives a 404, currently, so the helm repository is not yet functional for what I can see.

I think what needs to be done are the steps listed in #50

and

HTTP request proxy config

Hello,

Thanks for creating a great project! Is there any way to specify a proxy setting while sending the HTTPS request to google chat room? I'm using v1.2.1.

I'm getting similar error as below which I think is due to network issue. ERR: 2020/05/20 14:42:48 /home/karan/Projects/calert/main.go:44: Error while processing request: Post "https://chat.googleapis.com/v1/spaces/AAAAAAAA11/messages?key=mykeyhere&token=mytokenhere%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers)`

Option to disable threading in 2.1.x

Message threading is causing us to miss some alerts, so we've had to roll back to v2.0.7. Would it be possible to add a config option to disable threading?

Publishing helm chart to github pages

In order to consume the helm chart, it needs to be published somewhere.
GitHub Pages can be used for this.
GitHub Actions can do the publishing, using something like "chart releaser": https://github.com/helm/chart-releaser-action

Would you be up for setting this up?

CR assumes the helm chart is placed in a "charts" directory, so it might involve also moving it into such a subfolder.

How to color important stuff?

Is it possible to use colors?
I tried the following config but it did not work as expected:

templates:
  message.tmpl: |
    {{- if ne .Status "Resolved" -}}<font color=#FF0000>{{- else -}}<font color=#00FF00>{{- end -}}*({{.Labels.severity | toUpper }}) {{ .Labels.alertname | Title }} - {{.Status | Title }}*</font>
    {{ range .Annotations.SortedPairs -}}
    {{ .Name | Title }}: {{ .Value}}
    {{ end -}}

This results in this:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.