{"id":18091098,"url":"https://github.com/ryarnyah/collectd-prometheus","last_synced_at":"2025-10-11T02:13:23.755Z","repository":{"id":49565529,"uuid":"212691591","full_name":"ryarnyah/collectd-prometheus","owner":"ryarnyah","description":"A collectd Python plugin to read Prometheus metrics endpoints","archived":false,"fork":false,"pushed_at":"2022-08-29T19:46:51.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-24T17:00:02.880Z","etag":null,"topics":["collectd","collectd-plugin","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/ryarnyah.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}},"created_at":"2019-10-03T22:21:04.000Z","updated_at":"2024-10-24T22:45:10.000Z","dependencies_parsed_at":"2022-09-13T02:12:29.749Z","dependency_job_id":null,"html_url":"https://github.com/ryarnyah/collectd-prometheus","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ryarnyah/collectd-prometheus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryarnyah%2Fcollectd-prometheus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryarnyah%2Fcollectd-prometheus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryarnyah%2Fcollectd-prometheus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryarnyah%2Fcollectd-prometheus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryarnyah","download_url":"https://codeload.github.com/ryarnyah/collectd-prometheus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryarnyah%2Fcollectd-prometheus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005920,"owners_count":26083996,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["collectd","collectd-plugin","python"],"created_at":"2024-10-31T18:09:21.413Z","updated_at":"2025-10-11T02:13:23.728Z","avatar_url":"https://github.com/ryarnyah.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# collectd-prometheus\n\nA collectd Python plugin to read Prometheus metrics endpoints\n\n## Installation\n\n1. Find out which version of Python your collectd is built against to know\n   which python/pip binary to use. So e.g. with Debian:\n   ```terminal\n   $ dpkg -S python.so | grep collectd\n   collectd-core: /usr/lib/collectd/python.so\n   $ ldd /usr/lib/collectd/python.so | grep python\n   libpython2.7.so.1.0 =\u003e /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f953a5c2000)\n   $\n   ```\n   which uses Python 2.7 still so I need to use `pip2` when installing the\n   dependencies.\n1. Install `collectd-prometheus`:\n   ```terminal\n   # pip2 install collectd-prometheus\n   ```\n\n## Usage\n1. Create a collectd configuration e.g.\n   `/etc/collectd/collectd.conf.d/prom-service.conf`\n```apache\nLoadPlugin python\n\u003cPlugin python\u003e\n    Import \"collectd_prometheus\"\n    \u003cModule \"collectd_prometheus\"\u003e\n       Interval 30 # How often to scrape metrics. This is the default, can be omitted\n       \u003cProcess\u003e\n           Process \"mycoolservice\" # Name this instance, e.g. after what service you're scraping\n           Protocol \"http\" # This is default, can be omitted\n           Host \"127.0.0.1\" # This is default, can be omitted\n           Port \"8080\" # This is default, can be omitted\n           Filter \"only|these\" # A regex which matches the names of the metrics you only want to include\n           Filter \"metrics\" # You can even specify multiple regexes\n       \u003c/Process\u003e\n       # Scrape another another service as well, e.g.\n       \u003cProcess\u003e\n           Process \"anothercoolservice\"\n           # This time we use the defaults, except Port\n           Port \"8081\"\n       \u003c/Process\u003e\n    \u003c/Module\u003e\n\u003c/Plugin\u003e\n```\n\n## Using a virtualenv\nIn Python, using a virtual environment [is the\nrecommended](https://docs.python.org/3/tutorial/venv.html) way to isolate your\napplications dependencies from other applications. To use a virtualenv with\ncollectd we have to create one, activate it, install our package into it.\n\n1. Using the steps listed [Installation](#installation) figure out which Python\n   version collectd uses.\n1. If python3 use `venv` which is included in Python 3. When using Python 2.7,\n   we have to [install\n   virtualenv](https://virtualenv.pypa.io/en/latest/installation.html) which\n   can be packaged in your OS/distribution (`python-virtualenv` in Debian) or\n   you install it manually, see the linked documentation.\n1. Create your virtualenv where you want to store it, e.g:\n   ```terminal\n   # python -m virtualenv /usr/lib/collectd/prom\n   ```\n1. Activate it and install our package, e.g.:\n   ```terminal\n   # source /usr/lib/collectd/prom/bin/activate\n   (prom) # pip install collectd-prometheus\n   ```\n1. Find your virtualenvs site-packages folder, e.g:\n   ```terminal\n   # find /usr/lib/collectd/prom/ -type d -iname \"site-packages\"\n   /usr/lib/collectd/prom/lib/python2.7/site-packages\n   ```\n1. Configure collectd to look for `collectd-prometheus` and it's dependencies\n   in the directory that you found in step 5. E.g:\n\n   ```apache\n   LoadPlugin python\n   \u003cPlugin python\u003e\n       ModulePath \"/usr/lib/collectd/prom/lib/python2.7/site-packages\" # Right here\n       Import \"collectd_prometheus\"\n   […]\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryarnyah%2Fcollectd-prometheus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryarnyah%2Fcollectd-prometheus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryarnyah%2Fcollectd-prometheus/lists"}