diff --git a/.gitignore b/.gitignore index d692716..181f8ff 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ download/win7-x64-installer/* download/skqitam-client-win7-installer.zip itam-data/hosts/* itam-data/host-id-map.json +itam-data/proc/* +itam-data/reports/* itam-data/logs/* diff --git a/analyze-data.sh b/analyze-data.sh new file mode 100755 index 0000000..a30dca0 --- /dev/null +++ b/analyze-data.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Detect POSIX Environment +os=`uname -s | tr '[:upper:]' '[:lower:]'` +arch=`uname -m | sed -r 's/x86_64/x64/'` +#echo $os +#echo $arch + +rundir=`echo $0 |sed -r 's/\/analyze-data\.sh$//'` +#echo $rundir + +node_ver='v14.17.1' +node_path="$rundir/nodejs/node-$node_ver-$os-$arch/bin/node" +npm_path="$rundir/nodejs/node-$node_ver-$os-$arch/bin/npm" +export PATH="$rundir/nodejs/node-$node_ver-$os-$arch/bin:"$PATH + +# My need to grow if client Payload get larger +max_http_header_size='40000000000' + +if [ -x "$node_path" ]; then + $node_path $rundir/itam-data-analyzer.js +else + echo "ERROR: Missing Node.JS: $node_path" + exit 1 +fi diff --git a/itam-data-analyzer.js b/itam-data-analyzer.js new file mode 100644 index 0000000..cfd71fd --- /dev/null +++ b/itam-data-analyzer.js @@ -0,0 +1,66 @@ +var path = require('path') +var fs = require('fs') +var skqlib = require('./skq_modules/skq-lib') + +// GLOBAL CONFIG +process['CONFIG'] = JSON.parse(fs.readFileSync(path.join(__dirname, 'config','skqitam-server-config.json'), 'utf8')) +process['CONFIG']['GLOBAL']['RUN_DIR'] = __dirname +process['CONFIG']['LOCAL']= skqlib.it_am_init() + +// console.log(JSON.stringify(process['CONFIG'], null, 2)) + +console.log('Data Dir: ' + path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'])) + +let hostdir_base = path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'], 'hosts') +let hostdirs = fs.readdirSync(hostdir_base) + +// console.log(JSON.stringify(hostdirs, null, 2)) + +try { + fs.mkdirSync(path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'], 'reports'), { recursive: true }) +} catch (e) { + console.log('ERROR: Could not mkdir: ' + path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'], 'reports')) + process.exit(1) +} + +try { + fs.mkdirSync(path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'], 'proc'), { recursive: true }) +} catch (e) { + console.log('ERROR: Could not mkdir: ' + path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'], 'indexed-data')) + process.exit(1) +} + +let index_data_file = path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'], 'proc', 'index-data.json') +let index_data = {} + +try { + index_data = JSON.parse(fs.readFileSync(index_data_file, 'utf8')) +} catch (e) { + // Do Nothing +} + + +for (hd in hostdirs) { + let data_files = fs.readdirSync(path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'], 'hosts', hostdirs[hd], 'raw')) + + console.log ("LATEST DATA: " + path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'], 'hosts', hostdirs[hd], 'raw', data_files[0])) + + let host_data = JSON.parse(fs.readFileSync(path.join(__dirname, process['CONFIG']['GLOBAL']['ITAM_DATA_DIR'], 'hosts', hostdirs[hd], 'raw', data_files[0]), 'utf8')) + + // console.log(JSON.stringify(host_data, null, 2)) + + if (!index_data.hasOwnProperty(host_data['ITAM']['ID'])) { + index_data[ host_data['ITAM']['ID'] ] = {} + } + + index_data[ host_data['ITAM']['ID'] ]['LATEST_DATA'] = host_data['ITAM']['STARTTIME'] + index_data[ host_data['ITAM']['ID'] ]['HOSTNAME'] = host_data['ITAM']['HOSTNAME'] + index_data[ host_data['ITAM']['ID'] ]['LOCAL_HOSTNAME'] = host_data['SOURCE']['NODEJS']['HOST']['HOSTNAME'] + index_data[ host_data['ITAM']['ID'] ]['IP_ADDR'] = host_data['SOURCE']['NODEJS']['HOST']['IP_ADDR'][0]['address'] + index_data[ host_data['ITAM']['ID'] ]['OS'] = host_data['SOURCE']['NODEJS']['OS']['DISTRO'] + index_data[ host_data['ITAM']['ID'] ]['OS_VERSION'] = host_data['SOURCE']['NODEJS']['OS']['DISTRO_VERSION'] + index_data[ host_data['ITAM']['ID'] ]['OS_INSTALL_DATE'] = host_data['SOURCE']['OS_INSTALL_ISO_DATE'] + +} + +fs.writeFileSync(index_data_file, JSON.stringify(index_data, null, 2), 'utf8') diff --git a/web/root/site/bootstrap.html b/web/root/site/bootstrap.html index b3cfd6c..7bd6c5c 100644 --- a/web/root/site/bootstrap.html +++ b/web/root/site/bootstrap.html @@ -119,7 +119,7 @@

Examples

Alerts
-
<div class="alert alert-primary" role="alert">
+
<div class="alert alert-primary" role="alert">
   This is a primary alert—check it out!
 </div>
 <div class="alert alert-secondary" role="alert">
@@ -144,41 +144,33 @@
   This is a dark alert—check it out!
 </div>
 
- - - - - - - -
Buttons
-
<button type="button" class="btn btn-primary">Primary</button>
+
<button type="button" class="btn btn-primary">Primary</button>
 <button type="button" class="btn btn-secondary">Secondary</button>
 <button type="button" class="btn btn-success">Success</button>
 <button type="button" class="btn btn-danger">Danger</button>
@@ -188,7 +180,6 @@
 <button type="button" class="btn btn-dark">Dark</button>
 <button type="button" class="btn btn-link">Link</button>
 
-

@@ -200,9 +191,8 @@

You can also turn HTML Links into Buttons

-
<a class="btn btn-primary" href="">HTML Link</a>
+
<a class="btn btn-primary" href="">HTML Link</a>
 
-

HTML Link

diff --git a/web/root/site/build.html b/web/root/site/build.html index 0f489ec..17137db 100644 --- a/web/root/site/build.html +++ b/web/root/site/build.html @@ -112,17 +112,15 @@

Building the Website

-
[$] cd skq-mkdocs-templates
+
[$] cd skq-mkdocs-templates
 
-

To rebuild a clean HTML site directory run mkdocs build --clean

-
[$] mkdocs build --clean
+
[$] mkdocs build --clean
 WARNING -  Config value: 'version'. Warning: Unrecognised configuration name: version
 PDF export is disabled (set environment variable ENABLE_PDF_EXPORT to 1 to enable)
 INFO    -  Cleaning site directory
 INFO    -  Building documentation to directory: /home/jehaverlack/Devel/Sikuliaq/docs/skq-mkdocs-template/site
 
-
Each time you edit the site source content files you will need to run the mkdocs build --clean command to rebuild the site directory and test your edits.
diff --git a/web/root/site/cloning.html b/web/root/site/cloning.html index 6a5aa72..9ef2b07 100644 --- a/web/root/site/cloning.html +++ b/web/root/site/cloning.html @@ -117,21 +117,18 @@ A UA Github (https://github.alaska.edu)

Git clone

-
git clone https://github.alaska.edu/skq/skq-mkdocs-template.git
+
git clone https://github.alaska.edu/skq/skq-mkdocs-template.git
 
-

Download Zip

Or download as a zip file.

Shipside Git Repository

No login required

Git clone

-
git clone https://git.sikuliaq.alaska.edu/scm/git/skq/skq-mkdocs-template
+
git clone https://git.sikuliaq.alaska.edu/scm/git/skq/skq-mkdocs-template
 
-

Files and Directories

-
cd skq-mkdocs-templates
+
cd skq-mkdocs-templates
 
-

Inputs

  • mkdocs.yml - master Configuration File
  • diff --git a/web/root/site/code.html b/web/root/site/code.html index a2ceb5a..a88db7f 100644 --- a/web/root/site/code.html +++ b/web/root/site/code.html @@ -117,88 +117,82 @@

    Plain Text

    -
    Hello World
    +
    Hello World
     
    -

    HTML

    -
    <h2>Hello World</h2>
    +
    <h2>Hello World</h2>
     
    -

    JavaScript

    -
    console.log("Hello World")
    +
    console.log("Hello World")
     
    -

    CSS

    -
    .helloworld {
    +
    .helloworld {
       color: #567;
     }
     
    -

    Markdown

    -
    ## Hello World
    +
    ## Hello World
     
    -

    Bash

    -
    #!/bin/bash
    +
    #!/bin/bash
     
     echo "Hello World"
     
    -

    JSON

    -
    {
    +
    {
       "Hello":"World"
     }
     
    -

    Marddown Code Highlight Source

    
     ### Plain Text
    -``` {.plaintext}
    +``` {.plaintext}
     Hello World
    -```
    +```
    +
     
     ### HTML
    -``` {.html}
    -<h2>Hello World</h2>
    -```
    +``` {.html}
    +<h2>Hello World</h2>
    +```
     
     
     ### JavaScript
    -``` {.javascript}
    +``` {.javascript}
     console.log("Hello World")
    -```
    +```
     
     
     ### CSS
    -``` {.css}
    +``` {.css}
     .helloworld {
       color: #567;
     }
    -```
    +```
     
     
     ### Markdown
    -``` {.markdown}
    +``` {.markdown}
     ## Hello World
    -```
    +```
     
     
     ### Bash
    -``` {.bash}
    +``` {.bash}
     #!/bin/bash
     
     echo "Hello World"
    -```
    +```
     
     
     ### JSON
    -``` {.json}
    +``` {.json}
     {
       "Hello":"World"
     }
    -```
    +```
     
    diff --git a/web/root/site/editing.html b/web/root/site/editing.html index 47a14c1..2f5257f 100644 --- a/web/root/site/editing.html +++ b/web/root/site/editing.html @@ -124,7 +124,7 @@ To modify the navigation menu find the following section in mkdocs.yml. NOTE the top level nav menu items such as Setup, Features, and About. And the paged under each top level nav item. -
    nav:
    +
    nav:
       - <span class="fas fa-home"></span>: index.md
       - Setup:
         - Install: install.md
    @@ -147,7 +147,6 @@
       - About:
         - Contact: contact.md
     
    -
    See how the HTML renders a Bootstrap menu.
    diff --git a/web/root/site/equations.html b/web/root/site/equations.html index 41081d3..53af5d3 100644 --- a/web/root/site/equations.html +++ b/web/root/site/equations.html @@ -119,18 +119,16 @@ Markdown supports inline [LaTeX](https://en.wikipedia.org/wiki/LaTeX) equations

    Inline Equations

    Inline LaTeX starts and ends with \( LaTex Code \)

    Code
    -
    The square root of 2 is \(\sqrt{2} = 1.141421....\).
    +
    The square root of 2 is \(\sqrt{2} = 1.141421....\).
     
    -

    The square root of 2 is .


    Centered Equations

    To center an equation on the page use:

    \[ LaTex Code \]

    Code
    -
    \[\sqrt{2} = 1.141421....\]
    +
    \[\sqrt{2} = 1.141421....\]
     
    -

    @@ -139,9 +137,8 @@ Markdown supports inline [LaTeX](https://en.wikipedia.org/wiki/LaTeX) equations

    To left justify an equation use:

    \( LaTex Code \)

    Code
    -
    \(\sqrt{2} = 1.141421....\)
    +
    \(\sqrt{2} = 1.141421....\)
     
    -

    diff --git a/web/root/site/footnotes.html b/web/root/site/footnotes.html index 4946490..68774bb 100644 --- a/web/root/site/footnotes.html +++ b/web/root/site/footnotes.html @@ -113,13 +113,12 @@

    Footnotes

    To use the footnotes plugin 1, simply include [^footnoteid] inline in your text, and [^footnoteid]: at the end of your markdown file. Also be sure to enable the footnote plugin in your mkdocs.yml file.

    -
    To use the footnotes plugin [^1], simply include ...
    +
    To use the footnotes plugin [^1], simply include ...
     
     ...
     
     [^1]: [Footnotes Plugin](https://www.markdownguide.org/extended-syntax#footnotes)
     
    -

      diff --git a/web/root/site/icons.html b/web/root/site/icons.html index 42f1bd1..ab97ae4 100644 --- a/web/root/site/icons.html +++ b/web/root/site/icons.html @@ -126,7 +126,6 @@

      To use an FA Icon, embed it as a <span> element with the appropriate class.

      <span class="fas fa-user"></span>
       
      -

      Example 1

      Search for question on the Font Awesome icon page. You will see 3 search interesting results: @@ -138,7 +137,6 @@ - <span class="fas fa-question-circle"></span> Solid Question Circle - <span class="far fa-question-circle"></span> Regular Question Circle

    -
    • Solid Question Mark
    • Solid Question Circle
    • @@ -150,7 +148,6 @@ - <span class="fab fa-apple"></span> Mac - <span class="fab fa-windows"></span> Windows
    -
    • Linux
    • Mac
    • diff --git a/web/root/site/install.html b/web/root/site/install.html index c9ffb7a..fa8ff64 100644 --- a/web/root/site/install.html +++ b/web/root/site/install.html @@ -112,9 +112,10 @@

      Installing Requirements

      -

      +
      The following tools can be installed and used cross platform on Windows, Mac and Linux computers to build MkDocs websites. -

      +
      +
      You may need to adapt the following notes for you operating system platform.
      @@ -125,13 +126,12 @@
    • Python Version 3 recommended
    Testing Python Version
    -
    [$] python3 --version
    +
    [$] python3 --version
     Python 3.6.8
     
     [$] pip3 --version
     pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
     
    -

    MkDocs

    • MkDocs Website
    • @@ -141,18 +141,16 @@ pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

      Installing MkDocs and common plugins

      -
      sudo pip install mkdocs
      +
      sudo pip install mkdocs
       sudo pip install mkdocs-pdf-export-plugin
       sudo pip install mkdocs-bootstrap
       sudo pip install python-markdown-math
       sudo pip install https://github.com/mitya57/python-markdown-math/archive/master.zip
       
      -
      Testing MkDocs Version
      -
      [$] mkdocs --version
      +
      [$] mkdocs --version
       mkdocs, version 1.1 from /usr/local/lib/python3.6/site-packages/mkdocs (Python 3.6)
       
      -

      For windows you can omit sudo in the above commands.

      NOTE: You will need MkDocs version 1.1 to work with this template. If you have an older version try upgrading with: diff --git a/web/root/site/menu.html b/web/root/site/menu.html index da24bad..89098a5 100644 --- a/web/root/site/menu.html +++ b/web/root/site/menu.html @@ -112,11 +112,12 @@
      -

      As described on the Editing page +

      As described on the Editing page

      To modify the navigation menu find the following section in mkdocs.yml. -

      -
      nav:
      +
      + +
      nav:
         - <span class="fas fa-home"></span>: index.md
         - Setup:
           - Install: install.md
      @@ -127,12 +128,11 @@
           - Swipe Nav: swipe.md
           -...
       
      -
      However both top and sub nav menu items can also be both Markdown or URL links. For example:
      -
      nav:
      +
      nav:
         - Home: index.md
         - Sikuliaq: https://www.sikuliaq.alaska.edu
         - UAF:
      diff --git a/web/root/site/optional.html b/web/root/site/optional.html
      index 8339cb9..43e4ae1 100644
      --- a/web/root/site/optional.html
      +++ b/web/root/site/optional.html
      @@ -113,35 +113,31 @@
       
       
       

      MkDocs provides a test webserver that can be used to test the static HTML website.

      -
      mkdocs serve
      +
      mkdocs serve
       
      -

      However you might prefer the Node.js http-server for this purpose.

      Node.js

      or via NVM (No Admin Privs Needed)
      -
      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
      +
      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
       
       nvm install --lts
       
      - -
      [$] node --version
      +
      [$] node --version
       v12.14.1
       
       [$] npm --version
       6.13.4
       
      -

      http-server

      (Requires Node.js)

      -
      npm install --global http-server
      +
      npm install --global http-server
       
      -

      Atom Editor

      • https://atom.io/
      • diff --git a/web/root/site/pdf.html b/web/root/site/pdf.html index a773300..f84d675 100644 --- a/web/root/site/pdf.html +++ b/web/root/site/pdf.html @@ -118,14 +118,13 @@

      Enable the Plugin

      In your mkdocs.yml Config File

      -
      plugins:
      +
      plugins:
           - pdf-export:
               verbose: true
               media_type: print
               combined: true
               combined_output_path: pdf/skq-docs.pdf
       
      -
      Not all HTML code renders well as PDF.
      diff --git a/web/root/site/search.html b/web/root/site/search.html index 9bc5859..c2a99b4 100644 --- a/web/root/site/search.html +++ b/web/root/site/search.html @@ -120,7 +120,7 @@ To enable site Search add the - search to the mkdocs.yml plugins section.
      -
      plugins:
      +
      plugins:
           - search
       
      diff --git a/web/root/site/sitemap.xml.gz b/web/root/site/sitemap.xml.gz index 7eed22b..8c5c74e 100644 Binary files a/web/root/site/sitemap.xml.gz and b/web/root/site/sitemap.xml.gz differ diff --git a/web/root/site/swipe.html b/web/root/site/swipe.html index 6a3f548..4a12eed 100644 --- a/web/root/site/swipe.html +++ b/web/root/site/swipe.html @@ -122,7 +122,7 @@ Swipe navigation is not a feature of MkDocs but is a custom modification include

      custom/js/swipenav.js

      For details see the following JavaScript code.

      -
      var links = document.getElementsByTagName("a");
      +
      var links = document.getElementsByTagName("a");
       
       for (l in links) {
         if (String(links[l].innerHTML).match(/fa-arrow-left.*Previous/)) {
      diff --git a/web/root/site/test.html b/web/root/site/test.html
      index 88f90e5..3c4bde0 100644
      --- a/web/root/site/test.html
      +++ b/web/root/site/test.html
      @@ -112,9 +112,8 @@
                           

      Testing the Site

      -
      [$] cd skq-mkdocs-templates
      +
      [$] cd skq-mkdocs-templates
       
      -
      There is more than one way to test a mkdocs website.
      @@ -128,7 +127,7 @@ There is more than one way to test a mkdocs website.

      Run the mkdocs serve test server

      -
      [$] mkdocs serve
      +
      [$] mkdocs serve
       INFO    -  Building documentation...
       PDF export is disabled (set environment variable ENABLE_PDF_EXPORT to 1 to enable)
       INFO    -  Cleaning site directory
      @@ -137,7 +136,6 @@ INFO    -  Cleaning site directory
       [I 200208 15:58:49 handlers:64] Start detecting changes
       [I 200208 15:59:08 handlers:135] Browser Connected: http://127.0.0.1:8000/
       
      - @@ -147,14 +145,13 @@ INFO - Cleaning site directory

    Run the http-server test server

    See: Optional Tools to install.

    -
    [$ skq-mkdocs-template] http-server site
    +
    [$ skq-mkdocs-template] http-server site
     Starting up http-server, serving site
     Available on:
       http://127.0.0.1:8080
       http://10.1.0.242:8080
     Hit CTRL-C to stop the server
     
    -

    Point your browser to:

    • http://127.0.0.1:8080
    • diff --git a/web/root/site/version.html b/web/root/site/version.html index 1f872ff..afab5a1 100644 --- a/web/root/site/version.html +++ b/web/root/site/version.html @@ -116,10 +116,9 @@ A custom site version date has been added to the mkdocs.yml configuration file. -
      extra:
      +
      extra:
           version: 2020-02-08
       
      -

      The Version is rendered in the footer of all MkDocs site page.

      MenuNaV