View Full Version : Can't get zabcon to work
gloover79
24-03-2010, 08:04
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.
/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
24-03-2010, 12:52
can you execute with debug information please?
zabcon -d8
In the meantime I'll have a look at the code in question.
Thanks
nelsonab
24-03-2010, 13:23
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. :-)
Hi nelsonab,
I have this output when I run ruby zabcon revision 183 2010-04-21:
/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:
ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]
Zlibs version:
zlibs-1.2.5
ruby-zlib-0.6.0
Ruby gem version:
gem --version
1.3.7
Packages version:
json-1.4.3
parseconfig-0.5.2
highline-1.5.2
Anybody know how to solve this?
gem install readline
or similar.
ERROR: Could not find a valid gem 'readline' (>= 0) in any repository
well, duh - read the dependencies file ;)
gem install highline
Thanks for your help, I read it all ready but I will give it another look.
I changed line 816 and 817 from zabcon/zabbixapi.rb to:
zbx_api = ZbxAPI.new(http://x.x.x.x/zabbix)
zbx_api.login('admin','zabbix')
And zabcon.conf.default:
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:
/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
hmm. it looks like we will need nelsonab here ;)
nelsonab
29-06-2010, 17:53
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.
Thanks nelsonab for giving it a try. Take your time, and if you see anything please tell me.
nelsonab
14-07-2010, 18:48
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.
I made the change because I want to use zabcon in a remote host instead of working on localhost Zabbix Server.
nelsonab
15-07-2010, 13:50
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.
Thanks nelsonab, done, but still not working:
ruby zabcon
/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
May be some dependencies missing?
nelsonab
20-07-2010, 13:59
There's a dependencies file. That explains what you need to do to install the requisite dependencies. You may also want to update your svn copy. It will now display a somewhat helpful message about missing dependencies. :-)
Hi nelsonab,
I have this output when I run ruby zabcon revision 183 2010-04-21:
/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:
ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]
Zlibs version:
zlibs-1.2.5
ruby-zlib-0.6.0
Ruby gem version:
gem --version
1.3.7
Packages version:
json-1.4.3
parseconfig-0.5.2
highline-1.5.2
Anybody know how to solve this?
Thanks a lot nelsonab, I read your dependencies file (http://trac.red-tux.net/browser/trunk/ruby/api/dependencies) but I'll try to update my copy.
nelsonab
21-07-2010, 13:41
You are missing the library readline. Which distro are you using? Check to see if there's a readline package, and in addition if there is a readline package for Ruby on your distro. Did you compile Ruby or install it from a package manager? Normally readline is included in Ruby for MS Windows, OpenSuSE and CentOS.
I'm using Red Hat 5.4 and I compiled Ruby.
nelsonab
29-07-2010, 16:04
http://snippets.aktagon.com/snippets/57-Solution-to-require-no-such-file-to-load-readline-LoadError-problem
It looks like you will need to adapt the path in the above link for your environment, but that looks to be the basics on compiling readline. I do most of my dev work on CentOS 5.4 and 5.5 which is essentially the same as RHEL 5.4 and 5.5. I just use the ruby rpm's.