ricoberger/script_exporter

script_exporter's script_exit_code differs from the actual script's exit code

ebdxflr opened this issue · 1 comments

When executed from CLI:

# /opt/script_exporter/check_type_current.sh
# echo `$?`
0

===
at the same time, script_exporter shows an exit code of -1 (and success as a False):

#  curl localhost:9469/probe?script=check_type_current
# HELP script_success Script exit status (0 = error, 1 = success).
# TYPE script_success gauge
script_success{script="check_type_current"} 0
# HELP script_duration_seconds Script execution time, in seconds.
# TYPE script_duration_seconds gauge
script_duration_seconds{script="check_type_current"} 0.001040
# HELP script_exit_code The exit code of the script.
# TYPE script_exit_code gauge
script_exit_code{script="check_type_current"} -1

I made sure to check the config.yaml file so it points to the proper script:

# grep check_type_current config.yaml
 - name: 'check_type_current'
   script: /opt/script_exporter/check_type_current.sh

fixed, my script was missing the #!/bin/bash shbang