check_replica_set false positives
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MongoDB Charm |
Fix Released
|
Medium
|
Benjamin Allot |
Bug Description
Since https:/
+ name = get_replica_
[...]
+ mongo_res = get_cmd_result(
+ ["/usr/bin/mongo", name, "--quiet", "--eval", "JSON.stringify
+ )
This only works if we chose a replicaset value that corresponds to a host on which this mongodb is running.
I think that this check should be replaced with something like:
host, port, replicaset = get_mongo_details()
mongo_res = get_cmd_result(
["/
Also, the check name should be updated with:
- shortname=
+ shortname=
Because the check name is automatically prepended with 'check_', currently leading to:
$ grep check_replica_sets /etc/nagios/
# check check_replica_sets
command[
And finalyy of course, the tests should be updated to catch this issue.
Related branches
- Linda Guo (community): Approve
- Xav Paice (community): Approve
- 🤖 prod-jenkaas-bootstack (community): Approve (continuous-integration)
- BootStack Reviewers: Pending requested
-
Diff: 464 lines (+230/-56)3 files modifiedfiles/nrpe-external-master/check_replica_sets.py (+65/-16)
tests/unit/test_check_replica_sets.py (+164/-39)
tox.ini (+1/-1)
- BootStack Reviewers: Pending requested
- BootStack Reviewers: Pending requested
-
Diff: 252 lines (+108/-28)2 files modifiedfiles/nrpe-external-master/check_replica_sets.py (+44/-17)
tests/unit/test_check_replica_sets.py (+64/-11)
Changed in charm-mongodb: | |
importance: | Undecided → Medium |
Changed in charm-mongodb: | |
status: | New → Triaged |
Changed in charm-mongodb: | |
assignee: | nobody → Benjamin Allot (ballot) |
Changed in charm-mongodb: | |
status: | Triaged → Fix Committed |
Changed in charm-mongodb: | |
status: | Fix Committed → Fix Released |