• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. cbyrne

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website
    • Profile
    • Following 0
    • Followers 0
    • Topics 43
    • Posts 93
    • Best 7
    • Controversial 1
    • Groups 0

    cbyrne

    @cbyrne

    7
    Reputation
    708
    Profile views
    93
    Posts
    0
    Followers
    0
    Following
    Joined Last Online
    Email conor@glasetech.ie Location Ireland

    cbyrne Unfollow Follow

    Best posts made by cbyrne

    • RE: How to call a global script from dashboard?

      Finally got a working solution. Posted the basic custom module below for anyone else who comes across this thread.

      define(['angular', 'require'], function(angular, require) {
      'use strict';
      
      var userModule = angular.module('userModule', ['maUiApp']);
      
      userModule.component('userComponent', {
          bindings: {},
          controller: ['$scope', '$http', 
              function($scope, $http){
                  $scope.msg = null;
                  $scope.sendPost = function(point_xid, date_from, date_to, email_recipients){
                      var from = JSON.stringify(date_from);
                      var to = JSON.stringify(date_to);
                      var emails = JSON.stringify(email_recipients);
                      var script = "send_HTTP_debug(point_xid, " + from + ", " + to + ", " + emails + ")"
      
                      var address= "/rest/v2/script/run";
                      var content = {'Content-Type': 'application/json;charset=UTF-8'};
                      var data = {
                            "context": [
                              {
                                "contextUpdate": true,
                                "variableName": "point_xid",
                                "xid": point_xid
                              },
                            ],
                            "logLevel": "DEBUG",
                            "permissions": [
                              "admin"
                            ],
                            "script": script,
                            "wrapInFunction": true
                      };
                      function success(response){$scope.msg=response;};
                      function error(response){$scope.msg=response;};
      
                      $http.post(address, JSON.stringify(data),content).then(success, error);
                  };
              }],
          template: '\
          <div flex layout="column">\
              <md-input-container md-no-float="">\
                  <label>Point</label>\
                  <ma-point-list ng-model="point" query="query_tmpVal" start="start_tmpVal" limit="limit_tmpVal" sort="sort_tmpVal"></ma-point-list>\
              </md-input-container>\
              <div flex layout="row">\
                  <md-input-container style="flex-grow:1">\
                  <label>From</label>\
                      <ma-date-picker ng-model="date_from" mode="date" format="DD/MM/YYYY"></ma-date-picker>\
                  </md-input-container>\
                  <div style="width="10vw">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>\
                  <md-input-container style="flex-grow:1">\
                      <label>To</label>\
                      <ma-date-picker ng-model="date_to" mode="date" format="DD/MM/YYYY"></ma-date-picker>\
                  </md-input-container>\
              </div>\
              <md-input-container>\
                  <ma-email-recipients ng-model="email_recipients"></ma-email-recipients>\
              </md-input-container>\
              <md-button class="md-primary md-raised" ng-click="sendPost(point.xid, date_from, date_to, email_recipients)">Request Report</md-button>\
              <p>{{msg}}</p>\
          </div>\
          '
      });
      
      return userModule;
      
      }); // define
      
      posted in User help
      cbyrneC
      cbyrne
    • Request for FTL Reports module in Mango v4

      Email reports are one of our most used features and the main thing keeping us from moving to v4.

      posted in Mango feedback
      cbyrneC
      cbyrne
    • RE: Data File 3.7 issues

      @terrypacker Just updated the module and saw that you added the filename regex, thanks so much!

      posted in User help
      cbyrneC
      cbyrne
    • SElinux modification required for mango bin/ scripts

      Just something I noticed while doing a new test install of v4.

      If SElinux is enabled, the bash scripts in the mango bin directory need a small modification to their type otherwise mango.service will fail with

      mango.service: Failed at step EXEC spawning /opt/mango/bin/start-mango.sh: Permission denied
      

      To check a file's SElinux type, pass the -Z flag to ls.

      ls -Z /opt/mango/bin/
      unconfined_u:object_r:user_home_t:s0 certbot-deploy.sh*  
      unconfined_u:object_r:user_home_t:s0 mango.cmd
      unconfined_u:object_r:user_home_t:s0 start-options.sh*
      unconfined_u:object_r:user_home_t:s0 genkey.sh*
      unconfined_u:object_r:user_home_t:s0 mango.service
      unconfined_u:object_r:user_home_t:s0 stop-mango.sh*
      unconfined_u:object_r:user_home_t:s0 getenv.sh*
      unconfined_u:object_r:user_home_t:s0 mango.xml
      unconfined_u:object_r:user_home_t:s0 install-mango.sh*
      unconfined_u:object_r:user_home_t:s0 start-mango.sh*
      

      In order to be run from a systemd service, the scripts need to be of type bin_t. Their type can be changed using chcon.

      sudo chcon -t bin_t /opt/mango/bin/*.sh
      

      Now the files are of the correct SElinux type and mango.service will run as expected.

      ls -Z /opt/mango/bin/
      unconfined_u:object_r:bin_t:s0 certbot-deploy.sh*
      unconfined_u:object_r:user_home_t:s0 mango.cmd
      unconfined_u:object_r:bin_t:s0 start-options.sh*
      unconfined_u:object_r:bin_t:s0 genkey.sh*
      unconfined_u:object_r:user_home_t:s0 mango.service
      unconfined_u:object_r:bin_t:s0 stop-mango.sh*
      unconfined_u:object_r:bin_t:s0 getenv.sh*
      unconfined_u:object_r:user_home_t:s0 mango.xml
      unconfined_u:object_r:bin_t:s0 install-mango.sh*
      unconfined_u:object_r:bin_t:s0 start-mango.sh*
      

      Might be helpful info to add to the linux documentation.

      posted in Mango feedback
      cbyrneC
      cbyrne
    • RE: Out of memory problem

      Perfect, thanks @terrypacker! I'll try that and update this post.

      update 1:
      The H2 database shell doesn't recognise LIKE in CREATE TABLE. It may not be supported, The H2 command info for CREATE DATABASE doesn't show LIKE - https://www.h2database.com/html/commands.html#create_table

      update 2
      I just did a DELETE FROM EVENTS; instead.

      So yeah, there might have been a few too many events... 12 million. The database has gone from ~6 Gb to 76 Mb.

      posted in User help
      cbyrneC
      cbyrne
    • RE: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException

      @jared-wiltshire Oh I know... that's a whole other issue. I'm painfully aware how silly this is!

      posted in User help
      cbyrneC
      cbyrne
    • Filter behaviour and ma-data-point-selector

      The filter behaviour in the Data Sources > Data Points list is excellent. Primarily, it is case insensitive and has an implied glob. I would like to suggest that it is applied to the data point details page's data point selector also.

      I would also like to add this filter behaviour to my own pages that use ma-data-point-selector, any advice on how to go about this would be appreciated.

      ma-data-point-selector is an great component and I really like using it in my own pages, could we please get some documentation? Up to now I've gone off guesses and page inspections.

      Thanks!

      posted in User help
      cbyrneC
      cbyrne
    • Odd CPU performance pattern

      I hooked up Zabbix to our existing Mango 3.7.7 installation and noticed that the CPU usage was oddly high and following an odd pattern:

      5bb04cdb-14d8-40b3-af52-6a9f2fb705b6-image.png

      On every hour and half hour, CPU utilisation drops to 3% for 6 minutes and then ramps back up to 60%.
      The timing is actually three minutes before the 00/30 mark until 3 minutes after.
      Looking at the mango process in htop confirms the behaviour.

      The mango installation isn't particularly heavy, 86 data points.

      Server CPU info: 2x Intel Xeon CPU E5-2630 v3 @ 2.40GHz

      posted in Mango feedback
      cbyrneC
      cbyrne

    Latest posts made by cbyrne

    • RE: Filter behaviour and ma-data-point-selector

      @CraigWeb Hi Craig, thanks for the info! My only issue with the filtering point list is that I want to allow the user to select multiple points. I would still suggest that the same filter from Data Sources > Data Points list is applied to all instances of data-point-selector. It might sound silly, but the concepts of wildcards and case sensitivity is a bit much for our end users.

      posted in User help
      cbyrneC
      cbyrne
    • Filter behaviour and ma-data-point-selector

      The filter behaviour in the Data Sources > Data Points list is excellent. Primarily, it is case insensitive and has an implied glob. I would like to suggest that it is applied to the data point details page's data point selector also.

      I would also like to add this filter behaviour to my own pages that use ma-data-point-selector, any advice on how to go about this would be appreciated.

      ma-data-point-selector is an great component and I really like using it in my own pages, could we please get some documentation? Up to now I've gone off guesses and page inspections.

      Thanks!

      posted in User help
      cbyrneC
      cbyrne
    • RE: Overriding system logo for specific users

      @CraigWeb Thanks Craig, that's what I'm currently doing.

      posted in User help
      cbyrneC
      cbyrne
    • Overriding system logo for specific users

      We're trying to provide a white label service for a client, so we would like to be able to replace our logo with the clients site-wide, but only for that client's users.

      The logo in question is what's set by logo source in the UI settings.

      i.e.
      19820512-236e-449f-aaea-59d88d3eefc8-image.png

      Currently dealing with a Mango v3 instance but I can see the issue arising for v4 also.

      Thanks!

      posted in User help
      cbyrneC
      cbyrne
    • Saving Excel Report returned from API call

      I'm trying to save an excel report returned after calling /rest/latest/excel-reports/download/{XID}

      My first attempt doubles the file size so it looks like I'm saving bytes as chars.

              saveExcelFile(data, report_filename) {
                  let link = document.createElement("a");
                  let blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
                  link.href = URL.createObjectURL(blob);
                  link.download = report_filename;
                  link.click();
                  URL.revokeObjectURL(link.href)
                  link.remove();
              }
      

      The response payload looks to be base64 encoded but calling atob fails.

      I've also played around with a string to array buffer function to convert the data which gives me the correct filesize but still not a completely correct conversion.
      https://stackoverflow.com/questions/34993292/how-to-save-xlsx-data-to-file-as-a-blob

      A comparison of the hexdumps: (working file on left, file from original code snippet above on right)

      91190d97-56ea-486c-8d0d-f08e3c3de08c-image.png

      From the hexdump I can see that the first ~49 bytes are are correct but then the encoding changes

      posted in User help
      cbyrneC
      cbyrne
    • Tag columns visible in Data Sources > Data Points View

      When viewing the data points for a data source, the default view seems to be all tags as columns. Tags are proving very useful but this behavior is quite unwieldy as you end up with a very wide container you need to horizontally scroll through by default.

      Similarly, when tags are unchecked, this isn't remembered on page update, i.e. refresh or point edit.

      posted in Mango feedback
      cbyrneC
      cbyrne
    • Remove Permissions from User Profile View

      When I log in as a normal user and go to my user profile, the permissions section is still visible even though the user does not have permission to edit their own profile.

      de10e1c3-f4b1-444b-a2ad-e4c525c61971-image.png

      The user can't actually make any changes as it throws a permissions error on save but I don't think it should be visible to them at all.

      posted in How-To
      cbyrneC
      cbyrne
    • RE: DataSourceXID_SUCCESS already exists on Scripting Data Source validation

      @terrypacker Thanks for the clarification Terry, is this intended behavior or a bug?

      posted in User help
      cbyrneC
      cbyrne
    • RE: DataSourceXID_SUCCESS already exists on Scripting Data Source validation

      @aaron-asbra Thanks for your help, I managed to get through things ok without it being too much of a hassle.


      On another note, meta points with scripting points as their external points don't seem to get triggered by context updates.

      I have my data coming in via a polling data file source. On import, this triggers some scripting points to transform the data. I then added a meta point to sum up some of the scripting points. A simple

      return (x.value + y.value + z.value)
      

      with 'x' set to update context. This generates history just fine but no new values are ever created. I attached a log and some debug prints to see if it was actually getting triggered and it seems not.

      This isn't a huge issue as I've just used more scripting points instead of meta points, but I just wanted to report it.

      Thanks!

      posted in User help
      cbyrneC
      cbyrne
    • DataSourceXID_SUCCESS already exists on Scripting Data Source validation

      When creating a scripting data source, I am getting the following error when trying to validate my script. The solution currently is to restart mango.

      Mango 4.3.5

      Steps to reproduce:

      1. Create new scripting data source with empty script and no external points. Set to polling and save.
      2. Create a new data point called test with variable name test
      3. Add an external data point with variable name point and enable updates context.
      4. Write a simple script to copy over the last point value as an example such as:
      var x = point.lastValue(0,false);
      test.set(x.value, x.time)
      
      1. Save
      2. Turn off polling
      3. Attempt to validate script and get the following:
      com.serotonin.m2m2.rt.dataSource.PollingDataSource_DS_c535dc5a-9bfc-4598-a0cc-b646f839b0c6_SUCCESS already exists
      

      I think it also happens after a script error when validating.

      posted in User help
      cbyrneC
      cbyrne