• Recent
    • Tags
    • Popular
    • Register
    • Login

    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

    How to change the http sending value parameter

    User help
    3
    78
    33.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • phildunlapP
      phildunlap
      last edited by

      Hmm.

      Before working on a workaround for the same milliseconds, let's try to confirm that's actually occurring (but maybe this would be the workaround). One thing you could try is putting a couple manual offsets in the point links' times, like:

      TIMESTAMP = source.time+1; //one millisecond later than the source's TS
      //you could use +2 on another one, and so on
      

      It's possible on startup it registered a COV notification, got that point values (everything would have different timestamps), but for some reason reverted to polling those points. In which case, all new values would have the timestamp of the poll.

      1 Reply Last reply Reply Quote 0
      • J
        jmatos
        last edited by jmatos

        Hi Phil,

        Where do I put it? Sorry but I can figure it out. Probably because I have 1800 point links... I'm lost here. :-(

        As instructed previously by you I put a Global script

        function getPrefix() { /*So that you may change the prefix for all scripts later if required */
            return "4";
        }
        

        this is running on all point links. Is any way to add the time code here? Or am I confused? (its not the first time :D )

        thank you

        1 Reply Last reply Reply Quote 0
        • phildunlapP
          phildunlap
          last edited by phildunlap

          Wow 1800! Are they all to the same target point? At a certain number we may want to rethink the general tactic of wedging lots of points' alarms out one point. But, if it works, ok.

          Off hand I can't think of a way to do what I was describing in the global script, but here's a python script to mass modify your point links. You probably want to keep a JSON backup of them, in case you wish to revert.

          import json
          
          configFile = open("/path/to/Mango/backup/Mango-Configuration.json")
          config = json.load( configFile )
          configFile.close()
          
          x = 0
          for pl in config["pointLinks"] :
            if pl["script"] != "" :
              pl["script"] = "TIMESTAMP=source.time+" + str(x) + ";\\n" + pl["script"]
              x += 1
          
          outputFile = open("/path/to/output.json", "w+")
          outputFile.write( json.dumps( {"pointLinks": config["pointLinks"]}, indent=4, sort_keys=False, separators=(",",": ") )
          outputFile.close()
          
          J 1 Reply Last reply Reply Quote 0
          • J
            jmatos
            last edited by

            I'm hopping to test the first code in six or 8 link points. That I can do one by one... ;-)

            Thanks in advance for the second code.

            I'll feedback to you.

            Cheers

            1 Reply Last reply Reply Quote 0
            • J
              jmatos @phildunlap
              last edited by

              @phildunlap said in How to change the http sending value parameter:

              Wow 1800! Are they all to the same target point? At a certain number we may want to rethink the general tactic of wedging lots of points' alarms out one point. But, if it works, ok.

              Off hand I can't think of a way to do what I was describing in the global script, but here's a python script to mass modify your point links. You probably want to keep a JSON backup of them, in case you wish to revert.

              import json
              
              configFile = open("/path/to/Mango/backup/Mango-Configuration.json")
              config = json.load( configFile )
              configFile.close()
              
              x = 0
              for pl in config["pointLinks"] :
                if pl["script"] != "" :
                  pl["script"] = "TIMESTAMP=source.time+" + str(x) + ";\\n" + pl["script"]
                  x += 1
              
              outputFile = open("/path/to/output.json", "w+")
              outputFile.write( json.dumps( {"pointLinks": config["pointLinks"]}, indent=4, sort_keys=False, separators=(",",": ")
              outputFile.close()
              

              Sorry. I get an invalid syntax at outputFile.close()

              1 Reply Last reply Reply Quote 0
              • phildunlapP
                phildunlap
                last edited by

                Whoops. Looks like there was a missing parenthesis. Fixed.

                J 1 Reply Last reply Reply Quote 0
                • J
                  jmatos @phildunlap
                  last edited by

                  @phildunlap said in How to change the http sending value parameter:

                  Whoops. Looks like there was a missing parenthesis. Fixed.

                  As the syntax error persists I try one more missed parenthesis. Your answer and Notepad++ made me see that conclusion. So 2 added.

                  outputFile.write( json.dumps( {"pointLinks": config["pointLinks"]}, indent=4, sort_keys=False, separators=(",",": ") ) )
                  

                  Thank you

                  1 Reply Last reply Reply Quote 0
                  • phildunlapP
                    phildunlap
                    last edited by

                    Oof, sorry. I've convinced myself I can write these little python things and not test them, but I really should have the preamble and output copied in so I can't do little things like that!

                    1 Reply Last reply Reply Quote 0
                    • J
                      jmatos
                      last edited by

                      Hi Phil,

                      I'm not figure it out... the code

                      TIMESTAMP = source.time+1; //one millisecond later than the source's TS
                      //you could use +2 on another one, and so on
                      

                      Adds only a timestamp or in fact inserts a delay? Or both?

                      Thank you

                      1 Reply Last reply Reply Quote 0
                      • phildunlapP
                        phildunlap
                        last edited by phildunlap

                        The idea was to alter the timestamp set to the almnr point by some number of milliseconds into the future. They are varied because using the NoSQL database you cannot have two values at the same millisecond, and if these point links are triggered by one data source's polling (or just multiple points on some of the data sources), there's a high probability there are duplicate timestamps on the target point.

                        I'm not sure that's going to solve the issue you're describing, but it was something to try.

                        Edit: no delay should have been inserted.

                        Edit again, to explain:
                        TIMESTAMP is a variable name checked after the script returns its value, and if defined it is used as the timestamp for the value on the point set by the point link (or also the value assigned to a meta point, in that case)

                        1 Reply Last reply Reply Quote 0
                        • J
                          jmatos
                          last edited by

                          Hi Phil,

                          It does not work... :(

                          So I have cross my fingers and do a version upgrade to MANGO 3...

                          Now MANGO's not responding! (snif!). "ERR_CONNECTION_REFUSED" is all I get as browser response. The Webmin is working fine. Is there something else I can try before I restore the Mango directory ?

                          Thank you

                          1 Reply Last reply Reply Quote 0
                          • phildunlapP
                            phildunlap
                            last edited by

                            Hi Jose,

                            I wouldn't expect the issue you're describing to be resolved by upgrading. But, you probably have an error in startup that we could see if you attempted to start Mango manually on the command line.

                            So navigate to Mango/bin and run either ./ma.sh start or ma-start.bat

                            Actually figuring out what's going on in your situation may be too difficult through the forum. I understand the issue to be something like...

                            1. Mango 1 polls a data source
                            2. Many points links set a point on Mango 1 many times.
                            3. The values of that point are published through an HTTP publisher
                            4. The receiving end is not ending up with the same set of data as the sending end, but no errors are being recorded on either Mango

                            There's a lot to explore there.

                            1 Reply Last reply Reply Quote 0
                            • J
                              jmatos
                              last edited by phildunlap

                              here is the result

                              mango@mangoES3249:/opt/mango/bin$sudo ./ma.sh start
                              sudo: unable to resolve host mangoES3249
                              [sudo] password for mango:
                              sudo: ./ma.sh: command not found
                              mango@mangoES3249:/opt/mango/bin$ma.sh start
                              -bash: ma.sh: command not found
                              mango@mangoES3249:/opt/mango/bin$dir
                              ext-available  ext-enabled  h2-web-console.bat  h2-web-console.sh  ma-init.sh  ma.pid  ma-restart.sh  ma.sh  ma-start.bat  ma-start.sh  ma-stop.sh  upgrade.bat  upgrade.sh
                              
                              1 Reply Last reply Reply Quote 0
                              • phildunlapP
                                phildunlap
                                last edited by

                                Try...

                                sudo /opt/mango/bin/ma.sh start

                                sudo su; ./ma.sh start

                                1 Reply Last reply Reply Quote 0
                                • phildunlapP
                                  phildunlap
                                  last edited by phildunlap

                                  It's possible ma.sh isn't executable, do sudo chmod +x /opt/mango/bin/ma.sh

                                  1 Reply Last reply Reply Quote 0
                                  • J
                                    jmatos
                                    last edited by

                                    to all I get the same result:

                                    sudo: unable to resolve host mangoES3249
                                    

                                    unless for

                                    sudo su; ./ma.sh start
                                    

                                    where I get the PuTTY screen again - with the calendar, cpu info, etc. - as when I entered

                                    1 Reply Last reply Reply Quote 0
                                    • phildunlapP
                                      phildunlap
                                      last edited by

                                      You would do the ./ma.sh start after the sudo su scrolls by the login screen again. When you're root@mangoES3249:~

                                      Hmm. That message suggests something is amiss in your /etc/hosts or /etc/hostname file. I bet you've got a line like 127.0.1.1 mangoes in your /etc/hosts file, where you'd want to change it to 127.0.1.1 mangoES3249 then log out and in again. The unable to resolve host message should be gone.

                                      J 1 Reply Last reply Reply Quote 0
                                      • J
                                        jmatos @phildunlap
                                        last edited by

                                        @phildunlap

                                        you have right with the issue 127.0.1.1 mangoes. I fix it but then I get

                                        root@mangoES3249:/opt/mango/bin$./ma.sh start
                                        MA_HOME is /opt/mango
                                        ./ma.sh: line 31: /opt/mango/bin/ma-start.sh: Permission denied
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • phildunlapP
                                          phildunlap
                                          last edited by

                                          sudo chmod +x /opt/mango/bin/*.sh

                                          1 Reply Last reply Reply Quote 0
                                          • J
                                            jmatos
                                            last edited by

                                            It works!!!
                                            What could be wrong?

                                            Thank you very much. I can sleep better this night :)

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post