Is there a way to monitor kube cron jobs using prometheus

I’m using these rules with kube-state-metrics: groups: – name: job.rules rules: – alert: CronJobRunning expr: time() -kube_cronjob_next_schedule_time > 3600 for: 1h labels: severity: warning annotations: description: CronJob {{$labels.namespaces}}/{{$labels.cronjob}} is taking more than 1h to complete summary: CronJob didn’t finish after 1h – alert: JobCompletion expr: kube_job_spec_completions – kube_job_status_succeeded > 0 for: 1h labels: severity: warning … Read more

How can I visualize a histogram with Promdash or Grafana?

Grafana v5+ provides direct support for representing Prometheus histograms as heatmap. http://docs.grafana.org/features/panels/heatmap/#histograms-and-buckets Heatmaps are preferred over histogram because a histogram does not show you how the trend changes over time. So if you have a time-series histogram, then use the heatmap panel to picture it. To get you started, here is an example (for Prometheus … Read more

How to use the selected period of time in a query?

There are two ways that I know: You can use the $__interval variable like this: increase(http_requests_total[$__interval]) There is a drawback that the $__interval variable’s value is adjusted by resolution of the graph, but this may also be helpful in some situations. This approach should fit your case better: Go to Dashboard’s Templating settings, create new … Read more

How can I alert for container restarted?

I used the following Prometheus alert rule for finding container restarts in an hour(can be modified to max time), It may be helpful for you. Prometheus Alert Rule Sample ALERT ContainerRestart/PodRestart IF rate(kube_pod_container_status_restarts[1h]) * 3600 > 1 FOR 5s LABELS {action_required = “true”, severity=”critical/warning/info”} ANNOTATIONS {DESCRIPTION=”Pod {{$labels.namespace}}/{{$labels.pod}} restarting more than once during last one hours.”, … Read more

Getting error “Get http://localhost:9443/metrics: dial tcp 127.0.0.1:9443: connect: connection refused”

Since the targets are not running inside the prometheus container, they cannot be accessed through localhost. You need to access them through the host private IP or by replacing localhost with docker.for.mac.localhost or host.docker.internal. On Windows: host.docker.internal (tested on win10, win11) On Max docker.for.mac.localhost

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)