stakater / IngressMonitorController

A Kubernetes controller to watch ingresses and create liveness alerts for your apps/microservices in UptimeRobot, StatusCake, Pingdom, etc. – [✩Star] if you're using it!
https://stakater.com
Apache License 2.0
560 stars 102 forks source link

Issue in Adding Monitor to Status Page for Uptime Robot #352

Open kahootali opened 3 years ago

kahootali commented 3 years ago

I have created a Status Page on Uptime Robot and got the id of it by running curl -d "api_key=MY_API_KEY" -X POST https://api.uptimerobot.com/v2/getPSPs and used that ID in my EndpointMonitor

apiVersion: endpointmonitor.stakater.com/v1alpha1
kind: EndpointMonitor
metadata:
  name: test
spec:
  forceHttps: true
  url: https://test.DOMAIN
  uptimeRobotConfig:
    interval: 300
    monitorType: http
    statusPages: "ID_FROM_ABOVE"

But it isn't working and gives an error in the logs as below

2021-06-22T09:09:24.563Z    INFO    uptime-monitor-test Monitor Updated: test
2021-06-22T09:09:25.365Z    ERROR   uptime-monitor-test Unable to unmarshal JSON    {"error": "json: cannot unmarshal number into Go struct field UptimePublicStatusPage.psps.monitors of type []int"}
github.com/go-logr/zapr.(*zapLogger).Error
    /go/pkg/mod/github.com/go-logr/zapr@v0.2.0/zapr.go:132
sigs.k8s.io/controller-runtime/pkg/log.(*DelegatingLogger).Error
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/log/deleg.go:144
github.com/stakater/IngressMonitorController/pkg/monitors/uptimerobot.(*UpTimeStatusPageService).Get
    /workspace/pkg/monitors/uptimerobot/uptime-status-page.go:209
github.com/stakater/IngressMonitorController/pkg/monitors/uptimerobot.(*UpTimeStatusPageService).AddMonitorToStatusPage
    /workspace/pkg/monitors/uptimerobot/uptime-status-page.go:101
github.com/stakater/IngressMonitorController/pkg/monitors/uptimerobot.(*UpTimeMonitorService).updateStatusPages
    /workspace/pkg/monitors/uptimerobot/uptime-monitor.go:280
github.com/stakater/IngressMonitorController/pkg/monitors/uptimerobot.(*UpTimeMonitorService).handleStatusPagesConfig
    /workspace/pkg/monitors/uptimerobot/uptime-monitor.go:273
github.com/stakater/IngressMonitorController/pkg/monitors/uptimerobot.(*UpTimeMonitorService).Update
    /workspace/pkg/monitors/uptimerobot/uptime-monitor.go:169
github.com/stakater/IngressMonitorController/pkg/monitors.(*MonitorServiceProxy).Update
    /workspace/pkg/monitors/monitor-proxy.go:96
github.com/stakater/IngressMonitorController/pkg/controllers.(*EndpointMonitorReconciler).handleUpdate
    /workspace/pkg/controllers/endpointmonitor_updated.go:26
github.com/stakater/IngressMonitorController/pkg/controllers.(*EndpointMonitorReconciler).Reconcile
    /workspace/pkg/controllers/endpointmonitor_controller.go:95
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:298
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:253
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.2
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:216
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1
    /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1
    /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:155
k8s.io/apimachinery/pkg/util/wait.BackoffUntil
    /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:156
k8s.io/apimachinery/pkg/util/wait.JitterUntil
    /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:133
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext
    /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.UntilWithContext
    /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:99
2021-06-22T09:09:26.193Z    INFO    uptime-monitor-test Updated Page Request failed. Status Code: 500
2021-06-22T09:09:26.193Z    INFO    uptime-monitor-test Monitor couldn't be added to status page: Updated Page Request failed. Status Code: 500

Not sure if I am missing something

ahmedwaleedmalik commented 2 years ago

@kahootali I went through this issue and it's a limitation from the UptimeRobot API. From documentation of newPSPs from https://uptimerobot.com/api/,

  1. The field monitors can have either an integer or a list of integers as a response.
  2. By default it just returns 0 as a response which breaks the whole functionality in the code.

You'll have to open a support ticket at their end to fix this issue.

https://github.com/stakater/IngressMonitorController/blob/master/pkg/monitors/uptimerobot/uptime-responses.go#L72

karl-johan-grahn commented 1 year ago

@kahootali do you still experience this issue?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 30 days since being marked as stale.

karl-johan-grahn commented 9 months ago

Reopening issues that inadvertently were closed as stale