{"id":27404754,"url":"https://github.com/nuvo/emq_exporter","last_synced_at":"2025-04-14T05:47:10.318Z","repository":{"id":47040418,"uuid":"157383466","full_name":"nuvo/emq_exporter","owner":"nuvo","description":"Simple server that scrapes EMQ metrics and exporters them via HTTP for Prometheus consumption","archived":false,"fork":false,"pushed_at":"2021-09-16T05:28:25.000Z","size":107,"stargazers_count":36,"open_issues_count":5,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-30T12:45:53.263Z","etag":null,"topics":["docker","emq","exporter","go","golang","kubernetes","metrics","prometheus"],"latest_commit_sha":null,"homepage":null,"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/nuvo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-13T13:18:50.000Z","updated_at":"2024-09-16T14:08:38.000Z","dependencies_parsed_at":"2022-08-27T16:31:04.151Z","dependency_job_id":null,"html_url":"https://github.com/nuvo/emq_exporter","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuvo%2Femq_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuvo%2Femq_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuvo%2Femq_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuvo%2Femq_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuvo","download_url":"https://codeload.github.com/nuvo/emq_exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248830418,"owners_count":21168272,"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":["docker","emq","exporter","go","golang","kubernetes","metrics","prometheus"],"created_at":"2025-04-14T05:47:07.981Z","updated_at":"2025-04-14T05:47:10.293Z","avatar_url":"https://github.com/nuvo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![Release](https://img.shields.io/github/release/nuvo/emq_exporter.svg)](https://github.com/nuvo/emq_exporter/releases)\n[![Travis branch](https://img.shields.io/travis/nuvo/emq_exporter/master.svg)](https://travis-ci.org/nuvo/emq_exporter)\n[![Docker Pulls](https://img.shields.io/docker/pulls/nuvo/emq_exporter.svg)](https://hub.docker.com/r/nuvo/emq_exporter/)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nuvo/emq_exporter)](https://goreportcard.com/report/github.com/nuvo/emq_exporter)\n[![license](https://img.shields.io/github/license/nuvo/emq_exporter.svg)](https://github.com/nuvo/emq_exporter/blob/master/LICENSE)\n\n# EMQ exporter for Prometheus\n\nA simple server that scrapes EMQ metrics and exports them via HTTP for Prometheus consumption.\n\n## Getting Started\n\nTo run it:\n\n```bash\n./emq_exporter [flags]\n```\n\nHelp on flags:\n\n```bash\n./emq_exporter --help\n```\n\n## Usage\n\n### EMQ URI\n\nSpecify EMQ's node uri and api port using the `--emq.uri` flag. For example,\n\n```bash\n./emq_exporter --emq.uri \"http://localhost:8080\"\n```\n\nOr to scrape a remote host:\n\n```bash\n./emq_exporter --emq.uri \"https://emq.example.com:8080\"\n```\n\n### Passing Credentials\n\nEMQ requires that calls made to the API endpoints be authenticated. The exporter supports two ways to pass credentials:\n\n1. Setting environment variables:\n* `EMQ_USERNAME` for username\n* `EMQ_PASSWORD` for the password\n\nNo need to pass anything to `emq_exporter` when using these vars, they will be searched for automatically on startup.\n\n2. Using a file\n\nThe file should be json formatted and contain the following fields:\n\n```json\n{\n  \"username\": \"admin\",\n  \"password\": \"public\"\n}\n```\n\nWhen staring `emq_exporter`, point it to the credentials file using `--emq.creds-file` flag:\n\n```bash\n./emq_exporter --emq.uri http://localhost:8080 --emq.creds-file /etc/emq_exporter/auth.json\n```\n\nThe default path for credentials file is `$(CWD)/auth.json`. Note that `env vars` take precedence over using a file.\n\n### API Version\n\nEMQ add a `v3` api version in `EMQX`. To specify the api version, use the `emq.api-version` flag:\n\n```bash\n./emq_exporter --emq.uri http://localhost:8080 --emq.api-version v3\n```\n\nThe `emq_exporter` supports `v2`, `v3` and `v4` API versions seamlessly (mutually exclusive, pick either on start up), default is `v3`. However, from `v4` the default port is 8081.\n**Please note the `v2` api is deprecated and will be removed in future versions**\n\n### Authentication\n\nThe authentication method changed a bit in version `v3` of `emqx`. If you're pulling the metrics through the dashboard port (default `18083`), you can use regular username and password. However, if you're using the API port (default `8080`), you'll need to set up application credentials:\n1. From the emq dashboard side bar -\u003e applications\n2. Select `New App` from the top\n3. Fill in the popup window with the relevant details and confirm\n4. View the app details and use `AppID` as `username` and `AppSecret` as `password` (as `creds-file` entries or `env vars`, see above)\n\nThe default port `emq_exporter` uses is `18083`\n\nSee the docs for `v2` REST API [here](http://emqtt.io/docs/v2/rest.html) and for `v3` [here](http://emqtt.io/docs/v3/rest.html)\n\n### Troubleshooting\n\nIf things aren't working as expected, try to start the exporter with `--log.level debug` flag. This will log additional details to the console and might help track down the problem. Fell free to raise an issue should you require additional help.\n\n### Docker\n\nTo run EMQ exporter as a Docker container, run:\n\n```bash\ndocker run \\\n  -d \\\n  -p 9540:9540 \\\n  --name emq_exporter \\\n  -v /path/to/auth.json:/etc/emq/auth.json \\\n  nuvo/emq_exporter:v0.4.1 \\\n  --emq.uri \"http://\u003cemq-ip\u003e:8080\" \\\n  --emq.node \"emqx@\u003cemq-ip\u003e\" \\\n  --emq.api-version \"v3\" \\\n  --emq.creds-file \"/etc/emq/auth.json\"\n```\n\nAlternatively, One can also supply the credentials using `env vars`, replace the volume mount (`-v` flag) with `-e EMQ_USERNAME=\u003cmy-username\u003e -e EMQ_PASSWORD=\u003csuper-secret\u003e`\n\n### Kubernetes\n\nEMQ exporter was designed to run as a sidecar in the same pod as EMQ itself.\nSee the examples folder for a `kubernetes` manifest that can serve as reference for implementation.\n\n## Contributing\n\nWe welcome contributions!\n\nPlease see [CONTRIBUTING](https://github.com/nuvo/emq_exporter/blob/master/CONTRIBUTING.md) for guidelines on how to get involved.\n\n## License\nApache License 2.0, see [LICENSE](https://github.com/nuvo/emq_exporter/blob/master/LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuvo%2Femq_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuvo%2Femq_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuvo%2Femq_exporter/lists"}