{"id":19653552,"url":"https://github.com/sematext/spm-agent-mongodb","last_synced_at":"2025-04-28T17:31:40.765Z","repository":{"id":27902129,"uuid":"31393815","full_name":"sematext/spm-agent-mongodb","owner":"sematext","description":"Sematext Agent for monitoring MongoDB","archived":false,"fork":false,"pushed_at":"2023-02-11T00:32:05.000Z","size":769,"stargazers_count":8,"open_issues_count":3,"forks_count":0,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-10-07T12:37:05.121Z","etag":null,"topics":["agent","devops","devops-tools","metrics","mongodb","mongodb-agent","monitoring","performance-metrics","performance-monitoring"],"latest_commit_sha":null,"homepage":"https://sematext.com/cloud","language":"JavaScript","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/sematext.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-02-26T23:13:14.000Z","updated_at":"2023-07-28T08:43:49.000Z","dependencies_parsed_at":"2023-02-18T04:15:38.740Z","dependency_job_id":null,"html_url":"https://github.com/sematext/spm-agent-mongodb","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sematext%2Fspm-agent-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sematext%2Fspm-agent-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sematext%2Fspm-agent-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sematext%2Fspm-agent-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sematext","download_url":"https://codeload.github.com/sematext/spm-agent-mongodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224124775,"owners_count":17259746,"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":["agent","devops","devops-tools","metrics","mongodb","mongodb-agent","monitoring","performance-metrics","performance-monitoring"],"created_at":"2024-11-11T15:14:29.530Z","updated_at":"2024-11-11T15:14:30.527Z","avatar_url":"https://github.com/sematext.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/sematext/spm-agent-mongodb.svg?branch=master)](https://travis-ci.org/sematext/spm-agent-mongodb)\n\nThis [Sematext Cloud](https://sematext.com/) agent for MongoDB monitoring has been deprecated. A new agent with much simpler setup is [available now](https://sematext.com/product-updates/#/2021/new-agents-for-nginx-apache-and-mongodb).  MongoDB monitoring can now be set up automatically via [service auto-discovery](https://sematext.com/blog/service-autodiscovery-automatic-monitoring/) and without the need to install any additional agents.  See [auto-discovery documentation](https://sematext.com/docs/monitoring/autodiscovery/).\n\n----\n\n# Preparation \n\n1. Get a free [Sematext account](https://apps.sematext.com/ui/registration)  \n\n2. [Create a Monitoring App](https://apps.sematext.com/spm-reports/registerApplication.do) of type \"MongoDB\" and copy the App Token - or execute the commands displayed in the Sematext UI (which are described here as well)\n\n3. [Install Node.js](https://nodejs.org/en/download/package-manager/) on your MongoDB server\n\n4. The MongoDB driver might need libkrb5-dev for Kerberos authentication (if you use Kerberos ...)\n```\napt-get install libkrb5-dev\n```\n# Setup \n```sh\n# Install spm-agent-mongodb \nnpm i spm-agent-mongodb -g\n\n# In case you use Sematext Cloud EU (https://apps.eu.sematext.com): \n#   configure the API endpoints for EU. \n#   The  following commands create the file /etc/sematext/receivers.config: \n# sudo spm-mongodb-setup -r EU \n#   Note: To switch back to Sematext US region use\n# sudo spm-mongodb-setup -r US # default for apps.sematext.com\n\n# Install systemd or upstart service file for spm-agent-mongodb\n# Create an SPM App of type MongoDB in Sematext UI \n# and use your SPM Token:\nsudo spm-mongodb-setup -t SPM_TOKEN -m mongodb://localhost:27017/local\n\n# or to specify the username and password for the agent to use to connect to MongoDB\nsudo spm-mongodb-setup -t SPM_TOKEN -m mongodb://UsernameHere:PasswordHere@localhost:27017/DbNameHere\n```\nNote that the monitoring agent requires admin rights to query the relevant tables. It should have ClusterAdmin role and read access to any DB.\n\n# Configuration \n\nThe setup script will store your configuration in /etc/sematext/spm-agent-mongodb.config \n\nIf you want to change the settings later edit /etc/sematext/spm-agent-mongodb.config. \nThen restart the Sematext MongoDB Agent after config changes, depending on the init system:\n- Upstart (Ubuntu):  \n```\n    sudo service spm-agent-mongodb restart \n```\n- Systemd (Linux others):  \n```\n    sudo systemctl stop spm-agent-mongodb\n    sudo systemctl start spm-agent-mongodb\n```\n- Launchd (Mac OS X): \n```\n    sudo launchctl stop com.sematext.spm-agent-mongodb\n    sudo launchctl stop com.sematext.spm-agent-mongodb\n```\n\nFor tests you can just run the agent from command line:\n```\nspm-agent-mongodb SPM_TOKEN MONGODB_URL\n```\n\n## Setup on Docker\n\nThe MongoDB agent is integrated in [SPM-Client docker image](https://hub.docker.com/r/sematext/spm-client/).\nThe relevant SPM_CONFIG string ist: \n```mongodb SPM_TOKEN MONGODB_URL```. \n\nRun SPM-Client, replace the App Token and MongoDB URL with your configuration: \n```\ndocker run --name spm-client --restart=always -v /var/run/docker.sock:/var/run/docker.sock -e SPM_CONFIG=\"mongodb YOUR_SPM_MONGODB_TOKEN mongodb://mongodbUser:mogodbPassword@mongodb-server:port/database\" sematext/spm-client\n```\n\nDocker-Compose example with SPM-Client and MongoDB server: [docker-compose.yml](https://github.com/sematext/docker-spm-client/blob/master/examples/mongodb/docker-compose.yml). \n\n# Results\n\n![Metrics Overview](https://sematext.files.wordpress.com/2015/12/mongodb_overview.png)\n\nMore Information: \n- [MongoDB monitoring integration](https://sematext.com/docs/integration/mongodb) \n- [Announcement blog post](https://blog.sematext.com/mongodb-monitoring/) \n- [MongoDB reports video](https://www.youtube.com/watch?v=BIERrXzbiNM) \n\n# Support \n\n- Twitter: [@sematext](https://www.twitter.com/sematext)\n- Blog: [blog.sematext.com](https://blog.sematext.com)\n- Homepage: [www.sematext.com](https://www.sematext.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsematext%2Fspm-agent-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsematext%2Fspm-agent-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsematext%2Fspm-agent-mongodb/lists"}