• phildunlap

    Hi Antonio,

    Purging point values will only clean up tables in the H2 if you are not using NoSQL. But, merely deleting from tables in H2 is insufficient to get it to shrink itself. There is some amount of 'compaction' that it does when Mango shuts down, but in my experience the real way to shrink your H2 database is to,

    1. Use the SQL backup section of the system settings to create a core-database-H2-date.zip file in your Mango/backup (or as configured) directory.
    2. Stop Mango
    3. Move your existing Mango/databases/mah2.h2.db file elsewhere for safe keeping
    4. Start Mango
    5. Use the SQL backup section of the system settings section to restore the backup from part 1

    You may need to restart Mango again after that if you notice your data sources are not polling.

    I would definitely expect your database to shrink significantly by going through this backup / restore process.

    posted in Mango Automation general Discussion read more
  • phildunlap

    Sorry about email address, I've sent the email from another one....

    No worries! It just was unusual, so I figured maybe your forum email address isn't correct anymore or maybe you have multiple. I was still able to be 99% sure!

    The mah2.h2.db is 172 MB, I don't know if it is a big size or not.

    It's definitely not small. If you have a core-database-H2-date.zip file in your Mango/backup/ directory, you could try restoring that into a fresh Mango to see how large it is. I would expect the restored database to be much smaller, and that you may get a much snappier performance if you do.

    The points are updated in the dashboard every 2 seconds, is this to frequent?

    Maybe. I would try to shrink the database first, and if that doesn't alleviate the issue I would try slowing the update rate. I would expect that to depend on your device and your internet connection to that device.

    posted in Mango Automation read more
  • phildunlap

    Hi sky_watcher,

    I'm 99% sure I received thread dumps from you. But, the email address is slightly different than the email your forum user is registered under. How strange!

    From those thread dumps, I must wonder the size of the Mango/databases/mah2.h2.db file. No thread in the thread dumps was an obvious runaway, but there are a lot of threads that are getting blocked trying to access the database going through this route of code:


    which is getting data points from the data points table to supply any needed columns in the values response. But, there are a lot of these happening at the same time. I wonder how you are querying for values on this dashboard? I suspect it's either too frequent, or you need to bundle some requests together. Or your mah2 file is huge, in which case you need to do a backup, start clean and restore to shrink it I would say. I can link you to a thread with details on that if need be.

    posted in Mango Automation read more
  • phildunlap

    Hi CraigWeb,

    It sounds like the Linux permissions on the /opt/Idrive_ARM/ files might not be entirely correct. Here's the rwx from a working ES

     -rwxr-xr-x  Backup_Script.pl
     -rw-r--r--  BackupsetFile.txt
     -rw-r--r--  check.txt
     -rw-r--r--  CONFIGURATION_FILE
     -rw-r--r--  ExcludeList.txt
     -rwxr-xr-x  header.pl
     -rw-r--r--  Icon
     -rwxr-xr-x  idevsutil
     -rwxr-xr-x  Job_Termination_Script.pl
     drwxr-xr-x  account@infiniteautomation.com
     -rwxr-xr-x  login.pl
     -rwxr-xr-x  logout.pl
     -rw-r--r--  ReadMe.txt
     -rw-r--r--  RestoresetFile.txt
     -rwxr-xr-x  Scheduler_Script.pl
     -rwxr-xr-x  Status_Retrieval_Script.pl

    posted in User help read more
  • phildunlap

    Hi Antonio,

    You will need a device that is measuring the pyrheliometer. You may wish to use an Arduino or some other microcontroller for that, or perhaps the I/O enabled MangoES would be a good choice.

    Once you have a device reading the sensor, it needs to be able to communicate with Mango. This may be an existing protocol or you may send values through a custom serial protocol from your Arduino to a serial data source.

    Once you have a point in Mango receiving / reading the data, getting the minute sum is very easy. All the point into the context of a numeric meta point that has a timer update event of start of minute or a cron of 0 * * * * ? and has a script like,

    return dni.pastMINUTE).sum;

    posted in Mango Automation general Discussion read more
  • phildunlap

    Interesting request!

    Currently, it is not possible to define an event handler for all events at one level or above, but that sounds like it would be the ideal way to address this. Currently, I would find myself either using a mailing list or user with a "send alarm emails" setting of "Urgent" and either having that be enough (you can send SMS to many carriers over email, but you would not control the message text) or having a script check if new alarms have occurred in the last X minutes. You could also add an event handler to every event type, that's an option.

    So far as the script goes, add the output point into the context, we'll run it on 0 0/5 * * * ? (every five minutes) and have something like....

    var activeEvents = com.serotonin.m2m2.Common.eventManager.getAllActive();
    var maxLevel = 0;
    for( var k = 0; k < activeEvents.length; k+=1 ) {
      if( activeEvents[k].activeTimestamp < checkedUnto.time )
      if( activeEvents[k].alarmLevel > maxLevel )
        maxLevel = activeEvents[k].alarmLevel;
    if( maxLevel >= com.serotonin.m2m2.rt.event.AlarmLevels.URGENT )
    checkedUnto.set(!checkedUnto.value); //Ping-pong a context binary point to track time

    While this has the disadvantage of perhaps taking five minutes to alert of an alarm (you could speed up the cron patter though), it will have the advantage of also communicating the "server offline" state through failing to send an 'all is good' message on that five minute interval.

    If you want to go down the add-to-every event type route, I can help with the script you may need there. I think we probably will add the ability to define an event handler for all events at or above levels.

    posted in User help read more
  • phildunlap


    I checked the 2.8.8 bundles in the store and indeed there is not a dashboards module in the available downloads at the moment, while there probably should be. I will correct this, thanks for bringing it to our attention!

    Edit: I have ensured it is in the download bundles for 2.8.8.

    posted in User help read more
  • phildunlap


    I don't believe that will work, you would need to define the elements you wish to have in the SVG in the SVG.


    That's a good idea!

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    Is the DS_XID supposed to ba particular XID (I presume the serial ds xid is what you are referring to...) and is the chrome developer console sufficient? In the dev console all I got was undefined variable com

    It was supposed to be the data source XID of your serial data source. It was also to be run in a Mango JavaScript context. I probably shouldn't have said JavaScript console, that's not really what those are. Mango could use a JavaScript console...

    Oh shoot, it's not just the virtual, this one I've had the latest error was connecting to the supplied /dev/ttymUSB1

    My advisements were definitely for a virtual port! Although, you could try logging I/O and running that code in a Mango JavaScript context, still. The thread dump (which you could have emailed to support@infiniteautomation.com and I would have parsed the JSON using this script to look for either stuck threads or threads that were running for a very long time: https://github.com/infiniteautomation/ma-devtools/blob/master/PythonUtilities/Administration/parseThreads.py

    As it is though, with a real serial port, the thread dump isn't going to help us, it wouldn't seem. The handling of the serial port would be done in native code by the JSSC library and it would just hand events into Java. That would lead me to wonder if the connection with the serial device is spotty. You could check that by seeing if the port is getting re-enumerated or disconnecting by checking the dmesg output over SSH for the USB registration events. I would also wonder if the converter itself didn't have the issue, since we would be talking about a USB to 485 converter, or something, right?

    posted in Mango feedback read more