/
Parallel opReports Solution: New platform opReports 3.5.2 running in parallel with old platform OMK Apps including opReports 3.2.0

Parallel opReports Solution: New platform opReports 3.5.2 running in parallel with old platform OMK Apps including opReports 3.2.0

Introduction

Opmantek applications' released on or after 30 Sept 2020 will work on Opmantek's latest and fastest platform, however, earlier installed products are incompatible with this new platform.

This solution was needed as NMIS 8.6.7G1, opReports 3.2.0 and other Opmantek applications released prior to 30 September were installed on server(s).
However, opReports 3.5.2 was needed to improve the Node Health Report prior to opReports 3.5.2


Install parallel opReports 3.5.2 to /opt/omk/

opReports 3.2.0 and other Opmantek applications released prior to 30 September were installed on server(s) at /usr/local/omk/

opReports 3.5.2 was then installed at /opt/omk/ as follows:

  • Move the tar archive opReports-3.5.2-standalone.tar.gz, provided by Opmantek for this purpose, to /opt/ directory on server to be deployed to; 
  • Then deploy:

    /opt/

    cd /opt/
    # sudo mv /tmp/opReports-3.5.2-standalone.tar.gz /opt/
     
    # uncompress to ./omk/ and set owner and group on directory structure
    sudo tar -xzvf opReports-3.5.2-standalone.tar.gz
    sudo chown -R root:nmis /opt/omk/
     
    # verify
    cd omk/
    ls -lah
    total 52K
    drwxr-xr-x. 9 root nmis 4.0K Mar 30 00:36 .
    drwxr-xr-x. 4 root root 4.0K Mar 30 20:06 ..
    drwxrwsr-x. 3 root nmis 4.0K Mar 29 02:21 bin
    drwxr-xr-x. 3 root nmis 4.0K Mar 30 00:06 conf
    drwxr-xr-x. 4 root nmis 4.0K Mar 30 16:57 install
    -rw-r--r--. 1 root nmis  16K Mar 29 22:09 LICENSE
    drwxr-xr-x. 2 root nmis 4.0K Mar 30 00:40 log
    drwxr-xr-x. 3 root nmis 4.0K Mar 29 22:09 public
    drwxr-xr-x. 8 root nmis 4.0K Mar 29 22:42 templates
    drwxr-xr-x. 3 root nmis 4.0K Mar 30 00:40 var
     

    # Move scripts needed by opReports from the ./bin/install/ directory to the ./bin/ directory:
    sudo mv bin/install/oplicense-cli-standalone.* bin/
    sudo mv bin/install/opreports-cli-standalone.* bin/
    sudo mv bin/install/opreports-scheduler-standalone.* bin/


    # verify bin directory

    ls -lah bin/
    total 136M
    drwxrwsr-x. 3 root nmis 4.0K Mar 29 02:21 .
    drwxr-xr-x. 9 root nmis 4.0K Mar 30 00:36 ..
    drwxr-sr-x. 2 root nmis 4.0K Mar 29 02:21 install
    lrwxrwxrwx. 1 root nmis   23 Mar 30 20:06 oplicense-cli-standalone.exe -> opmantek-standalone.exe
    lrwxrwxrwx. 1 root nmis   23 Mar 30 20:06 oplicense-cli-standalone.pl -> opmantek-standalone.exe
    -rwxr-xr-x. 1 root nmis 136M Mar 26 01:53 opmantek-standalone.exe
    lrwxrwxrwx. 1 root nmis   23 Mar 30 20:06 opmantek-standalone.pl -> opmantek-standalone.exe
    lrwxrwxrwx. 1 root nmis   23 Mar 30 20:06 opreports-cli-standalone.exe -> opmantek-standalone.exe
    lrwxrwxrwx. 1 root nmis   23 Mar 30 20:06 opreports-cli-standalone.pl -> opmantek-standalone.exe
    lrwxrwxrwx. 1 root nmis   23 Mar 30 20:06 opreports-scheduler-standalone.exe -> opmantek-standalone.exe
    lrwxrwxrwx. 1 root nmis   23 Mar 30 20:06 opreports-scheduler-standalone.pl -> opmantek-standalone.exe
     
    # clean
    sudo rm ../opt/opReports-3.5.2-standalone.tar.gz
     
    # copy our proxy config into position:
    #   If Debian or Ubuntu we would now:
    #
    #       [ -d "/etc/apache2/conf.d" ] && sudo cp install/05omk-standalone-proxy.conf /etc/apache2/conf.d/
    #       OR
    #       # newer apache: different location, and use a2enmod
    #       [ -d "/etc/apache2/conf-available" ] && sudo cp install/05omk-standalone-proxy.conf /etc/apache2/conf-available/
    #       [ -d "/etc/apache2/conf-available" ] && sudo a2enmod proxy
    #       [ -d "/etc/apache2/conf-available" ] && sudo a2enmod proxy_http
    #       [ -d "/etc/apache2/conf-available" ] && sudo a2enmod headers
    #       [ -d "/etc/apache2/conf-available" ] && sudo a2enconf 05omk-standalone-proxy.conf
    #
    #       sudo service apache2 restart
    #
    #   If Centos or RHEL:
    #       sudo cp install/05omk-standalone-proxy.conf /etc/httpd/conf.d/
    #       sudo service httpd restart
     
    # set up the opReports 3.5.2 cron-jobs
    # first we verify current status:
    sudo ls -lah /etc/cron.d/
    total 36K
    drwxr-xr-x.  2 root root 4.0K Mar 30 21:04 .
    drwxr-xr-x. 75 root root 4.0K Mar 30 17:59 ..
    -rw-r--r--.  1 root root  113 Aug 23  2016 0hourly
    -rw-r--r--.  1 root root 1.6K Mar 29 00:24 nmis
    -rw-r--r--.  1 root root  168 Mar 29 00:55 oplicense
    -rw-r--r--.  1 root root  164 Mar 29 00:55 opreports
    -rw-------.  1 root root  108 Jan 26  2017 raid-check
    -rw-------.  1 root root  235 Jun 26  2018 sysstat
     
    # oplicense-standalone cron file
    sudo cp install/cron.d/oplicense-standalone /etc/cron.d/
     
    # we replace the opReports 3.2.0 cron file with the opReports 3.5.2 copy - that executes opReports 3.5.2 executable:
    sudo mv -f /etc/cron.d/opreports /usr/local/omk/install/cron.d/opreports_WAS_ACTIVE
    sudo cp -f install/cron.d/opreports /etc/cron.d/opreports
    # verify:
    sudo cat /etc/cron.d/opreports
    # this cron schedule runs the opReports scheduler every 5 minutes
    #
    # m h dom month dow user command
    */5 * * * *   root /opt/omk/bin/opreports-scheduler-standalone.exe
     
    # cleanup by disabling opReports 3.2.0 cli executable
    sudo mv /usr/local/omk/bin/opreports-cli.exe /usr/local/omk/bin/opreports-cli.exe.DISABLED
    sudo rm /usr/local/omk/bin/opreports-cli.pl
     
    # cleanup by disabling opReports 3.2.0 scheduler executable
    sudo mv /usr/local/omk/bin/opreports-scheduler.exe /usr/local/omk/bin/opreports-scheduler.exe.DISABLED
    sudo rm /usr/local/omk/bin/opreports-scheduler.pl


    # activate license at /opt/omk/conf/opLicense.nmis


    # run the opreports 3.5.2 scheduler manually to verify all ok

    sudo /opt/omk/bin/opreports-scheduler-standalone.exe --debug=1
     
    # run the opreports 3.5.2 cli manually to verify all ok - note we are generating report at opReports 3.2.0 directory /usr/local/omk/var/reports/on-demand/
    sudo ./bin/opreports-cli-standalone.exe type=config start_date="now - 7 days" end_date="now" node_regex=.* format=html format=csv format=xlsx output_dir=/usr/local/omk/var/reports/on-demand/ debug=1



