-
Notifications
You must be signed in to change notification settings - Fork 23
shell command execute error #32
Description
when source is shell and shell scripts with parameter(when no parameter is ok), result is: fork/exec /tmp/clean.sh 'testinstance1': no such file or directory
my config file :
block_cache_size: 52428800
pool_size: 100
runners: 10
remote_config_refresh_interval: 60s
common parameters for actions
common_parameters:
jenkins_credentials:
endpoint: https://jenkins.example.com/
login: webhooker
password: qwerty123
state_refresh_delay: 5s
telegram_bot:
bot_token: 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
chat_id: -1001103941234
message: Fixed ${LABEL_ALERTNAME}
list of rules to check and act
rules:
-
name: JenkinsAutofix
conditions:
alert_annotations:
webhooker_jenkins_autofix: enabled # auto fix enabled
jenkins_job: (.*?) # jenkins job is set
actions:- executor: jenkins
common_parameters: jenkins_credentials
parameters:
job: ${ANNOTATION_JENKINS_JOB} # job name from annotation jenkins_job
block: 1m - executor: telegram
common_parameters: telegram_bot
- executor: jenkins
-
name: LowDiskSpaceLogsFix
conditions:
alert_labels:
alertname: testalert1
instance: testinstance1
actions:- executor: shell
parameters:
command: "/tmp/clean.sh '${CUT_AFTER_LAST_COLON_LABEL_INSTANCE}'"
block: 30m - executor: telegram
common_parameters: telegram_bot
- executor: shell
-------------------------------end
cat /tmp/clean.sh
con="$1"
echo aaaa"$con" >> /tmp/webhook.log
ls -l /tmp/clean.sh
-rwxrwxrwx. 1 root root 45 Oct 13 10:40 /tmp/clean.sh
result log
{"context":"webhook","event_id":"6339","level":"debug","msg":"payload is received, tasks are prepared","payload":{"receiver":"","status":"firing","alerts":[{"status":"","labels":{"alertname":"testalert1","instance":"testinstance1","source":"shell"},"annotations":{"name":"TestAlert"},"startsAt":"0001-01-01T00:00:00Z","endsAt":"0001-01-01T00:00:00Z","generatorURL":""}],"groupLabels":null,"commonLabels":null,"commonAnnotations":null,"externalURL":""},"tasks_groups":[[{"alert":"testalert1","details":{"command":"/tmp/clean.sh 'testinstance1'"},"event_id":"6339","executor":"shell","rule":"LowDiskSpaceLogsFix"},{"alert":"testalert1","details":{"chatID":-1001103941234,"message":"Fixed testalert1"},"event_id":"6339","executor":"telegram","rule":"LowDiskSpaceLogsFix"}]],"time":"2022-10-13T10:55:29+08:00"}
{"context":"webhook","level":"debug","msg":"ready to send tasks to runner","tasks":[{"alert":"testalert1","details":{"command":"/tmp/clean.sh 'testinstance1'"},"event_id":"6339","executor":"shell","rule":"LowDiskSpaceLogsFix"},{"alert":"testalert1","details":{"chatID":-1001103941234,"message":"Fixed testalert1"},"event_id":"6339","executor":"telegram","rule":"LowDiskSpaceLogsFix"}],"time":"2022-10-13T10:55:29+08:00"}
{"context":"webhook","level":"debug","msg":"sent tasks to runner","tasks":[{"alert":"testalert1","details":{"command":"/tmp/clean.sh 'testinstance1'"},"event_id":"6339","executor":"shell","rule":"LowDiskSpaceLogsFix"},{"alert":"testalert1","details":{"chatID":-1001103941234,"message":"Fixed testalert1"},"event_id":"6339","executor":"telegram","rule":"LowDiskSpaceLogsFix"}],"time":"2022-10-13T10:55:29+08:00"}
{"context":"webhook","event_id":"6339","level":"debug","msg":"all tasks sent to runners","payload":{"receiver":"","status":"firing","alerts":[{"status":"","labels":{"alertname":"testalert1","instance":"testinstance1","source":"shell"},"annotations":{"name":"TestAlert"},"startsAt":"0001-01-01T00:00:00Z","endsAt":"0001-01-01T00:00:00Z","generatorURL":""}],"groupLabels":null,"commonLabels":null,"commonAnnotations":null,"externalURL":""},"tasks_groups":[[{"alert":"testalert1","details":{"command":"/tmp/clean.sh 'testinstance1'"},"event_id":"6339","executor":"shell","rule":"LowDiskSpaceLogsFix"},{"alert":"testalert1","details":{"chatID":-1001103941234,"message":"Fixed testalert1"},"event_id":"6339","executor":"telegram","rule":"LowDiskSpaceLogsFix"}]],"time":"2022-10-13T10:55:29+08:00"}
{"context":"runner","level":"debug","msg":"runner starts executing group","tasks":[{"alert":"testalert1","details":{"command":"/tmp/clean.sh 'testinstance1'"},"event_id":"6339","executor":"shell","rule":"LowDiskSpaceLogsFix"},{"alert":"testalert1","details":{"chatID":-1001103941234,"message":"Fixed testalert1"},"event_id":"6339","executor":"telegram","rule":"LowDiskSpaceLogsFix"}],"time":"2022-10-13T10:55:29+08:00"}
{"alert":"testalert1","context":"runner","details":{"command":"/tmp/clean.sh 'testinstance1'"},"event_id":"6339","executor":"shell","level":"debug","msg":"runner starts executing task #1/2","rule":"LowDiskSpaceLogsFix","tasks":[{"alert":"testalert1","details":{"command":"/tmp/clean.sh 'testinstance1'"},"event_id":"6339","executor":"shell","rule":"LowDiskSpaceLogsFix"},{"alert":"testalert1","details":{"chatID":-1001103941234,"message":"Fixed testalert1"},"event_id":"6339","executor":"telegram","rule":"LowDiskSpaceLogsFix"}],"time":"2022-10-13T10:55:29+08:00"}
{"alert":"testalert1","context":"runner","details":{"command":"/tmp/clean.sh 'testinstance1'"},"duration":"447.909μs","event_id":"6339","executor":"shell","level":"error","msg":"runner got executing task #1/2 error, stopping group: fork/exec /tmp/clean.sh 'testinstance1': no such file or directory","result":"exec_error","rule":"LowDiskSpaceLogsFix","tasks":[{"alert":"testalert1","details":{"command":"/tmp/clean.sh 'testinstance1'"},"event_id":"6339","executor":"shell","rule":"LowDiskSpaceLogsFix"},{"alert":"testalert1","details":{"chatID":-1001103941234,"message":"Fixed testalert1"},"event_id":"6339","executor":"telegram","rule":"LowDiskSpaceLogsFix"}],"time":"2022-10-13T10:55:29+08:00"}
{"context":"runner","level":"debug","msg":"runner finished executing group","tasks":[{"alert":"testalert1","details":{"command":"/tmp/clean.sh 'testinstance1'"},"event_id":"6339","executor":"shell","rule":"LowDiskSpaceLogsFix"},{"alert":"testalert1","details":{"chatID":-1001103941234,"message":"Fixed testalert1"},"event_id":"6339","executor":"telegram","rule":"LowDiskSpaceLogsFix"}],"time":"2022-10-13T10:55:29+08:00"}