§2024-06-08

This is to document how to monitor MongoDB replication Set using docsify.

機器: hc4Nas02.yushei.net

¶ Step 1. enviroment

alexlai@hc4nas02:~/docsify_proj$ echo $PATH
/home/alexlai/.local/bin:/run/user/1026/fnm_multishells/870519_1717809802157/bin:/home/alexlai/.local/share/fnm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
alexlai@hc4nas02:~/docsify_proj$ which node npm
/run/user/1026/fnm_multishells/870519_1717809802157/bin/node
/run/user/1026/fnm_multishells/870519_1717809802157/bin/npm
alexlai@hc4nas02:~/docsify_proj$ fnm list
* v20.14.0 default, lts-latest
* system

¶Step 2. create directory and 1npm init`

$ pwd
/home/alexlai/docsify_proj
alexlai@hc4nas02:~/docsify_proj$ mkdir monitor_replication_set && cd $_
$ npm init
$ npm i docsify-cli
$ cat package.json 
{
  "name": "monitor_replication_set",
  "version": "1.0.0",
  "description": "monitorin mongoDB replication set",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "alexlai@h2Jammy.yushei.net",
  "license": "ISC",
  "dependencies": {
    "docsify-cli": "^4.4.4"
  }
}

¶ Step 3. initialize

$ npx docsify init ./docs

Initialization succeeded! Please run docsify serve ./docs

$  ls -l docs
total 8
-rw-rw-r-- 1 alexlai alexlai 604 Jun  8 10:47 index.html
-rw-rw-r-- 1 alexlai alexlai  34 Jun  8 10:44 README.md

$ cd docs && mkdir $ mkdir chap_{01..04}
alexlai@hc4nas02:~/docsify_proj/monitor_replication_set/docs$ ls 
chap_01  chap_02  chap_03  chap_04  index.html  README.md

¶Step 4.

$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
192.168.48.133 - - [08/Jun/2024 10:55:14] "GET / HTTP/1.1" 200 -
192.168.48.133 - - [08/Jun/2024 10:55:14] "GET /README.md HTTP/1.1" 200 -
192.168.48.133 - - [08/Jun/2024 10:55:16] "GET / HTTP/1.1" 304 -

docsify-01.png