Food for thought: Experimental (untested) suggestions

  1. Implement the omkd-standalone service on port 8043:

    # set up init.d service (opReports-3.5.2-standalone.tar.gz was built on a VM with systemd
    # - hence the '.bak' in filename at this stage: install/omkd-standalone.init.d.bak)
    # - we copy to /etc/init.d and rename file to omkd-standalone
    sudo cp install/omkd-standalone.init.d.bak /etc/init.d/omkd-standalone
    # on Debian or Ubuntu we would now:
    #       sudo update-rc.d omkd-standalone defaults
    # but we are on Centos, so:
    sudo chkconfig --add omkd-standalone
    sudo chkconfig omkd-standalone on
     
    sudo service omkd-standalone start

  2. This suggestion requires implementation of omkd-standalone service on port 8043 as per Point 1. immediately above.
    This suggestion should integrate omkd.service and omkd-standalone service better - with opReports 3.5.2 seamlessly replacing opReports 3.2 in the GUI.
    Replaces /etc/apache2/conf.d/05omk-standalone-proxy.conf with this /etc/apache2/conf.d/03omk-standalone-proxy.conf

    sudo rm /etc/apache2/conf.d/05omk-standalone-proxy.conf
     
    # this is one copy and paste command - up to 'EOF' about 3 lines from the end of this code block:
    #
    sudo cat > /etc/httpd/conf.d/03omk-standalone-proxy.conf <<EOF
    ## For more information on the listed Apache features please consult:
    ## http://httpd.apache.org/docs/
     
    # Don't forget to restart the daemon if you make changes to this configuration file1
    # apachectl restart
     
    <IfModule mod_proxy.c>
    ProxyRequests off
     
    <IfModule mod_headers.c>
    # if you are using the Opmantek applications behind an ssl-terminating apache vhost,
    # then you should adjust the vhost configuration to add this header but with
    # protocol "https".
    # The Opmantek applications are location- and protocol-independent in almost all cases.
    RequestHeader set X-Forwarded-Proto "http"
    </IfModule>
     
    <Location "/omk/opReports">
        ProxyPass http://localhost:8043/omk/opReports retry=5
        ProxyPassReverse http://localhost:8043/omk/opReports
                    ErrorDocument 503 '<html><head><meta http-equiv="refresh" content="60"></head><body><h1>Temporary Service Interruption</h1>The requested OMK page should be back soon. This page will automaticall$
    </Location>
     
    <Location "/omk">
        ProxyPass http://localhost:8042/omk retry=5
        ProxyPassReverse http://localhost:8042/omk
                   ErrorDocument 503 '<html><head><meta http-equiv="refresh" content="60"></head><body><h1>Temporary Service Interruption</h1>The requested OMK page should be back soon. This page will automaticall$
    </Location>
     
    # the first location directive only covers /omk and /omk/something,
    # not /omk.json
    <Location "/omk.json">
        ProxyPass http://localhost:8043/omk.json retry=5
        ProxyPassReverse http://localhost:8043/omk.json
    </Location>
     
     
    <Location "/es/omk/opReports">
        ProxyPass http://localhost:8043/es/omk/opReports retry=5
        ProxyPassReverse http://localhost:8043/es/omk/opRepo