ricoberger / script_exporter

Prometheus exporter to execute scripts and collect metrics from the output or the exit status.
MIT License
354 stars 82 forks source link

Unable to figure out "scripts_build_info" metric in your new releases. #22

Closed akanshgupta closed 4 years ago

akanshgupta commented 4 years ago

Hi @ricoberger I was trying to implement your script exporter but I don't see any "script_success" metric after running the script exporter. Is this removed or i am doing any mistake ?

Any help would be appreciated !!

ricoberger commented 4 years ago

Hi @akanshgupta, you can follow these steps to run the script exporter or use the binary from the release page:

git clone https://github.com/ricoberger/script_exporter.git
cd script_exporter
make build

Then start the script exporter with the configuration and scripts from the examples folder:

./bin/script_exporter -config.file ./examples/config.yaml

Then open http://localhost:9469/probe?script=test&prefix=test in your browser. This executes the test.sh shell script and you should see the metrics:

# HELP script_success Script exit status (0 = error, 1 = success).
# TYPE script_success gauge
script_success{} 1
# HELP script_duration_seconds Script execution time, in seconds.
# TYPE script_duration_seconds gauge
script_duration_seconds{} 0.154517
# HELP test_test_first_test
# TYPE test_test_first_test gauge
test_first_test{label="test_1_label_1"} 1
# HELP test_test_second_test
# TYPE test_test_second_test gauge
test_second_test{label="test_2_label_1",label="test_2_label_2"} 2.71828182846
# HELP test_test_third_test
# TYPE test_test_third_test gauge
test_third_test{} 3.14159265359
test_Fourth test
test_fourth label="test_1_label_1\ 4
test_Fifth test
test_fifth 5

The internal metrics from the script exporter are served at http://localhost:9469/metrics.

I hope this helps you. If you have any further questions feel free to ask.

akanshgupta commented 4 years ago

Hi @akanshgupta, you can follow these steps to run the script exporter or use the binary from the release page:

git clone https://github.com/ricoberger/script_exporter.git
cd script_exporter
make build

Then start the script exporter with the configuration and scripts from the examples folder:

./bin/script_exporter -config.file ./examples/config.yaml

Then open http://localhost:9469/probe?script=test&prefix=test in your browser. This executes the test.sh shell script and you should see the metrics:

# HELP script_success Script exit status (0 = error, 1 = success).
# TYPE script_success gauge
script_success{} 1
# HELP script_duration_seconds Script execution time, in seconds.
# TYPE script_duration_seconds gauge
script_duration_seconds{} 0.154517
# HELP test_test_first_test
# TYPE test_test_first_test gauge
test_first_test{label="test_1_label_1"} 1
# HELP test_test_second_test
# TYPE test_test_second_test gauge
test_second_test{label="test_2_label_1",label="test_2_label_2"} 2.71828182846
# HELP test_test_third_test
# TYPE test_test_third_test gauge
test_third_test{} 3.14159265359
test_Fourth test
test_fourth label="test_1_label_1\ 4
test_Fifth test
test_fifth 5

The internal metrics from the script exporter are served at http://localhost:9469/metrics.

I hope this helps you. If you have any further questions feel free to ask.

Yes, it worked, issue was in my shell script. But thanks for your quick response @ricoberger .

ricoberger commented 4 years ago

Nice, I would close this issue. Feel free to open a new one or reopen this one, if you have any further questions.