Ad Widget

Collapse

snmp string to float conversion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JoelG
    Member
    • Aug 2007
    • 32

    #31
    1.6.3 Update?

    Any word if the 1.6.3 update handles this situation? Or does a new patch need to be developed (again)?

    Answer to my own question, is that it looks like the patch is not included, but it should be very easy to update. I am not sure as to how soon I will be able to test it though, so will hold off posting my fix until I do.
    Last edited by JoelG; 30-03-2009, 22:49. Reason: Checked the new code myself

    Comment

    • jmb
      Junior Member
      • Jul 2007
      • 14

      #32
      Here we go again. Patch against 1.6.3

      Greets jm
      Attached Files

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #33
        Originally posted by jmb
        Here we go again. Patch against 1.6.3
        What?! I was quite sure there are no issues with processing of string in 1.6.3 anymore.

        I would appreciate if you could describe what the proposed patch is doing? What problem does it fix?
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • Vitaly
          Junior Member
          • Oct 2008
          • 11

          #34
          No, Alexei.
          There is the same issue. The patch fixes it as before.

          Thanks Jmb.
          Last edited by Vitaly; 01-04-2009, 13:39.

          Comment

          • Alexei
            Founder, CEO
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2004
            • 5654

            #35
            Originally posted by Vitaly
            No, Alexei.
            There is the same issue. The patch fixes it as before.
            What issue? Please tell us what exactly does not work. That's what I'd like to hear.
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            • JoelG
              Member
              • Aug 2007
              • 32

              #36
              Possible issue

              Here is the core of the patch - first the test for octet string, then the test for item->value_type of FLOAT, then a string to double conversion (with a little extra debug info):


              Code:
              if (vars->type == ASN_OCTET_STR)
              {
                   /* fix for str to float conversion */
                   if(item->value_type == ITEM_VALUE_TYPE_FLOAT)
                   {
                        vars->val.string[vars->val_len] = NULL; 
              
                        SET_DBL_RESULT(value, strtod((char*)vars->val.string, (char **) NULL));
              					
                        zabbix_log( LOG_LEVEL_DEBUG, "s2f:OID [%s] Type [%d] value [%f]", snmp_oid, vars->type, value->dbl);
                        zabbix_log( LOG_LEVEL_DEBUG, "s2f:val.string [%s]", vars->val.string);
                        zabbix_log( LOG_LEVEL_DEBUG, "s2f:val_len [%d]", vars->val_len);
              					
              }
              My guess as to why this hasn't been supported has always been that a device returning a string that needs to be interpreted as a float is out of spec, but that is a pure guess on my part.

              To recap the problem, the device returns a string, we want/need to store it as a float.

              Comment

              • Alexei
                Founder, CEO
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Sep 2004
                • 5654

                #37
                Originally posted by JoelG
                To recap the problem, the device returns a string, we want/need to store it as a float.
                But this works out of the box in 1.6.3! I still have absolutely no idea why a patch is required.

                Please give me a hint. All I need is a real non-working case.
                Alexei Vladishev
                Creator of Zabbix, Product manager
                New York | Tokyo | Riga
                My Twitter

                Comment

                • Vitaly
                  Junior Member
                  • Oct 2008
                  • 11

                  #38
                  Example:
                  Sensor Humidity
                  Type: SNMPv1 Agent
                  OID: SNMPv2-SMI::enterprises.16174.4.1.16174.1.1.3.3.3.6.0
                  Type: Numeric (float)

                  It does not work without the patch.

                  Comment

                  • Alexei
                    Founder, CEO
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Sep 2004
                    • 5654

                    #39
                    Originally posted by Vitaly
                    Example:
                    Sensor Humidity
                    Type: SNMPv1 Agent
                    OID: SNMPv2-SMI::enterprises.16174.4.1.16174.1.1.3.3.3.6.0
                    Type: Numeric (float)

                    It does not work without the patch.
                    What values does snmpwalk return for this OID?
                    Alexei Vladishev
                    Creator of Zabbix, Product manager
                    New York | Tokyo | Riga
                    My Twitter

                    Comment

                    • Vitaly
                      Junior Member
                      • Oct 2008
                      • 11

                      #40
                      Originally posted by Alexei
                      What values does snmpwalk return for this OID?
                      Where I can see it?

                      Comment

                      • JoelG
                        Member
                        • Aug 2007
                        • 32

                        #41
                        Examples

                        Here is an example from the device I have - a string value that needs to be evaluated as a numeric, specifically as a float to support negative numbers:

                        Code:
                        # snmpwalk -v 1 -c public x.x.x.x SNMPv2-SMI::enterprises.303.3.3.16.2.1.3.29.0
                        SNMPv2-SMI::enterprises.303.3.3.16.2.1.3.29.0 = STRING: "49"
                        # snmpwalk -v 1 -c public x.x.x.x SNMPv2-SMI::enterprises.303.3.3.16.2.1.3.29.0
                        SNMPv2-SMI::enterprises.303.3.3.16.2.1.3.29.0 = STRING: "40"
                        This is no different from the very first post in this thread.

                        Still very much love Zabbix, hope to get this resolved.

                        Comment

                        • Alexei
                          Founder, CEO
                          Zabbix Certified Trainer
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • Sep 2004
                          • 5654

                          #42
                          I see what you mean. It looks like we've found what was wrong in the code. The problem is fixed.

                          I would appreciate if you could download the latest nightly build from www.zabbix.com/developers.php and check if it works fine without any patches now. Please be hurry, we are releasing 1.6.4 today!
                          Alexei Vladishev
                          Creator of Zabbix, Product manager
                          New York | Tokyo | Riga
                          My Twitter

                          Comment

                          • JoelG
                            Member
                            • Aug 2007
                            • 32

                            #43
                            Not a good beta tester

                            I'm sorry, I am not a good candidate for testing patches. I only have access to a full production system, so I usually lag a few days after an official update before I deploy a new version.

                            Hopefully, one of the other users who post to this thread can give your patch a quick try.

                            Comment

                            • Alexei
                              Founder, CEO
                              Zabbix Certified Trainer
                              Zabbix Certified SpecialistZabbix Certified Professional
                              • Sep 2004
                              • 5654

                              #44
                              Anyway Zabbix 1.6.4 is out. Give it a try!
                              Alexei Vladishev
                              Creator of Zabbix, Product manager
                              New York | Tokyo | Riga
                              My Twitter

                              Comment

                              • Vitaly
                                Junior Member
                                • Oct 2008
                                • 11

                                #45
                                Just updated zabbix to v1.6.4 - The same problem.

                                Applied the patch for v.1.6.3 - Works fine.
                                Last edited by Vitaly; 06-04-2009, 15:21.

                                Comment

                                Working...