From ac30a2ea888727dca3e22ab7ced2037a0da2b6c9 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Wed, 30 Aug 2023 11:15:41 +0200
Subject: [PATCH] update doc page

---
 docs/20_Checks/check_couchdb.md | 187 +++++++++++++++++++-------------
 1 file changed, 110 insertions(+), 77 deletions(-)

diff --git a/docs/20_Checks/check_couchdb.md b/docs/20_Checks/check_couchdb.md
index 8713680..6171da8 100644
--- a/docs/20_Checks/check_couchdb.md
+++ b/docs/20_Checks/check_couchdb.md
@@ -18,7 +18,7 @@ Check couchdb status.
 ______________________________________________________________________
 
 CHECK_COUCHDB
-v0.6
+v0.7
 
 (c) Institute for Medical Education - University of Bern
 Licence: GNU GPL 3
@@ -39,16 +39,24 @@ OPTIONS:
                   response will be shown
 
   MODE is one of
-  up              show general couchdb status
-  replication     show last replication status
-  pending         show count of pending updates for nodes, dbs and users
+  httpd           Show counters for http request types
+  httpd_methods   Show counters for http request methods
   open_databases  show number of open databases
   open_os_files   show number of file descriptors CouchDB has open
-  httpd_methods   Show counters for http request methods
+  replication     show last replication status
+  pending         show count of pending updates for nodes, dbs and users
+  replication     show last replication status
+  up              show general couchdb health status
 
 EXAMPLE:
 check_couchdb -m up
-    Check if couchdb is up and running
+  Check if couchdb is up and running
+
+check_couchdb -m httpd_methods
+  Show counters and change rate per sec of GET, POST, and other methods
+
+check_couchdb -c /opt/couchdb/myconfig.sh -m up
+  Source another config to define COUCH_URL
 
 ```
 
@@ -74,35 +82,87 @@ With parameter ``-c CFGFILE`` can define another location where to find the vari
 
 With the parameter ``-m METHOD`` you define what kind of check to perform.
 
-### up
+### httpd
 
-Simple check if couchdb is up and running.
+Show counters for http request types.
 
-From url ``/up`` it fetches the value status.
-It switches to critical if one of the seeds is not "ok".
+All values are taken from ``/_node/_local/_stats/couchdb/httpd``
 
-`check_couchdb -m up` returns
+``check_couchdb -m httpd_methods`` returns
 
 ```txt
