Ad Widget

Collapse

Can't get zabcon to work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gloover79
    Junior Member
    • Nov 2009
    • 11

    #1

    Can't get zabcon to work

    Hello,

    I can't get zabcon revision 172 to work.
    I've compiled ruby 1.9.1 from source, updated rubygems to 1.3.6 and installed all required packages.
    When I run zabcon, it gives the following errors and then stops.

    Code:
    /tmp/zabcon # ./zabcon
    /tmp/zabcon/libs/printer.rb:93: warning: else without rescue is useless
    ./zabcon:33:in `require': /tmp/zabcon/libs/printer.rb:85: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' (SyntaxError)
          when "String": retval=item.length
                        ^
    /tmp/zabcon/libs/printer.rb:86: syntax error, unexpected keyword_when, expecting keyword_end
          when "Fixnum": retval=item.to_s.length
              ^
    /tmp/zabcon/libs/printer.rb:86: syntax error, unexpected ':', expecting keyword_end
          when "Fixnum": retval=item.to_s.length
                        ^
    /tmp/zabcon/libs/printer.rb:87: syntax error, unexpected keyword_when, expecting keyword_end
          when "Float": retval=item.to_s.length
              ^
    /tmp/zabcon/libs/printer.rb:87: syntax error, unexpected ':', expecting keyword_end
          when "Float": retval=item.to_s.length
                       ^
    /tmp/zabcon/libs/printer.rb:88: syntax error, unexpected keyword_when, expecting keyword_end
          when "Hash": retval=hash_width(item)
              ^
    /tmp/zabcon/libs/printer.rb:88: syntax error, unexpected ':', expecting keyword_end
          when "Hash": retval=hash_width(item)
                      ^
    /tmp/zabcon/libs/printer.rb:89: syntax error, unexpected keyword_when, expecting keyword_end
          when "Array": retval=array_width(item)
              ^
    /tmp/zabcon/libs/printer.rb:89: syntax error, unexpected ':', expecting keyword_end
          when "Array": retval=array_width(item)
                       ^
    /tmp/zabcon/libs/printer.rb:149: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
            when "Hash": return format_hash_for_print(item)
                        ^
    /tmp/zabcon/libs/printer.rb:150: syntax error, unexpected keyword_else, expecting keyword_end
    /tmp/zabcon/libs/printer.rb:154: syntax error, unexpected keyword_end, expecting $end
            from ./zabcon:33:in `<main>'
    Anyone seen this before or know how to solve this?
    Thanx.
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    can you execute with debug information please?

    zabcon -d8

    In the meantime I'll have a look at the code in question.

    Thanks
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • nelsonab
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2006
      • 1233

      #3
      I've updated the case statements in revision 173. Turns out ruby 1.9 depricated a common syntax in Ruby 1.8 (what I use to develop Zabcon).

      No need to run with debug information, however if you have another error it may be useful to have level 6 debug.

      At the moment I am working on having the ability to add new items using Zabcon. Turns out there is a fair bit of bounds/error/input checking required to make it happen for all 7 item types. :-)
      RHCE, author of zbxapi
      Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
      Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

      Comment

      • bashman
        Senior Member
        • Dec 2009
        • 432

        #4
        Hi nelsonab,

        I have this output when I run ruby zabcon revision 183 2010-04-21:

        Code:
        /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- readline (LoadError)
                from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
                from ./libs/input.rb:25
                from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
                from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
                from zabcon:35
        I have ruby version for red hat 5:

        Code:
        ruby --version
        ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]
        Zlibs version:

        Code:
        zlibs-1.2.5
        ruby-zlib-0.6.0
        Ruby gem version:

        Code:
        gem --version
        1.3.7
        Packages version:

        Code:
        json-1.4.3
        parseconfig-0.5.2
        highline-1.5.2
        Anybody know how to solve this?
        978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

        Comment

        • richlv
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Oct 2005
          • 3112

          #5
          Code:
          gem install readline
          or similar.
          Zabbix 3.0 Network Monitoring book

          Comment

          • bashman
            Senior Member
            • Dec 2009
            • 432

            #6
            Thanks for your reply

            Code:
            ERROR:  Could not find a valid gem 'readline' (>= 0) in any repository
            978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

            Comment

            • richlv
              Senior Member
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • Oct 2005
              • 3112

              #7
              well, duh - read the dependencies file

              Code:
              gem install highline
              Zabbix 3.0 Network Monitoring book

              Comment

              • bashman
                Senior Member
                • Dec 2009
                • 432

                #8
                Thanks for your help, I read it all ready but I will give it another look.
                978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

                Comment

                • bashman
                  Senior Member
                  • Dec 2009
                  • 432

                  #9
                  I changed line 816 and 817 from zabcon/zabbixapi.rb to:

                  Code:
                  zbx_api = ZbxAPI.new(http://x.x.x.x/zabbix)
                  zbx_api.login('admin','zabbix')
                  And zabcon.conf.default:

                  Code:
                  server=http://x.x.x.x/zabbix
                  username=admin
                  password=zabbix
                  lines=24
                  debug=0
                  language=english
                  But running ruby zabcon, I get this error message:

                  Code:
                  /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': ./zabbixapi.rb:817: no .<digit> floating literal anymore; put 0 before dot (SyntaxError)
                  zbx_api = ZbxAPI.new(http://x.x.x.x/zabbix)
                                                     ^
                  ./zabbixapi.rb:817: syntax error, unexpected tFLOAT
                  zbx_api = ZbxAPI.new(http://x.x.x.x/zabbix)
                                                           ^
                  ./zabbixapi.rb:817: syntax error, unexpected ')', expecting kEND        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
                          from ./libs/zbxcliserver.rb:25
                          from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
                          from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
                          from zabcon:32
                  Has anyone seen this before or knows how to solve this?

                  Thanks
                  978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

                  Comment

                  • richlv
                    Senior Member
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Oct 2005
                    • 3112

                    #10
                    hmm. it looks like we will need nelsonab here
                    Zabbix 3.0 Network Monitoring book

                    Comment

                    • nelsonab
                      Senior Member
                      Zabbix Certified SpecialistZabbix Certified Professional
                      • Sep 2006
                      • 1233

                      #11
                      Hmm, that's an odd error. There's a lot on my plate at the moment. I'll try and get some time later and see if I can reproduce it.
                      RHCE, author of zbxapi
                      Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                      Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                      Comment

                      • bashman
                        Senior Member
                        • Dec 2009
                        • 432

                        #12
                        Thanks nelsonab for giving it a try. Take your time, and if you see anything please tell me.
                        978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

                        Comment

                        • nelsonab
                          Senior Member
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • Sep 2006
                          • 1233

                          #13
                          Sorry for the delay, work has been busy.

                          Ok it looks like you've made a syntax error in your code change.

                          I should ask why you felt making the change was needed? It looks like your config file is appropriate.
                          RHCE, author of zbxapi
                          Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                          Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                          Comment

                          • bashman
                            Senior Member
                            • Dec 2009
                            • 432

                            #14
                            I made the change because I want to use zabcon in a remote host instead of working on localhost Zabbix Server.
                            978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

                            Comment

                            • nelsonab
                              Senior Member
                              Zabbix Certified SpecialistZabbix Certified Professional
                              • Sep 2006
                              • 1233

                              #15
                              Understandable, you only need to change it in the config file, "zabcon.conf".

                              I think there is a statement to connect to local host in a unit test which is never called by the user. I should probably comment this appropriately.
                              RHCE, author of zbxapi
                              Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                              Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                              Comment

                              Working...