dpiui related questions

1. Diagnostics of marketing campaigns

 Actions to be performed on the DPIUI
 a) Check that the marketing campaign dates in the "from .. to" 
 (day of the week) form and its action period in the 
 "from 00:00 to 23:59" form are specified correctly in the marketing 
  campaigns input form
 b) synchronization log > 0? 
    ls -la /var/log/advsync.log
    
    If the synchronization log is empty, check that there is a cron job:
    grep advsync /var/spool/cron/root
    it should be:
    */1 * * * * /var/www/html/dpiui/yii process/advsync >> /var/log/advsync.log
    
    check that the process is running, run:
    /var/www/html/dpiui/yii process/advsync
    
    if there are errors you need to check the installation
 
 c) if the log is not empty (is not 0), check in synchronization log   how the campaigns are organized:
    grep adv_id= -A1 /var/log/advsync.log
    the output has to be like the following:
    adv_id=3, 2017-01-12, 2017-02-12, 2017-Feb-07 10:33,
    phttp= url: someinfo.mynet.ru/?
    adv_id=5, 2017-01-29, 2017-02-12, 2017-Feb-07 10:33,
    phttp= url: www.mynet.ru/?
      
 d) Check the DPI download counter:
    grep 'read t=' /var/log/advsync.log | tail -1
    DPISubs have to be > 0, it means there are campaigs on the DPI
    read t=2017-Feb-07 10:38 DPISubs=6 LastRecs=6 DiffSubs=0 LastSubs=6
    In this case, 6 subscribers for all campaigns have been loaded to the DPI.
    
 Actions to be performed on the DPI
 a) check that the ntf_server=<any_server.ru> option
     is specified int the /etc/dpi/fastdpi.conf
     
     otherwise, you should specify it and then restart the fastdpi service:
     service fastdpi restart
    This option is responsible for the notification option initialization, so it is mandatory.
 b) check the content of the subsurlsntf.lst file located in the temporary directory:
    cat /tmp/dpi/subsurlsntf.lst
    0 1198406
    1 11984920
    2 11983297
    3 11.0.6.64
    ...
    the 1-st value is the identifier (numerical order) in the URL /var/lib/dpi/ntfurl.lst list
    the 2-nd value is the subscriber login or its IP
 c) check if there are files in the DPI directory:
    ls -la /var/lib/dpi/ntf*
    -rw-r--r--. 1 root  root    50264 Feb  7 19:25 /var/lib/dpi/ntfurl.bin
    -rw-r--r--. 1 root  root    57732 Feb  7 19:25 /var/lib/dpi/ntfurl.idx
    -rw-rw-r--. 1 dpisu dpisu 1130487 Feb  7 19:25 /var/lib/dpi/ntfurl.lst
    
    the /var/lib/dpi/ntfurl.bin and /var/lib/dpi/ntfurl.idx files result from:
    cat /tmp/dpi/subsurlsntf.lst | cat2dic ntfurl.bin ntfurl.idx
    check that these files are the same using diff utility
    
    the /var/lib/dpi/ntfurl.lst file is text and contains the list of URLs, for example: 
    promo.mynet.ru/?reg=23&req=53BEEAD0-2ADC-4A2A-A247-E4BA76C90E07&
    promo.mynet.ru/?reg=66&req=543C1F6B-88B7-4895-9DA2-777E64A1CCFF&
    ...
    numerical order from this file is used in the /tmp/dpi/subsurlsntf.lst
    the numbering starts from 0
    
    If the required files are in place and are the same according to diff output, then the files are correctly prepared for loading 
     
 d) check the activated services:
    fdpi_ctrl list all --service 50
    The output:
    Autodetected fastdpi params : dev='lo', port=29000
    connecting 127.0.0.1:29000 ...
    ================================
    TestUser        50      (0x2000000000000)
    192.168.2.1     50      (0x2000000000000)
    192.168.2.2     50      (0x2000000000000)
    192.168.2.3     50      (0x2000000000000)
    192.168.3.4     50      (0x2000000000000)
    ------------------
    total: 5
    
    If you get a similar output and the logins/IPs match the /tmp/dpi/subsurlsntf.lst file then the services are loaded correctly. 

2. Notification is not working, files in the directory are in place ls /var/lib/dpi/ntf*, services are activated fdp_ctrl list all –service 50. What else?
а) check that the DPI loads the data:

    touch /var/lib/dpi/ntfurl*
    the following message should appear in the fastdpi_alrt.log:
    bl_updater_thread : Notifications(updatenotifications) list loaded with result, rc=0 : Success: loaded.
    if it doesn't appear then you have the wrong DPI version, so update it to version 5.5 or higher

б) check that the device orientation is correct (in_dev - towards subscribers / out_dev towards internet)
в) check that the notification option is enabled

3. What should I do if the DPI-UI password is forgotten? How to reset the admin password? Given the local access to the server and having the access to the database tables?

there were two ways:
1. you can delete a user with id = 100001 and run:
   /var/www/html/dpiui/yii install/createdb
   It will create the default admin account.
2. set the the default password for the user 100001:
   "$2y$13$VQHo/VYEgYietJ5AdQ.ute/5RKJlAyC3zbtif5EMfY3DVVVkN9qiG"

4. the server with DPIUI quickly consumes space in /var/www/html/dpiui/runtime/1/clickstream, Is there a way to set limits? How many days the data should be stored? What is the maximum size?

 these files can be deleted such a way:
 15 4 * * * /bin/find /var/www/html/dpiui/runtime/*/clickstream -name url_\*.dump.gz -cmin +1440 -delete > /dev/null 2>&1
 if the command was not specified during the installation, you should manually add it to the /var/spool/cron/root file
 

5. clickstream data are not added to the the appropriate tables, clickstream is received, there is information in the port.dump buffer file (for example, 1500.dump)

 a) take the file from the clickstream directory ( use option dumpfiledir=/var/www/html/dpiui/runtime/1/clickstream/ )
    for example - url_29072016_091016.dump.gz, make gzip -d url_29072016_091016.dump.gz. Use the link to the executable file from 
 configuration (processcmd=/var/www/html/dpiui/commands/processfile.sh), and run with the option being the previously unpacked file - /var/www/html/dpiui/commands/processfile.sh url_29072016_091016.dump 
    The usual problem that the hostname is not configured. You will be notified about by the following exception:
    - ERROR org.apache.spark.SparkContext - Error initializing SparkContext.
      java.net.UnknownHostException: fdpi.interface: fdpi.interface: The name or service is not known
      check:
         ping `hostname`
      configure the hostname in a proper way and/or specify it in the /etc/hosts
    - ERROR Exception in thread "main" java.lang.IllegalArgumentException: System memory 452132864 must be at
      least 4.718592E8. Please use a larger heap size. - when initializing Spark, add the memory - it requires at least 4GB of RAM
    If there are other exceptions/errors, please report to tech support
 b) Если п. а) без ошибок прошел, то проверьте шаблоны поиска введите www.domen, domen в путь введите /
 If a) and b) items didn't do the trick, please report to the technical support

6. The DPI configuration being changed by means of dpiui don't take effect, there are no errors when saving it.

 Probably you have changed the user to work with the device, for example, root -> dpisu
 After such a replacement on DPI, you need to do:
 chown -R dpisu:dpisu /tmp/dpi
 chmod a+w -R /tmp/dpi