-OK: Couchdb :: health status (value 'status' in /_up is 'ok')
-Reponse of /_up: 
-{
-  "status": "ok",
-  "seeds": {
-    "couchdb@192.168.25.172": {
-      "timestamp": "2023-08-28T07:27:54.938619Z",
-      "last_replication_status": "ok",
-      "pending_updates": {
-        "_nodes": 0,
-        "_dbs": 0,
-        "_users": 0
-      }
-    },
-    "couchdb@192.168.25.61": {}
-  }
-}
+OK: Couchdb :: Http request methods
+______________________Property____Counter______Delta
+              aborted_requests          0          0 per sec
+                 bulk_requests          0          0 per sec
+                      requests     190116          1 per sec
+                 view_timeouts          0          0 per sec
+                 find_timeouts          0          0 per sec
+              explain_timeouts          0          0 per sec
+             all_docs_timeouts          0          0 per sec
+       partition_view_requests          0          0 per sec
+       partition_find_requests          0          0 per sec
+    partition_explain_requests          0          0 per sec
+   partition_all_docs_requests          0          0 per sec
+       partition_view_timeouts          0          0 per sec
+       partition_find_timeouts          0          0 per sec
+    partition_explain_timeouts          0          0 per sec
+   partition_all_docs_timeouts          0          0 per sec
+          temporary_view_reads          0          0 per sec
+                    view_reads          0          0 per sec
+    clients_requesting_changes          0          0 per sec
+                purge_requests          0          0 per sec
+
+ |abortedrequests=0;; bulkrequests=0;; requests=1;; viewtimeouts=0;; findtimeouts=0;; explaintimeouts=0;; alldocstimeouts=0;; partitionviewrequests=0;; partitionfindrequests=0;; partitionexplainrequests=0;; partitionalldocsrequests=0;; partitionviewtimeouts=0;; partitionfindtimeouts=0;; partitionexplaintimeouts=0;; partitionalldocstimeouts=0;; temporaryviewreads=0;; viewreads=0;; clientsrequestingchanges=0;; purgerequests=0;;
+```
 
- ```
+### httpd_methods
+
+Show counters for http request methods.
+All values are taken from ``/_node/_local/_stats/couchdb/httpd_request_methods``
+
+``check_couchdb -m httpd_methods`` returns
+
+```txt
+OK: Couchdb :: Http request methods
+____Method____Counter______Delta
+      COPY          0          0 per sec
+    DELETE          1          0 per sec
+       GET     190332          1 per sec
+      HEAD          0          0 per sec
+   OPTIONS          0          0 per sec
+      POST          0          0 per sec
+       PUT          0          0 per sec
+ |copy=0;; delete=0;; get=1;; head=0;; options=0;; post=0;; put=0;;
+```
+
+### open_databases
+
+Show number of open databases
+The value is taken from ``/_node/_local/_stats/couchdb/open_databases``
+
+This check sends performance data.
+
+``check_couchdb -m open_databases`` returns
+
+```txt
+OK: Couchdb :: open_databases = 0
+ |opendatabases=0;; 
+```
+
+### open_os_files
+
+Show number of file descriptors CouchDB has open
+The value is taken from ``/_node/_local/_stats/couchdb/open_os_files``
+
+This check sends performance data.
+
+``check_couchdb -m open_os_files`` returns
+
+```txt
+OK: Couchdb :: open_os_files = 0
+ |openosfiles=0;; 
+```
 
 ### pending
 
@@ -168,59 +228,32 @@ Reponse: of /_up
 }
 ```
 
-### open_databases
-
-Show number of open databases
-
-This check sends performance data.
-
-``check_couchdb -m open_databases`` returns
-
-```txt
-OK: Couchdb :: open_databases = 0
-Reponse: of /_node/_local/_stats/couchdb/open_databases
-{
-  "value": 0,
-  "type": "counter",
-  "desc": "number of open databases"
-}
- |opendatabases=0;; 
-```
-
-### open_os_files
+### up
 
-Show number of file descriptors CouchDB has open
+Simple check if couchdb is up and running.
 
-This check sends performance data.
+From url ``/up`` it fetches the value status.
+It switches to critical if one of the seeds is not "ok".
 
-``check_couchdb -m open_os_files`` returns
+`check_couchdb -m up` returns
 
 ```txt
-OK: Couchdb :: open_os_files = 0
-Reponse: of /_node/_local/_stats/couchdb/open_os_files
+OK: Couchdb :: health status (value 'status' in /_up is 'ok')
+Reponse of /_up: 
 {
-  "value": 0,
-  "type": "counter",
-  "desc": "number of file descriptors CouchDB has open"
+  "status": "ok",
+  "seeds": {
+    "couchdb@192.168.25.172": {
+      "timestamp": "2023-08-28T07:27:54.938619Z",
+      "last_replication_status": "ok",
+      "pending_updates": {
+        "_nodes": 0,
+        "_dbs": 0,
+        "_users": 0
+      }
+    },
+    "couchdb@192.168.25.61": {}
+  }
 }
- |openosfiles=0;; 
-```
-
-### httpd_methods
-
-Show counters for http request methods.
-
-``check_couchdb -m httpd_methods`` returns
 
-```txt
-OK: Couchdb :: Http request methods
-    Method    Counter     Delta
-      COPY          0          0 per sec
-    DELETE          1          0 per sec
-       GET     116122          1 per sec
-      HEAD          0          0 per sec
-   OPTIONS          0          0 per sec
-      POST          0          0 per sec
-       PUT          0          0 per sec
- |copy=0;; delete=0;; get=1;; head=0;; options=0;; post=0;; put=0;; 
-```
\ No newline at end of file
+ ```
-- 
GitLab