{"id":22374861,"url":"https://github.com/qubitproducts/exporter_exporter","last_synced_at":"2025-04-05T08:07:05.539Z","repository":{"id":37716816,"uuid":"69675577","full_name":"QubitProducts/exporter_exporter","owner":"QubitProducts","description":"A reverse proxy designed for Prometheus exporters","archived":false,"fork":false,"pushed_at":"2024-01-25T20:55:57.000Z","size":218,"stargazers_count":357,"open_issues_count":9,"forks_count":55,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-29T07:07:01.431Z","etag":null,"topics":["cadvisor","ceh","infra","nginx","prometheus","prometheus-exporter","proxy"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QubitProducts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-30T14:51:45.000Z","updated_at":"2025-03-26T00:39:41.000Z","dependencies_parsed_at":"2023-02-16T21:45:35.582Z","dependency_job_id":"60d9cf96-05ab-4365-8ff5-79a4ea4b5950","html_url":"https://github.com/QubitProducts/exporter_exporter","commit_stats":{"total_commits":134,"total_committers":23,"mean_commits":5.826086956521739,"dds":0.7014925373134329,"last_synced_commit":"48fc00a3f4f5b00f2c6e5b7cc44d4f6f935934ab"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QubitProducts%2Fexporter_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QubitProducts%2Fexporter_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QubitProducts%2Fexporter_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QubitProducts%2Fexporter_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QubitProducts","download_url":"https://codeload.github.com/QubitProducts/exporter_exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305934,"owners_count":20917208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cadvisor","ceh","infra","nginx","prometheus","prometheus-exporter","proxy"],"created_at":"2024-12-04T21:18:46.898Z","updated_at":"2025-04-05T08:07:05.522Z","avatar_url":"https://github.com/QubitProducts.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Exporter Exporter - prometheus exporter proxy\n\n```   \"you mean apache/nginx\" - bbrazil ```\n\nThis provides a simple reverse proxy for prometheus exporters. It is intended as a\nsingle binary alternative to nginx/apache for use in environments where opening multiple\nTCP ports to all servers might be difficult (technically or politically)\n\nThe advantages are:\n\n- A single port can be used to query multiple exporters (to ease firewall configuration concerns).\n- Can provide TLS with optional client certificate authentication.\n- Provides verification that the target is serving prometheus metrics.\n- Can be used to execute scripts that produce prometheus metrics.\n- _up_ behaviour is the same as for querying individual collectors.\n- Small code size, minimal external depedencies, easily auditable.\n\nThe exporter has three endpoints.\n\n- /: displays a list of all exporters with links to their metrics.\n  - Returns JSON if the header \"Accept: application/json\" is passed\n\n- /proxy: which takes the following parameters:\n  - *module*: the name of the module from the configuration to execute. (a default\n    module can be selected using the defaultModule config option)\n  - *args*: (only for exec modules): additional arguments to the backend command.\n  - all other query string parameters are passed on to any http backend module.\n    (excluding the first *module* parameter value).\n\n- /metrics: this exposes the metrics for the collector itself.\n\nFeatures that will NOT be included:\n\n- merging of module outputs into one query (this would break _up_ behaviour)\n\n## Installation\n\nYou can build directly using a plain ```go get github.com/QubitProducts/exporter_exporter```.\nThe provided Makefile is primarily used for releases.\n\nPre-built binaries and a debian package are available on the [GitHub release page](https://github.com/QubitProducts/exporter_exporter/releases).\n\nAn ansible recipe as also [available](https://github.com/umanit/ansible-prometheus_exporter_exporter) (kindly provided by one of our users).\n\nTODO:\n\n- Config reload on HUP (or POST, or config file change?)\n- route to a docker/rocket container by name\n\n### Windows Service\n\nThe binary can be installed as a Windows service by supplying the `-winsvc install` arg.\nAll other arguments passed along with `-winsvc install` will be added to the service startup \nand can only be changed by uninstalling/installing it again (or modifying the Windows registry directly).\n\n## Configuration\n\nIn expexp.yaml list each exporter listening on localhost with its known port.\n\n```\ndefaultModule: node # called if \"module\" param is not supplied\nmodules:\n  node:\n    method: http\n    http:\n       port: 9100\n\n  mtail:\n    method: http\n    http:\n       port: 3903\n       headers:\n          foo: bar\n\n  cadvisor:\n    method: http\n    http:\n       verify: false\n       port: 4194\n\n  netdata:\n    method: http\n    http:\n       port: 19999\n       path: '/api/v1/allmetrics?format=prometheus'\n\n  blackbox:\n    method: http\n    http:\n       port: 9115\n       path: '/probe'\n\n  somescript:\n    method: exec\n    timeout: 1s\n    exec:\n      command: /tmp/myscript.sh\n      args:\n        - \"myarg1\"\n        - \"myarg2\"\n      env:\n        THING: \"1\"\n        THING2: \"2\"\n\n  somefile:\n    method: file\n    file:\n      path: /tmp/myfile.prometheus.txt\n```\n\nIn your prometheus configuration\n\n```\nscrape_configs:\n  - job_name: 'expexp_metrics'\n    scrape_interval: 1s\n    static_configs:\n      - targets: ['host:9999']\n  - job_name: 'cadvisor'\n    scrape_interval: 5s\n    metrics_path: /proxy\n    params:\n      module:\n        - cadvisor\n    static_configs:\n      - targets: ['host:9999']\n  - job_name: 'mtail'\n    scrape_interval: 5s\n    metrics_path: /proxy\n    params:\n      module:\n        - mtail\n    static_configs:\n      - targets: ['host:9999']\n  - job_name: 'somescript'\n    scrape_interval: 5s\n    metrics_path: /proxy\n    params:\n      module:\n        - somescript\n    static_configs:\n      - targets: ['host:9999']\n  - job_name: 'blackbox'\n    metrics_path: /proxy\n    params:\n      module:\n        - blackbox\n        - icmp_example\n    static_configs:\n      - targets:\n        - 8.8.8.8\n        - 8.8.4.4\n    relabel_configs:\n      - source_labels: [__address__]\n        target_label: __param_target\n      - source_labels: [__param_target]\n        target_label: instance\n      - target_label: __address__\n        replacement: host:9999\n```\n\n### Blackbox Exporter\n\nThe blackbox exporter also uses the \"module\" query string parameter. To query it via\nexporter_exporter we rely on the stripping of the initial \"module\" parameter. For example\n \n```\ncurl http://localhost:9999/proxy\\?module\\=blackbox\\\u0026module\\=icmp_example\\\u0026target\\=8.8.8.8\n```\n\nWill query the icmp_example module in your blackbox configuration.\n\n\n## Directory-based configuration\n\nYou can also specify `-config.dirs` to break the configuration into separate\nfiles.  The module name is taken from the name of the file (minus the\nyml/yaml extension), and the configuration for that module goes in at the\ntop level.\n\nNote that if you want to use *only* this configuration method and not the file-based \nconfiguration (`-config.file` option), you must provide an empty string for the file\noption : `./exporter_exporter -config.file \"\" -config.dirs \"/etc/exporter_exporter/\"`\n\n```\n==\u003e expexp.yaml \u003c==\nmodules: {}\n\n==\u003e expexp.d/node.yaml \u003c==\nmethod: http\nhttp:\n   port: 9100\n\n==\u003e expexp.d/mtail.yaml \u003c==\nmethod: http\nhttp:\n   port: 3903\n```\n\n## TLS configuration\n\nYou can use exporter_exporter with TLS to encrypt the traffic, and at the\nsame time enforce strong mutual authentication between the nodes and the\nprometheus server.\n\nNote that `-web.tls.verify` will accept *any* certificate signed by the\n`-web.tls.ca`, so you need to create a separate CA for this purpose - or use\na self-signed certificate, which acts as its own CA.\n\nHere is a simple configuration example, using one key/cert for the\nprometheus server and one key/cert shared between all the remote nodes.\nFirstly, create the keys and certs:\n\n```\nopenssl req -x509 -newkey rsa:2048 -keyout prom_node_key.pem -out prom_node_cert.pem -days 29220 -nodes -subj /commonName=prom_node/ -addext \"subjectAltName=DNS:prom_node\"\nopenssl req -x509 -newkey rsa:2048 -keyout prometheus_key.pem -out prometheus_cert.pem -days 29220 -nodes -subj /commonName=prometheus/ -addext \"subjectAltName=DNS:prometheus\"\n```\n\nCreate an `/etc/prometheus/ssl/` directory on the prometheus server and all\nthe remote nodes.  Install both cert.pem files everywhere.  It is safe for\nthem to be world-readable.\n\nInstall `prom_node_key.pem` only on the nodes, and set file permissions to\nprotect it so that only exporter_exporter can read it.  Similarly, install\n`prometheus_key.pem` only on the prometheus server, and set permissions so\nthat only the prometheus process can read it.\n\nConfiguration for exporter_exporter on the nodes (here it also disables\nplain HTTP):\n\n```\nEXPEXP_FLAGS='-web.listen-address= -web.tls.listen-address=:9998\n -web.tls.cert=/etc/prometheus/ssl/prom_node_cert.pem\n -web.tls.key=/etc/prometheus/ssl/prom_node_key.pem\n -web.tls.ca=/etc/prometheus/ssl/prometheus_cert.pem\n -web.tls.verify'\n```\n\nTo test, use `curl` to make a scrape, replacing x.x.x.x with the IP address\nof the target:\n\n```\ncurl --cert /etc/prometheus/ssl/prometheus_cert.pem \\\n     --key /etc/prometheus/ssl/prometheus_key.pem \\\n     --cacert /etc/prometheus/ssl/prom_node_cert.pem \\\n     --resolve prom_node:9998:x.x.x.x \\\n     -v https://prom_node:9998/proxy?module=node\n```\n\nWhen this is working, configure your prometheus server to use https. Example:\n\n```\n  - job_name: node\n    scrape_interval: 1m\n    scrape_timeout: 50s\n    file_sd_configs:\n      - files:\n        - /etc/prometheus/targets.d/node_targets.yml\n    scheme: https\n    tls_config:\n      # Verifying remote identity\n      ca_file: /etc/prometheus/ssl/prom_node_cert.pem\n      server_name: prom_node\n      # Asserting our identity\n      cert_file: /etc/prometheus/ssl/prometheus_cert.pem\n      key_file: /etc/prometheus/ssl/prometheus_key.pem\n    metrics_path: /proxy\n    params:\n      module: [ node ]\n    relabel_configs:\n      - source_labels: [__address__]\n        target_label: instance\n      - source_labels: [__address__]\n        regex: '([^:]+)'\n        target_label: __address__\n        replacement: '${1}:9998'\n```\n\nExample `/etc/prometheus/targets.d/node_targets.yml`:\n\n```\n- labels: []\n  targets:\n  - 192.0.2.1\n  - 192.0.2.2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqubitproducts%2Fexporter_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqubitproducts%2Fexporter_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqubitproducts%2Fexporter_exporter/lists"}