a3rd / molniya

Automatically exported from code.google.com/p/molniya
GNU General Public License v2.0
0 stars 0 forks source link

nagios_var insufficient for distribution packages (in this case debian/squeeze) #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Install the following packages (and possible dependencies) on debian testing 
(squeeze):
ii  icinga                            1.0.2-1                           
monitoring and host and network monitoring system - metapackage
ii  ruby1.8                           1.8.7.299-1                       
Interpreter of object-oriented scripting language Ruby 1.8
ii  libmetaid-ruby1.8                 1.0-5                             Some 
additional methods to make metaprogramming easier
ii  libxmpp4r-ruby1.8                 0.5-1                             
XMPP/Jabber library for Ruby
ii  libsinatra-ruby1.8                1.0.really1.0-1                   Ruby 
web-development dressed in a DSL
ii  mongrel                           1.1.5-5                           A small 
fast HTTP library and server for Ruby

2. edit config file (btw: var directory for icinga debian package is 
/var/lib/icinga - checked to contain status.dat and rw directory)
3. launch "./molniya -c icinga.yaml"

What is the expected output? What do you see instead?
expected:
Molniya entering stable orbit around Icinga with downlink to xmpp server.

actual output:
./nagios.rb:508:in `load': undefined method `hosts' for nil:NilClass 
(NoMethodError)
        from ./nagios.rb:159:in `_refresh'
        from ./nagios.rb:127:in `refresh_if_needed'
        from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
        from ./nagios.rb:124:in `refresh_if_needed'
        from ./nagios.rb:438:in `refresh_if_needed'
        from ./nagios.rb:164:in `contents'
        from ./molniya.rb:437:in `status_report'
        from ./molniya.rb:599:in `update_status_msg'
        from ./molniya.rb:524:in `initialize'
        from ./molniya.rb:765:in `new'
        from ./molniya.rb:765:in `launch'
        from -e:1

What version of the product are you using? On what operating system?
molniya 0.3 for further info see top.

Please provide any additional information below.
Turns out that the presumption that both 'status.dat' and 'object.cache' live 
both in 'nagios_var' is wrong in case of debian packages (both for nagios3 
_and_ for icinga!). 
I helped myself with an 'ln -s /var/cache/icinga/objects.cache 
/var/lib/icinga/objects.cache'. Though a more flexible solution would be 
preferred.
I'd provide a patch, but I've never touched ruby before, sorry.

Original issue reported on code.google.com by dm8...@gmail.com on 8 Aug 2010 at 6:04

GoogleCodeExporter commented 9 years ago
Index: molniya
===================================================================
--- molniya     (revision 44)
+++ molniya     (working copy)
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh

 ## molniya: a Nagios IM (XMPP) gateway.
 ##
Index: molniya.rb
===================================================================
--- molniya.rb  (revision 44)
+++ molniya.rb  (working copy)
@@ -420,9 +420,10 @@
       @last_mtime = nil
       @sb = sb
       nagios_var = Pathname.new(conf['nagios_var'])
+                       nagios_cache = Pathname.new(conf['nagios_cache'])
       #log "Nagios /var is #{nagios_var}"
-      @config = Nagios::Config.new(nagios_var + 'objects.cache', self)
-      @status = Nagios::Status.new(nagios_var + 'status.dat', self)
+      @config = Nagios::Config.new(nagios_cache + 'objects.cache', self)
+      @status = Nagios::Status.new(nagios_cache + 'status.dat', self)
       @cmd_t = Nagios::CommandTarget.new(nagios_var + 'rw' + 'nagios.cmd')
     end

this patch and using

nagios_var: /var/lib/nagios3/
nagios_cache: /var/cache/nagios3/

in the config.yaml makes things go further for me.

also i can recommend installing rubygems1.8 from backports for lenny to get 
ruby going.

Original comment by g_c...@hyte.de on 30 Sep 2010 at 6:28

GoogleCodeExporter commented 9 years ago
Good catch, and thanks for the patch. I've committed a fix. Sorry for the delay 
in attending to this one!

Original comment by cswhee...@gmail.com on 7 Oct 2010 at 8:55