### Install Stackdriver Exporter from Source Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/README.md Install the exporter using `go install` after ensuring Go is set up. Then run the exporter with flags. ```console go install github.com/prometheus-community/stackdriver_exporter stackdriver_exporter ``` -------------------------------- ### Install Stackdriver Exporter Helm Chart Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/README.md Add the Helm repository and install the exporter using Helm for Kubernetes deployments. ```bash helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm install [RELEASE_NAME] prometheus-community/prometheus-stackdriver-exporter ``` -------------------------------- ### Add or Update Go Module Dependencies Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/CONTRIBUTING.md Use 'go get' to add or update external packages. Dependencies are vendored in the 'vendor/' directory. ```bash # Pick the latest tagged release. go get example.com/some/module/pkg # Pick a specific version. go get example.com/some/module/pkg@vX.Y.Z ``` -------------------------------- ### Run Stackdriver Exporter Binary Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/README.md Execute the downloaded binary with any necessary flags. ```console ./stackdriver_exporter ``` -------------------------------- ### Build and Run Stackdriver Exporter Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/CONTRIBUTING.md Commands to build the exporter and run it. Ensure all tests pass before committing. ```bash # For building. make build ./stackdriver_exporter # For testing. make test # Make sure all the tests pass before you commit and push :) ``` -------------------------------- ### Tidy and Vendor Go Dependencies Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/CONTRIBUTING.md Update go.mod and go.sum files and copy dependencies to the vendor directory. Ensure GO111MODULE is set if not in GOPATH. ```bash # The GO111MODULE variable can be omitted when the code isn't located in GOPATH. GO111MODULE=on go mod tidy GO111MODULE=on go mod vendor ``` -------------------------------- ### Run Stackdriver Exporter with Docker Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/README.md Deploy the exporter as a Docker container, exposing the default port. ```console docker run -p 9255:9255 prometheuscommunity/stackdriver-exporter ``` -------------------------------- ### Run Stackdriver Exporter with Specific Metrics Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/README.md Use this command to run the Stackdriver Exporter and collect specific CPU and Disk metrics for all Google Compute Engine instances within a given project. ```bash stackdriver_exporter \ --google.project-ids=my-test-project \ --monitoring.metrics-prefixes "compute.googleapis.com/instance/cpu" --monitoring.metrics-prefixes "compute.googleapis.com/instance/disk" ``` -------------------------------- ### Configure Stackdriver Exporter with Filters Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/README.md Use command-line flags to specify project IDs, metric prefixes, and custom filters for Stackdriver metrics. Ensure string filter values with special characters are quoted. Check logs for GCP syntax errors. ```bash stackdriver_exporter \ --google.project-ids=my-test-project \ --monitoring.metrics-prefixes='pubsub.googleapis.com/subscription' \ --monitoring.metrics-prefixes='compute.googleapis.com/instance/cpu' \ --monitoring.metrics-prefixes='cloudsql.googleapis.com/database' \ --monitoring.filters='pubsub.googleapis.com/subscription:resource.labels.subscription_id=monitoring.regex.full_match("us-west4.*my-team-subs.*")' \ --monitoring.filters='compute.googleapis.com/instance/cpu:resource.labels.instance=monitoring.regex.full_match("us-west4.*my-team-subs.*")' \ --monitoring.filters='cloudsql.googleapis.com/database:resource.labels.database_id="my-test-project:my-database-name"' ``` -------------------------------- ### Deploy Stackdriver Exporter to Cloud Foundry Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/README.md Clone the repository, modify the manifest file for desired properties, and push the exporter to your Cloud Foundry environment. ```console git clone https://github.com/prometheus-community/stackdriver_exporter.git cd stackdriver_exporter cf push ``` -------------------------------- ### Configure Stackdriver Exporter with Projects Filter Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/README.md Apply a filter to select projects based on their labels. This is useful for targeting specific projects for monitoring. ```bash stackdriver_exporter \ --google.projects.filter='labels.monitoring="true"' ``` -------------------------------- ### Filter Collectors in Prometheus Configuration Source: https://github.com/prometheus-community/stackdriver_exporter/blob/master/README.md Specify which metric type prefixes to collect using the 'collect' parameter within the Prometheus scrape configuration. This allows for advanced filtering of collected metrics. ```yaml params: collect: - compute.googleapis.com/instance/cpu - compute.googleapis.com/instance/disk ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.