Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

failed to unmarshal response body: unexpected end of JSON input #356

Open
dharmendrakariya opened this issue Jul 28, 2021 · 1 comment
Open

Comments

@dharmendrakariya
Copy link

Describe the bug
When I try to run the bot to get alert from aletmanager to matrix room I get the following errors.

time="2021-07-28T13:07:00Z" level=info msg="Go-NEB ({BindAddress::4050 DatabaseType:sqlite3 DatabaseURL:/data/go-neb.db?_busy_timeout=5000 BaseURL:http://x.x.x.x:4050 LogDir: ConfigFile:/data/config.yaml})"
time="2021-07-28T13:07:00Z" level=info msg="Inserted 1 clients"
time="2021-07-28T13:07:00Z" level=info msg="Inserted 0 realms"
time="2021-07-28T13:07:00Z" level=info msg="Inserted 0 sessions"
time="2021-07-28T13:07:00Z" level=info msg="Created new client" auto_join_rooms=true device_id=xxxxxx since= sync=true user_id="@dharmendra_kariya:matrix.xxxx.com"
time="2021-07-28T13:07:00Z" level=error msg="Error performing initial sync" error="failed to unmarshal response body: unexpected end of JSON input"
time="2021-07-28T13:07:00Z" level=error msg="Failed to join room" error="failed to unmarshal response body: unexpected end of JSON input" room_id="!uocgfRzsaAWPOFG:matrix.xx.com"
time="2021-07-28T13:07:00Z" level=info msg="Inserted 1 services"
time="2021-07-28T13:07:10Z" level=info msg="Incoming webhook request" path=/services/hooks/YWxlcnRtYW5hZ2VyX3NlcnZpY2U
time="2021-07-28T13:07:10Z" level=info msg="Incoming webhook for service" service_id=alertmanager_service service_type=alertmanager
time="2021-07-28T13:07:10Z" level=info msg="Sending Alertmanager notification to room" message="{m.text Prometheus Notification[firing] org.matrix.custom.html                   <font color='orange'><b>[FIRING - WARNING]</b></font>            KubeContainerWaiting : Pod monitoring/loki-stack-0 container loki has been in waiting state for longer than 1 hour.   <a href=\"http://monitoring-kube-prometheus-prometheus.monitoring:9090/graph?g0.expr=sum&#43;by%28namespace%2C&#43;pod%2C&#43;container%29&#43;%28kube_pod_container_status_waiting_reason%7Bjob%3D%22kube-state-metrics%22%2Cnamespace%3D~%22.%2A%22%7D%29&#43;%3E&#43;0&amp;g0.tab=1\">source</a><br/>   <nil> <nil> <nil> <nil>   [] false}" room_id="!uocgfRzsaAWPOFG:matrix.xx.com"
time="2021-07-28T13:07:10Z" level=info msg="Failed to send Alertmanager notification to room." error="failed to unmarshal response body: unexpected end of JSON input" room_id="!uocgfRzsaAWPOFG:matrix.xx.com"

To Reproduce
Steps to reproduce the behavior:

I am using this config file with docker container.


clients:
  - UserID: "@dharmendra_kariya:matrix.skycoin.com"
    AccessToken: "MDAyMGxvY2F0aW9uIG1hdHJpeC5za3ljb2luLmNvbQowMDEzaWRlbnRpZmllciBY1U3DHEsK"
    DeviceID: "BOZTMRPS"
    HomeserverURL: "https://matrix.xx.com/"
    Sync: true
    AutoJoinRooms: true
    DisplayName: "dharmendra"

services:
  - ID: "alertmanager_service"
    Type: "alertmanager"
    UserID: "@dharmendra_kariya:matrix.xx.com"
    Config:
      webhook_url: "http://x.x.x.x:4050/services/hooks/YWxlcnRtYW5hZ2VyX3NlcnZpY2U"
      # Each room will get the notification with the alert rendered with the given template
      rooms:
        "!uocgfRzsaAWPOFG:matrix.xx.com":
          text_template: "Prometheus Notification[{{.Status}}]"
          html_template: "{{range .Alerts -}}  {{ $severity := index .Labels \"severity\" }}    {{ if eq .Status \"firing\" }}      {{ if eq $severity \"critical\"}}        <font color='red'><b>[FIRING - CRITICAL]</b></font>      {{ else if eq $severity \"warning\"}}        <font color='orange'><b>[FIRING - WARNING]</b></font>      {{ else }}        <b>[FIRING - {{ $severity }}]</b>      {{ end }}    {{ else }}      <font color='green'><b>[RESOLVED]</b></font>    {{ end }}  {{ index .Labels \"alertname\"}} : {{ index .Annotations \"description\"}}   <a href=\"{{ .GeneratorURL }}\">source</a><br/>{{end -}}"
          msg_type: "m.text"  # Must be either `m.text` or `m.notice`

Also I have alertmanager config as below.

receiver: 'gonebreceiver'
      routes:
      - match:
        continue: true
        receiver: 'gonebreceiver'
    receivers:
    - name: 'gonebreceiver'
      webhook_configs:
        - url: 'http://x.x.x.x:4050/services/hooks/YWxlcnRtYW5hZ2VyX3NlcnZpY2U'

Expected behavior
Alerts should be sent to matrix room

Additional context

config is in data/config.yaml

Run below command to run bot in container

docker run -d --name gonebbot -p 4050:4050 -v /root/goneb/data:/data -e "BASE_URL=http://x.x.x.x:4050" -e "CONFIG_FILE=/data/config.yaml" matrixdotorg/go-neb

@dharmendrakariya
Copy link
Author

Update: I tried with this docker tag anoadragon453-patch-1 and its working fine
so must be something wrong with dockerfile I guess

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant