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.

  • Get data point names from MySQL data base

    4
    0 Votes
    4 Posts
    3k Views
    M
    Thanks for the answer. Just so that I am not drawing wrong conclusions: To get the name of a data point, I have to query for his xid (e.g. DP_123456) to get the blob and deserialize this blob in some way as part of that will contain the name. I think I asked the wrong question. My goal is to query the data point values by its name. Ideally, the data point name would have an entry similar to data source tables. Currently, I see no way around to get there. Or is there even any? I already experimented to deserialize the blob files from inside my programming interface, but the db package does not support blobs atm.
  • POINT EVENT DETECTOR

    5
    0 Votes
    5 Posts
    3k Views
    L
    Hi all, I installed the 1.13.0 to assess it. Looking for the set-up I did't suceed to set the point event detectors, even if I read your answer in this post. Could you provide me more detailed information to do that? On the dashboard there is't something to link a point to a specific point event detector. In fact, I would like to do a simple test, that is receiving data and raiseing an alarm when the received value is higher than a threshold. How can perform this? Thanks in advance for your answer.
  • Get data from website white password

    2
    0 Votes
    2 Posts
    1k Views
    S
    i need to get information from a webserver, the problem is the user and password.. In firefox i can use http://user:pass@192.168.10.10/info but this is not working in Mango.. Any tip?
  • Custom function definitions for server-side script components

    2
    0 Votes
    2 Posts
    2k Views
    M
    Dear All, this is a followup on [url=http://mango.serotoninsoftware.com/forum/posts/list/1070.page]this post. I want to explore the capabilities of Rhino JavaScript inside the server-side script' components under graphical views'. I already did a little bit of JavaScript within a `Meta data source'. I found out [url=http://mango.serotoninsoftware.com/forum/posts/list/206.page#907]here that one can define convenience functions to the "/WEB-INF/scripts/scriptFunctions.js" file. That works nicely after a restart for the Meta data sources. Now I wonder how I can make these function definitions available for the mentioned server-side script components under Graphical views. Thanks and Kind Regards, Michael Bach
  • [SOLVED] Mango logs value only when it changes

    4
    0 Votes
    4 Posts
    3k Views
    M
    Ah, thanks for clearing that up. Using that point (pun intended) of view, it makes perfect sense.
  • Custom graphical views best practice

    2
    0 Votes
    2 Posts
    2k Views
    M
    Dear Mango Team, I need to create aggregate daily, weekly and monthly reports. I already got reports using cron patterns to work as expected. What I need though, is a report that also includes some numerical values for a certain data point, e.g. min, max, average etc. I found that in the Point details' section under Statistics'. I would need those statistics for a custom time period such as 00:00:00 to next 00:00:00 instead of "last n time periods". I thought of using a Server-side script' in the Graphical views' section. I already looked into the source, but could not find my way around. Can you give me a hint on where to start? Thanks, Michael Bach Edit: Ok, first off: sorry for all the noise of my post(s). It is a kind of self-helping. I can solve my "problems" shortly after posting here. Maybe they are at least helpful for others. I found a partial solution by using `Data range > Relative to report time > Previous 1 day' to create a report for the last day (00:00:00 to 00:00:00). Additional hints are much appreciated though. For example: Is there a way to exclude the charts from reports, so that only statistics are shown? Is there a way to get the statistics inside the server-side scripts' in the Graphical views' section?
  • Mlohbihler, any suggestion to fix this error ?

    5
    0 Votes
    5 Posts
    3k Views
    M
    Here you go. Attachment: download link
  • Conversion from version 1.13.0 to 1.13.2

    2
    0 Votes
    2 Posts
    2k Views
    M
    Version 1.13.2 of Mango has not yet been released, but some users have already expressed concern with regard to how long the database update may take. The update this time is particularly onerous, making some significant changes to the pointValues and pointValueAnnotations tables. If your instance uses MySQL and contains upwards of millions of records (a configuration that was specifically tested), you might expect a conversion time of hours. If this downtime is unacceptable, below is an alternative conversion method. This procedure is intended for MySQL, but can be adapted for other databases. Note that it includes two restarts of Mango. During the uptime between restarts, the accumulated history will not be available. Shut down Mango, and apply the 1.13.2 upgrade. Access your MySQL database using the mysql console, or a tool like the MySQL Workbench, and execute the following statements. rename table pointValues to pointValuesSave; rename table pointValueAnnotations to pointValueAnnotationsSave; create table pointValues ( id bigint not null auto_increment, dataPointId int not null, dataType int not null, pointValue double, ts bigint not null, primary key (id) ) engine=MyISAM; create index pointValuesTempIdx1 on pointValues (dataPointId, ts); create table pointValueAnnotations ( pointValueId bigint not null, textPointValueShort varchar(128), textPointValueLong longtext, sourceType smallint, sourceId int, primary key (pointValueId) ) engine=MyISAM; update systemSettings set settingValue='1.13.1' where settingName='databaseSchemaVersion'; This will copy your pointValues tables to new names, and create proxies in their place. These statements should execute quickly. Restart Mango. All history will appear to be gone, but new samples will be stored. Run the following statements: alter table pointValueAnnotationsSave drop foreign key pointValueAnnotationsFk1; alter table pointValueAnnotationsSave ENGINE = MyISAM; alter table pointValueAnnotationsSave add primary key (pointValueId); alter table pointValuesSave drop foreign key pointValuesFk1; drop index pointValuesIdx1 on pointValuesSave; drop index pointValuesIdx2 on pointValuesSave; alter table pointValuesSave ENGINE = MyISAM; create index pointValuesIdx1 on pointValuesSave (dataPointId, ts); These statements will convert the pointValues tables to MyISAM, remove FKs, and keep only necessary indices. They may take a very long time to run. Shut down Mango, and execute the following statements: insert into pointValuesSave (id,dataPointId,dataType,pointValue,ts) select id,dataPointId,dataType,pointValue,ts from pointValues; insert into pointValueAnnotationsSave (pointValueId,textPointValueShort,textPointValueLong,sourceType,sourceId) select pointValueId,textPointValueShort,textPointValueLong,sourceType,sourceId from pointValueAnnotations; drop table pointValues; drop table pointValueAnnotations; rename table pointValuesSave to pointValues; rename table pointValueAnnotationsSave to pointValueAnnotations; These statements will copy all of the newly collected data into the old tables, and then rename the tables back to their original names. These should run quickly, depending on how much new data has been collected into the proxy tables. Restart Mango. The database upgrade is now complete. All history should again be available. Note that application features that depend upon history data should be disabled, such as the PTCP publisher data sync.
  • Issue with "200 OK" http receiver epilogue

    6
    0 Votes
    6 Posts
    3k Views
    M
    Unfortunately, there is nothing conditional about the prologue/epilogue besides being there or not. It is a solution that covered requirements known at the time. I suggest looking into M2M2, in particular making a custom module that will behave exactly as you need, based upon the existing HTTP module.
  • Alarm events

    4
    0 Votes
    4 Posts
    3k Views
    S
    Hey Matthew, Long time... how's things? That's a real shame, the beauty of the individual accounts and web access is the independant nature of things... Just wasn't right, logging on whilst i knew there was an active alarm present but the event logger says no, because another operator ack it. Not a problem in a single instance, viewing platform, even if it is VNC'd, but clearly is in a multi login web environment :-/
  • HTTP Image flipbook not working

    6
    0 Votes
    6 Posts
    2k Views
    T
    @mlohbihler said: There is a bug. Will be fixed in next release. Thanks, did you have any estimated release date for the next version? Thank you.
  • Data point backup

    5
    0 Votes
    5 Posts
    3k Views
    D
    It wasn’t long ago that having the right assets to compete in the world of business meant having to spend vast sums of money on traditional IT solutions. Thanks, [url=http://cableorganizer.com/cableties-wrap-clips/cable-ties.htm]Cable ties
  • Mango to MS Sql Server 2008

    11
    0 Votes
    11 Posts
    5k Views
    M
    I can't really help you with that.
  • 0 Votes
    2 Posts
    2k Views
    D
    This is the Error I am receiving. 'Mitsubishi City Line': Function is not unicast, broadcast, or forward (0xa, 0xb, or 0x4). 'Mitsubishi City Line': is the Bacnet datapoint. I never had this error before just wondering what this means? Any idea let me know. I am running mango 1.13.0. Dominic
  • About the encoding

    5
    0 Votes
    5 Posts
    3k Views
    C
    Hi I check the databases,i find the datasource of point name is not write to databases, and i check the program,do not find any point name file, which file is the point name writed in? thanks xin
  • Problems with Email Event Handler

    8
    0 Votes
    8 Posts
    4k Views
    L
    Hello I´m trying to configure the email settings, but I got the same error: Failed to send email titled "Mango test email" to "[mymail]@gmail.com". Message: "Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587; nested exception is: java.net.ConnectException: Connection refused: connect" host: smtp.gmail.com port: 587 user autorization username=myemail password=mypassword enable TLS Any suggestion? thanks in advance
  • Export data to mrtg or snmp

    5
    0 Votes
    5 Posts
    2k Views
    C
    mango can store data in mysql, derby or mssql database. derby can be setup as network instance so other programs can query. while mango does use blobs to store some objects, you can cut and paste the code for turning the blob back into an object pretty easily. if you want to write a JSP which displays some data for easy parsing look up the custom JSP function - I haven't done this so I don't know the specifics. the data publisher surely must be adaptable to your needs? @wuciwug said: modbus slave wouldn't help. incoming http would work and I can write the jsp, but what do I query, I thought mango had a propitiatory data base?
  • Nmea listener baud rate

    3
    0 Votes
    3 Posts
    3k Views
    Z
    Much of the code changes we have already submitted to Mango. We developed a few protocols (DNP3 IP and serial, IEC 101 IP and serial, an OPC client protocol (which has been under constant upgrading), ASCII text and serial reader), plus we implemented an API based on Web Services API so one can develop programs just by referencing the WSDL, plus Portuguese translation. http://www.monclerjacketsjp.com/
  • Monitoring bursts

    5
    0 Votes
    5 Posts
    4k Views
    O
    @bartdeboeck said: Thanks for replying. I probably have to add time information to the uploaded data as the time of measurement is unrelated to the time of submission to mango? thanks Bart Do you need real timestamp from device than delivery timestamp? It is this example. HTTP request from device with id unit1 :``` http://some.mango.xx/httpds?__time=yyyyMMddHHmmss&unit1_reset=0&unit1_version=2.0 I use HTTP protocol in Mango for monitoring drilling machine with GPRS unit. You can see it on: http://kraken.alarex.net:8080/mango_alarex/public_view.htm?viewId=3 Oja
  • Downloading Data Points

    4
    0 Votes
    4 Posts
    3k Views
    C
    You have to set up a scheduled report which send the data via email, then this script checks the e-mail and saves the attached CSV file. It has been working well for me. #!/usr/bin/perl -w # # v1.0 February 2009-August 14th 2009. # # The purpose of this script is to save attachments from emails to an FTP server. # # The targeted attachments are plain text comma separated value (CSV) files. They # are generated by (mango). The subject of the message must match # a format specified in the script. The messages are removed from the POP3 server. # # The script removes some columns and does some quoting and escaping on the data # to make more robust CSV files (ie can handle a , in the data as well as ") # # The script reformats the dates as per the requested format. # # The CSV files are saved locally in localDataDir as well as FTP'd to 2 servers. # An error email is generated if there aren't the correct number and intervals # of data. 15 minute data is expected. ################################################################################ use strict; use Net::FTP; use Mail::POP3Client; use MIME::Parser; use Time::Local; use MIME::Lite; use Text::CSV_XS; # define login credentials for POP3 server to retrieve email from my $pop3Username = ''; my $pop3Password = ""; my $pop3Server = ""; # first FTP server to send CSV files to my $ftpServer = ""; my $ftpPassword = ""; my $ftpUsername = ""; my $ftpDir = "Data"; # second FTP server to send files to my $ftpServer2 = ""; my $ftpPassword2 = ""; my $ftpUsername2 = ""; my $ftpDir2 = ""; # a writeable directory in which to store temporary files my $temp_dir = "/usr/home/foo"; # a writeable directory in which to store a copy of the data that is FTPd my $localDataDir = "/usr/home/foo"; ################################################################################ ################################################################################ ################################################################################ my @csvFile; my $fh; my @tempFiles; my @outFiles; my @wiers; my $time = timelocal( localtime() ); my $error = 0; my $error_text = ""; print "Content-type: text/html\n\n"; &log("Running Email to FTP script\n"); my $pop = new Mail::POP3Client( USER => $pop3Username, PASSWORD => $pop3Password, HOST => $pop3Server ); my $message = $pop->Message(); if ( !$pop->Alive() ) { $error = 1; &log("Error connecting to POP server $pop3Server\n"); &exitLog( $message . "\n" ); } my $emails = $pop->Count(); &log("Have $emails emails to process\n"); for ( my $i = 1 ; $i <= $emails ; $i++ ) { foreach ( my $header = $pop->Head($i) ) { chomp($header); $header =~ /Subject:\s+(.*)/; my $subject = $1; chomp($subject); $subject =~ s/(\r|\n)//g; if ( # $header =~ /From:(.*)scada/ && $header =~ /Subject: (.*) Published FTP Data/ ) { my $wier = $1; $wier =~ s/^\s+//g; $wier =~ s/\/s+$//g; chomp($wier); my $tempFileName = $temp_dir . $time . "-" . $i; open( $fh, ">$tempFileName" ) or &errorlog("Can't open temp file $tempFileName for saving pop3 mail message body: $!\n "); $pop->RetrieveToFile( $fh, $i ); close $fh; push( @tempFiles, $tempFileName ); push( @wiers, "$wier" ); &log("Matched email $i subject $subject. Saved message for $wier\n"); # delete message from server since we have saved it to temp file $pop->Delete($i); } else { &log( "leaving non matching message " . $subject . "\n" ); } } } $pop->Close(); # ok now we have retrieved file which is a multipart mime mess. foreach my $tempFile (@tempFiles) { my $wier = shift @wiers; if ( $wier !~ /\w+/ ) { $wier = "defaultSource"; $error = 1; &log("ERROR: unable to parse report name from subject. Using default\n" ); } my $mp = new MIME::Parser; $mp->tmp_to_core(1); $mp->output_to_core(1); my $fh2; open( $fh2, "$tempFile" ) or &errorLog("Couldn't open saved email message $tempFile , $!\n"); $mp->output_dir($temp_dir); my $entity = $mp->parse($fh2); #$entity->dump_skeleton(); foreach my $part ( $entity->parts ) { my $head = $part->head; my $type = $head->mime_type; my $filename = $head->recommended_filename; if ( $type eq "text/csv" ) { if ( !$part->bodyhandle ) { &errorLog("ERROR: unable to get MIME bodyhandle for CSV content-part\n"); next; } if ( $filename =~ /Events\.csv$/ ) { &log("Skipping events file $filename\n"); next; } @csvFile = $part->bodyhandle->as_lines; &log( "processing file \"$filename\", has " . ( $#csvFile + 1) . " lines.\n" ); # now have an array of arrays(which are the lines in the csv file) # want to leave some columns out, which have the heading "annotation" my @keepFields; if (defined($csvFile[0])) { # this is the first line in the csv file which is the heading. my @fields = split( ",", $csvFile[0] ); my $fieldNo = 0; foreach my $field (@fields) { if ($field !~ /Annotation/) { #this is a column we want to keep push(@keepFields, $fieldNo); #&log("keeping column $fieldNo $field\n"); } $fieldNo++; } } #my $csv = Text::CSV_XS->new (); # create a new object my $csv = Text::CSV_XS->new ({allow_loose_quotes => 1, escape_char => "\\"}); # create a new object my @newCsvFile; my $lastMinute=""; my $thisMinute=""; my $lastInterval=""; my $lineNo = 0; foreach my $line (@csvFile) { $line =~ s/(\r|\n)//g; # strip new lines my $status = $csv->parse($line); # parse a CSV string into fields my @fields = $csv->fields(); # get the parsed fields # files come with wrong dateformat. change it to as requested. # comes as "yyyy/MM/dd HH:mm:ss" # change to "yyyyMMdd HHmmss" # just parse out / and : if (!defined($fields[0])) { &errorLog("undefined date field. csv parse status was $status. skipping rest of file."); &errorLog("data: parsed $fields[0] from $line\n"); last; # skip the rest of this file. } my $newdate = $fields[0]; if ($lineNo > 0 && $filename !~ /UserComments\.csv$/ ) { # on rows other than the header, make sure that this interval is 15 minutes ahead of the last one $newdate =~ /\d+\/\d+\/\d+\s+\d+:(\d+):\d+/; $thisMinute = $1; my $dateOK = 0; if ($lastMinute ne "" ) { # not the first time through the loop. if ($lastMinute eq "00" && $thisMinute eq "15") { $dateOK = 1; } if ($lastMinute eq "15" && $thisMinute eq "30") { $dateOK = 1; } if ($lastMinute eq "30" && $thisMinute eq "45") { $dateOK = 1; } if ($lastMinute eq "45" && $thisMinute eq "00") { $dateOK =1; } if ($dateOK != 1) { &missingInterval($lastInterval, $newdate, $lineNo); } } $lastMinute = "$thisMinute"; $lastInterval = "$newdate"; } $newdate =~ s/\///g; $newdate =~ s/://g; $fields[0] = $newdate; my @columns; push(@columns, $fields[0]); for (my $x = 1; $x <= $#keepFields; $x++) { push(@columns, $fields[$keepFields[$x]]); } $status = $csv->combine (@columns); # combine columns into a string my $csvLine = $csv->string (); # get the combined string push(@newCsvFile, $csvLine . "\n"); $lineNo++; } if ( defined($newCsvFile[1]) ) { my @fields = split( ",", $newCsvFile[1] ); my $firstFileDate = $fields[0]; #&log("Have $firstFileDate as date from $newCsvFile[1]\n"); # remove leading spaces just in case, then remove all numbers (the time) after a space $firstFileDate =~ s/\"//g; $firstFileDate =~ s/^\s+//g; $firstFileDate =~ s/ \d+//g; &validate(@newCsvFile); my $outFileName; if ( $filename =~ /UserComments\.csv$/ ) { #this is a user comments file $outFileName = $wier . "-UserComments-$firstFileDate.csv"; } else { # it isn't an events file as we skipped those, so it must be wier data $outFileName = $wier . "-" . $firstFileDate . ".csv"; if ( $#newCsvFile != 96 ) { &errorLog("$outFileName had $#newCsvFile rows instead of 96.\n"); } } $outFileName = $localDataDir . $outFileName; my $ofh; open( $ofh, ">" . $outFileName ) or &exitLog("Couln't open $localDataDir/$outFileName for writing: $!\n" ); print $ofh @newCsvFile; close $ofh; push( @outFiles, $outFileName ); &log("wrote csv file $outFileName successfully.\n"); } else { if ( $filename !~ /UserComments\.csv$/ ) { &errorLog("skipping csv file with less than 2 lines ($#newCsvFile): $filename\n"); } } # end if more than 1 lines in CSV file } # end if type was csv } # end for mime part unlink($tempFile); } # next tempfile (email message) if (@outFiles > 0) { if ($error == 0) { # ok now ftp the files away. my $ftp = Net::FTP->new( $ftpServer, Debug => 0 ) or &exitLog("Cannot connect to $ftpServer: $@"); $ftp->login( $ftpUsername, $ftpPassword ) or &exitLog( "Cannot login to FTP " . $ftp->message ); $ftp->cwd($ftpDir); foreach my $outFile (@outFiles) { my $remoteFileSize = $ftp->size($outFile); if ( defined($remoteFileSize) ) { if ( $remoteFileSize > 0 ) { # file exists, let's assume we are replacing it and delete the old one $ftp->delete($outFile); &log("file exists on FTP, deleting the old $outFile\n"); } } if ( $ftp->put("$outFile") ) { &log("uploaded $outFile to $ftpServer.\n"); } } $ftp->quit(); } # do for mirror regardless of error. # ok now ftp the files away. my $ftp2 = Net::FTP->new( $ftpServer2, Debug => 0 ) or &exitLog("Cannot connect to $ftpServer2: $@"); $ftp2->login( $ftpUsername2, $ftpPassword2 ) or &exitLog( "Cannot login to FTP " . $ftp2->message ); $ftp2->cwd($ftpDir2); foreach my $outFile (@outFiles) { my $remoteFileSize = $ftp2->size($outFile); if ( defined($remoteFileSize) ) { if ( $remoteFileSize > 0 ) { # file exists, let's assume we are replacing it and delete the old one $ftp2->delete($outFile); &log("file exists on FTP, deleting the old $outFile\n"); } } if ( $ftp2->put("$outFile") ) { &log("uploaded $outFile to $ftpServer2.\n"); } } $ftp2->quit(); } if ($error) { &exitLog("Script completed but with errors. Data NOT uploaded FTP2.\n"); } sub log { my $logText = shift; my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); $year += 1900; $mon++; if ( $sec < 10) { $sec = "0" . $sec; } if ( $min < 10) { $min = "0" . $min; } if ( $hour < 10) { $hour = "0" . $hour; } if ( $mday < 10) { $mday = "0" . $mday; } if ( $mon < 10) { $mon = "0" . $mon; } my $logTime = $year . "-" . $mon . "-$mday $hour:$min:$sec "; # open(FH, ">>" . $submissionPath . "submissionLog.txt") or warn "couldn't open logfile in $submissionPath: $!\n" ;# print $logTime . $logText ; $error_text .= $logTime . $logText ; # close FH; } sub errorLog { my $errText = shift; # set global error flag. $error = 1; &log("ERROR: " . $errText); } sub exitLog { my $reason = shift; &log($reason); # send an email! MIME::Lite->send( 'smtp', $pop3Server, Timeout => 60, AuthUser => $pop3Username, AuthPass => $pop3Password ); my $msg = MIME::Lite->new( From => 'foo@bar.com', To => 'foo@bar.com', # Cc =>'foo@bar.com', Subject => ' data FTP script error', Data => "This email is automatically generated by the script which uploads the data to the FTP server daily. It is only meant to be sent if there was a problem. You may have to manually upload the data!\n\n\n$error_text" ); $msg->send(); print $error_text; exit; } sub missingInterval { my $lastInterval = shift; my $thisInterval = shift; my $lineNo = shift; &log("Missing or incorrect interval at line # $lineNo : $lastInterval, $thisInterval\n"); $error =1; }