This example/tutorial shows how to:
- start 3 testing OCI instances, with running
node_exporter
, - configure and run a standalone
oci-sd
application, which discovers these OCI instances, - start Prometheus with
file_sd
configuration, which starts to monitor these OCI instances.
Prerequisities: Terraform
cd example/terraform
- Edit
env-vars
that it contains proper values for your OCI tenancy (see CLI Configuration Information). . env-vars
terraform init
terraform plan
terraform apply -auto-approve
You should see 3 instances in your OCI Console:
These instances have running node_exporter
s on the 9100
port. As you can can see on following screenshot,
this port is open in the configured security list:
You can check that everything is fine via curl
:
curl <public-ip-of-your-instance>:9100/metrics
If you see something like following (abridged) output, you are ready for service discovery.
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 2.5834e-05
go_gc_duration_seconds{quantile="0.25"} 5.6118e-05
go_gc_duration_seconds{quantile="0.5"} 6.008e-05
go_gc_duration_seconds{quantile="0.75"} 6.812e-05
go_gc_duration_seconds{quantile="1"} 0.000120973
go_gc_duration_seconds_sum 0.118491416
go_gc_duration_seconds_count 1997
Prerequisities: oci-sd
binary
- Edit
example/conf/oci-sd.toml
that it contains proper values for your OCI tenancy (see CLI Configuration Information). ./bin/oci-sd -c example/conf/oci-sd.toml -o example/prometheus/oci-sd.json
Prerequisities: Prometheus
./prometheus --config.file=<path-to-oci-sd-directory>/example/prometheus/prometheus.yml
- Based on the configured refresh interval, check the
example/prometheus/oci-sd.json
file if it was populated with (OCI instances) targets. - Check Service Discovery console: http://localhost:9090/service-discovery
- Check Targets console: http://localhost:9090/targets