Retrieving CouchDB database statistics

CouchDB HTTP servers can return statistics that are invaluable to system administrators. This information includes requests per second, sizes, and other useful statistics. Fortunately for us, Nmap provides an easy way of retrieving this information.

This recipe describes how to retrieve database statistics for CouchDB HTTP service by using Nmap.

How to do it...

Open your terminal and run Nmap with the following arguments:

# nmap -p5984 --script couchdb-stats 127.0.0.1 

The results will be included in the script output section:

PORT     STATE SERVICE 
5984/tcp open  httpd 
| couchdb-stats: 
|   httpd_request_methods 
|     PUT (number of HTTP PUT requests) 
|       current = 2 
|       count = 970 
|     GET (number of HTTP GET requests) 
|       current = 52 
|       count = 1208 
|   couchdb 
|     request_time (length of a request inside CouchDB without MochiWeb) 
|       current = 1 
|       count = 54 
|     open_databases (number of open databases) 
|       current = 2 
|       count = 970 
|     open_os_files (number of file descriptors CouchDB has open) 
|       current = 2 
|       count = 970 
|   httpd_status_codes 
|     200 (number of HTTP 200 OK responses) 
|       current = 27 
|       count = 1208 
|     201 (number of HTTP 201 Created responses) 
|       current = 2 
|       count = 970 
|     301 (number of HTTP 301 Moved Permanently responses) 
|       current = 1 
|       count = 269 
|     500 (number of HTTP 500 Internal Server Error responses) 
|       current = 1 
|       count = 274 
|   httpd 
|     requests (number of HTTP requests) 
|       current = 54 
|       count = 1208 
|_  Authentication : NOT enabled ('admin party') 

How it works...

The argument -p5984 --script couchdb-stats tells Nmap to launch the NSE script couchdb-stats if a CouchDB HTTP server is running.

The script couchdb_stats was submitted by Martin Holst Swende and it only performs one task: retrieving the runtime statistics of a CouchDB HTTP service. It does so by requesting the URI /_stats/ and parsing the serialized data returned by the server:

{"current":1,"count":50,"mean":14.28,"min":0,"max":114,"stddev":30.40068420282675,"description":"length of a request inside CouchDB without MochiWeb"}

There's more...

If you find an installation not protected by authentication, you should also inspect the following URIs:

  • /_utils/
  • /_utils/status.html
  • /_utils/config.html

You can learn more about the runtime statistics on CouchDB HTTP servers at http://wiki.apache.org/couchdb/Runtime_Statistics.

See also

  • The Listing CouchDB databases recipe
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.66.178