Closed telsip closed 1 year ago
Seems this block is never entered:
if !e.noargs {
scriptParams := params.Get("params")
if scriptParams != "" {
paramValues = strings.Split(scriptParams, ",")
for i, p := range paramValues {
paramValues[i] = params.Get(p)
}
}
}
Nevermind, looking at a closed issue had me figure it was the query URL not properly set. Maybe a good thing would be to improve the README.
So params points at query values that has to be set after like: http://localhost:9469/probe?script=helloworld&prefix=mypref¶ms=argv&argv=test
I am testing v2.14.0 in Docker as shown in the README.
/examples # ps -ef PID USER TIME COMMAND 1 root 0:00 /bin/script_exporter -config.file /examples/config.yaml
I slightly modified the helloworld.sh script as below: /examples # cat helloworld.sh
!/bin/sh
echo "hello_world{params=\"$1\",\"$2\"} 1"
I then query as below: http://localhost:9469/probe?script=helloworld&prefix=mypref¶ms=argv
The output shows (among other lines): mypref_hello_world{params="test",""} 1
I also tried the ping script (ping.sh) and no argument is passed.
Suggestions?