sensu / sensu-go

Simple. Scalable. Multi-cloud monitoring.
https://sensu.io
MIT License
1.02k stars 175 forks source link

check not running if you use a env_vars with a emtpy variable #4490

Open daswars opened 2 years ago

daswars commented 2 years ago

We find a bug in sensu. We cant use env_vars with a empty variable

type: CheckConfig
api_version: core/v2
metadata:
  annotations:
    fatigue_check/occurrences: "3"
  labels:
    sensu.io/workflow: sensu-flow
  name: check-cards
spec:
  command: cardmon.sh
  env_vars:
    - CARD_LIST={{ .labels.card_list | default "" }}
  handlers:
    - opsgenie
  interval: 60
  publish: true
  runtime_assets:
    - cards-ecsign
  stdin: false
  subscriptions:
    - cards
  timeout: 50

The check is in sensu, but is never executed and there is also no error message. The env_vars with a filled variable works. (CARD_LIST={{ .labels.card_list | default "test" }}) But in the same way I can use an empty variable directly in the command. cardmon.sh -C {{ .labels.card_list | default "" }}

The crappy thing is that it took us a long time to find the error and sensu here is no error at all, neither in the agent nor in the backend.

Sensu Agent: 6.5.4 Sensu Backend: 6.5.4

echlebek commented 2 years ago

Are you saying that cardmon.sh is never run?

Your examples don't really make sense to me, as the agent would be doing that token substitution, and you'd see

CARD_LIST="test"

or

CARD_LIST=""

in your process' environment.

asachs01 commented 1 year ago

@daswars it's been some time since you opened this request and we never heard back from you. Is this still occurring on a recent release?