Monitor CouchDB replication
See https://www.claudiokuenzler.com/monitoring-plugins/check_couchdb_replication.php for documentation.
Monitor CouchDB replication
License: GNU General Public License v2.0
Monitor CouchDB replication
See https://www.claudiokuenzler.com/monitoring-plugins/check_couchdb_replication.php for documentation.
When a replication has failed, the plugin's current output is confusing:
$ ./check_couchdb_replication.sh -H localhost -u admin -p secret -r claudioreptest
COUCHDB REPLICATION CRITICAL - Unable to authenticate user admin
This happens because the plugin checks the http response for "unauthorized", trying to identify if user and password credentials to access CouchDB were correct:
cdbresp=$(curl -k -s $cdburl)
if [[ -n $(echo $cdbresp | grep -i unauthorized) ]]; then
echo "COUCHDB REPLICATION CRITICAL - Unable to authenticate user $user"
exit $STATE_CRITICAL
fi
But if a replication fails because within the replication wrong credentials were used, the following info is shown in the _replicator database:
{"database":"_replicator","doc_id":"claudioreptest","id":"c7d010d31ab268968f22f4d71c5766bf+continuous+create_target","node":"[email protected]","source":"http://admin:*****@localhost:5984/db1/","target":"https://remoteuser:*****@remotecouch.example.com/db1/","state":"crashing","info":"unauthorized: unauthorized to access or create database http://admin:*****@localhost:5984/db1/","error_count":7,"last_updated":"2018-03-26T07:07:24Z","start_time":"2018-03-26T06:30:23Z","proxy":null} ]]
Need to separate this.
Suggestion: Instead of checking a single replication, allow a check loops through all found replications, e.g. with "-r ALL"
$ /usr/lib/nagios/plugins/check_couchdb_replication.sh -H couchdb -u admin -p secret
parse error: type 'object' has no elements to extract (arg 2)
COUCHDB REPLICATION CRITICAL - Replication is
When a user creates a one-time replication (not a continuous replication), the plugin alerts when this replication is completed:
COUCHDB REPLICATION CRITICAL - 1 replications not running ("doc_id":"d0aacd8dc4068db931fff88557b115a2" "error_count":0 "info":{"revisions_checked":4700,)
The replication document looks like this:
{
"_id": "d0aacd8dc4068db931fff88557b115a2",
"_rev": "2-a27dc87bc178c97e50ca27e6b59b66d9",
"user_ctx": {
"name": "sofaadmin",
"roles": [
"_admin",
"_reader",
"_writer"
]
},
"source": {
"url": "http://localhost:5984/et-geodata",
"headers": {
"Authorization": "Basic c29mYWFkbWluOk9DR3NvS1haNA=="
}
},
"target": {
"url": "http://localhost:5984/et-geodata-old",
"headers": {
"Authorization": "Basic c29mYWFkbWluOk9DR3NvS1haNA=="
}
},
"create_target": true,
"continuous": false,
"owner": "sofaadmin",
"_replication_state": "completed",
"_replication_state_time": "2020-01-15T10:13:46Z",
"_replication_stats": {
"revisions_checked": 4700,
"missing_revisions_found": 4700,
"docs_read": 4700,
"docs_written": 4700,
"changes_pending": null,
"doc_write_failures": 0,
"checkpointed_source_seq": "4729-g1AAAAJ7eJydz10KwjAMAOCigr7uBOoFpH-z3ZO7gGeYS1sZY84nn_UmehO9id6kdu1gCEPYCCQkIR-kQggtiqlGkTpfVKEhJVRssAtSudUkR7C01pbFFFy3P7nZnLGEMar6bv5IsHIZdh1WemwrVCy1GIqlDZZ1WOQxUFQmRz0UOzTYtcPWASOcCY0HYvXMZXRzxXn3Fsw8SDgxFJtR4COAzxbUHswJNkTKUeArgO8WrD1odGyoglHgJ4D252UNHCQnfaflF2v2oW0",
"start_time": "2020-01-15T10:13:34Z"
}
}
Relevant here: "continuous": false,
The plugin should not alert on a replication which has "continuous": false,
in its replication settings.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.