Objective: In the previous blog, we saw how to collect nmon data and convert the same to html files. Now we will see how we can host it in a web.
To host the nmon charts using a simple solution follow the below steps...
1) Let us recall the directory structure first...
Nmon data loc: /pgBACKUP/nmondata
nmonchart bin: /pgBACKUP/nmonchartbin/nmonchart
nmonchart dest: /pgBACKUP/nmondata/nmonchartop
Let us one more refinement...
We will create one directory per server in nmonchart dest, this means we can use one url from one machine (using a remote nfs, we can collect data from all the servers) to access multiple machines chart.
Nmon data loc: /pgBACKUP/nmondata
nmonchart bin: /pgBACKUP/nmonchartbin/nmonchart
nmonchart dest for 10.0.2.7 machine: /pgBACKUP/nmondata/nmonchartop/10.0.2.7/
nmonchart dest for 10.0.2.8 machine: /pgBACKUP/nmondata/nmonchartop/10.0.2.8/
nmonchart dest for 10.0.2.9 machine: /pgBACKUP/nmondata/nmonchartop/10.0.2.9/
total 448
-rw-r--r--. 1 root root 457432 Dec 29 18:26 localhost_221229_1659.html
drwxr-xr-x. 2 root root 40 Dec 29 18:33 .
drwxr-xr-x. 3 root root 22 Dec 29 18:39 ..
[root@localhost 10.0.2.8]# pwd
/pgBACKUP/nmondata/nmonchartop/10.0.2.8
[root@localhost 10.0.2.8]
2) All we need now is python, if we already have python installed, you can just start a simple webpage from the location you have the host wise directory structure.
[root@localhost vagrant]# cd /pgBACKUP/nmondata/nmonchartop
[root@localhost nmonchartop]# ls -altr
total 0
drwxr-xr-x. 3 root root 193 Dec 29 18:13 ..
drwxr-xr-x. 2 root root 40 Dec 29 18:33 10.0.2.8
drwxr-xr-x. 3 root root 22 Dec 29 18:39 .
[root@localhost nmonchartop]# python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
>>>> now our website is up.
3) Before trying to access the web, please be sure to exempt the 8000 port from firewall or for time being stop it completely.
4) In case your testing this in a virtual box using NatNetwork, please do add port forwarding like below...
127.0.0.1:8000 -> 10.0.2.8:80000
5) Then try access the url...
http://127.0.0.1:8000/
6) Navigate through the url.
7) Observe the python command line output for incoming accesses....
Serving HTTP on 0.0.0.0 port 8000 ...
10.0.2.2 - - [29/Dec/2022 18:46:01] "GET / HTTP/1.1" 200 -
10.0.2.2 - - [29/Dec/2022 18:46:46] "GET /10.0.2.8/ HTTP/1.1" 200 -
10.0.2.2 - - [29/Dec/2022 18:47:22] "GET /10.0.2.8/localhost_221229_1659.html HTTP/1.1" 200 -
So now we have the data accessible from web url.
Thank you!
---this closes the blog.
No comments:
Post a Comment