Agent Environment
agent 7.63.3
Describe what happened:
I setup an alert based on the kubernetes_state.cronjob.on_schedule_check to detect missed Cronjob schedules.
Some K8s cronjobs are setup with the Cronjob spec timeZone parameter.
Example:
schedule: 30 8 * * 1-6
timeZone: Europe/Paris
With this configuration, the monitor based on this check is in error from 10:30 (UTC+2) even if the job executed at exactly 8:30 (UTC+2)
Describe what you expected:
No alert
Steps to reproduce the issue:
- Create a cronjob with a schedule based on a non UTC timeZone
- Create a monitor based on the
kubernetes_state.cronjob.on_schedule_check
- Wait for job scheduled execution time
Additional environment details (Operating System, Cloud provider, etc):
EKS
Analysis:
kube_cronjob_next_schedule_time does not take Cronjob spec timeZone parameter into account.
|
nextScheduledTime, err := getNextScheduledTime(j.Spec.Schedule, j.Status.LastScheduleTime, j.CreationTimestamp) |