sensu-go icon indicating copy to clipboard operation
sensu-go copied to clipboard

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

Open daswars opened this issue 3 years ago • 2 comments

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

daswars avatar Nov 11 '21 10:11 daswars

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.

echlebek avatar Feb 09 '22 23:02 echlebek

@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?

asachs01 avatar Jan 17 '23 22:01 asachs01