{"id":13480889,"url":"https://github.com/dalenys-deprecated/check_mongodb","last_synced_at":"2025-03-27T11:31:05.027Z","repository":{"id":198586972,"uuid":"59034117","full_name":"dalenys-deprecated/check_mongodb","owner":"dalenys-deprecated","description":":hash: Nagios plugin for MongoDB, in Bash.","archived":true,"fork":false,"pushed_at":"2019-04-01T13:49:12.000Z","size":12,"stargazers_count":15,"open_issues_count":1,"forks_count":2,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-05-23T06:50:57.514Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dalenys-deprecated.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}},"created_at":"2016-05-17T15:20:11.000Z","updated_at":"2023-09-28T11:46:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"5d4d4902-407a-4ce7-b18c-83023c84e84d","html_url":"https://github.com/dalenys-deprecated/check_mongodb","commit_stats":null,"previous_names":["dalenys-deprecated/check_mongodb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalenys-deprecated%2Fcheck_mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalenys-deprecated%2Fcheck_mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalenys-deprecated%2Fcheck_mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalenys-deprecated%2Fcheck_mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dalenys-deprecated","download_url":"https://codeload.github.com/dalenys-deprecated/check_mongodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245836040,"owners_count":20680309,"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":[],"created_at":"2024-07-31T17:00:46.292Z","updated_at":"2025-03-27T11:31:04.766Z","avatar_url":"https://github.com/dalenys-deprecated.png","language":"Shell","funding_links":[],"categories":["Tools"],"sub_categories":["Monitoring"],"readme":"# check_mongodb ![License][license-img] [![Build Status][build-img]][build-url]\n\n#### Table of Contents\n\n1. [Overview](#overview)\n2. [Requirements](#requirements)\n3. [Usage](#usage)\n4. [Nagios configuration](#Nagios configuration)\n5. [Development](#development)\n\n## Overview\n\nThis script is a  nagios plugin, to check the state of  MongoDB. It's written in\nBash, to avoid any dependencies with PyMongo, venv and even Python.\n\nWhy  ?  Because in  a  perfect  world, your  production  database  should be  as\nlightweight as possible, right ? ;)\n\nThe design of the script is quite easy, in order to allow you to contribute with\nyour own needs. Basically, one check is one function, keep it simple.\n\nNagios : https://www.nagios.org/\nMongoDB : https://www.mongodb.com/\n\n## Requirements\n\n- bash\n- awk\n- mongodb-org-shell\n\n### Debian and Ubuntu\n\nYou need MongoDB repository : https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/\n\n```bash\n$ sudo apt-get install mongodb-org-shell\n```\n\n### RedHat and Fedora\n\nYou need MongoDB repository : https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/\n\n```bash\n$ sudo yum install -y mongodb-org-shell\n```\n\n## Usage\n\n```bash\nUsage: check_mongo.bash -t [standalone|replicaset] -h [hostname] -c [check_name]\nOptional :\n-u [username]\n-p [password]\n-w [port]\n-v verbose\n\nAny rs.xxx command has to be associated with -t replicaset\n\ncheck_name :\nmem.resident  Check resident memory usage (amount of physical memory being used, only for MMAPv1 storage engine)\nrs.status     Status of the local node\nrs.count      Count how many member are in the replicaset\nrs.lag        Check replication lag\n```\n\n```bash\n$ /usr/lib/nagios/plugins/check_mongodb.bash -t replicaset -h database1-1.domain -u username -p password -c rs.status\n$ OK - State is PRIMARY\n```\n\n```bash\n$ /usr/lib/nagios/plugins/check_mongodb.bash -t replicaset -h database1-1.domain -u username -p password -c rs.lag\n$ OK : Lag replication is 0 hr(s)\n```\n\n```bash\n$ /usr/lib/nagios/plugins/check_mongo.bash -t standalone -h database1-2 -c mem.resident\nNOK : Resident memory used : 96%, readahead probably too high\n```\n\n## Nagios configuration\n\nNagios side : /etc/nagios/databases/database1/mongodb.cfg\n\n```\ndefine service {\n  host_name database1\n  service_description Check status of MongoDB in replicaset\n  check_command check_nrpe!check_mongodb_status\n  use service-1m-24x7-mail\n}\n```\n\nClient side : /etc/nagios/nrpe.d/mongodb.cfg\n\n```\ncommand[check_mongodb_status] = /usr/lib/nagios/plugins/check_mongodb.bash -t replicaset -h localhost -u username -p password -c rs.status\n```\n\n## Development\n\nFeel free to contribute on GitHub.\n\n```\n    ╚⊙ ⊙╝\n  ╚═(███)═╝\n ╚═(███)═╝\n╚═(███)═╝\n ╚═(███)═╝\n  ╚═(███)═╝\n   ╚═(███)═╝\n```\n\n[license-img]: https://img.shields.io/badge/license-ISC-blue.svg\n[build-img]: https://travis-ci.org/dalenys/check_mongodb.svg?branch=master\n[build-url]: https://travis-ci.org/dalenys/check_mongodb\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalenys-deprecated%2Fcheck_mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdalenys-deprecated%2Fcheck_mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalenys-deprecated%2Fcheck_mongodb/lists"}