Hi, i could not reproduce it. Maybe this snippet can help you.
def test_venelin(self): self.print_header() now = time.time() objlist = [] for host in self.sched.hosts: objlist.append([host, 0, 'UP']) for service in self.sched.services: objlist.append([service, 0, 'OK']) self.scheduler_loop(1, objlist) self.update_broker() for service in self.livestatus_broker.services.values(): print "list of customs", service.customs I added it to test_livestatus and i got the custom vars as expected. You should create a test_venelinsmodule.py where you can play around with your module. Start with: ....beginning of file like test_livestatus... ... modconf = Module() modconf.module_name = "livestatus" modconf.module_type = livestatus_broker.properties['type'] modconf.properties = livestatus_broker.properties.copy() class TestConfig(ShinkenTest): def update_broker(self): ids = self.sched.broks.keys() ids.sort() for brok_id in ids: brok = self.sched.broks[brok_id] self.livestatus_broker.manage_brok(brok) self.sched.broks = {} class TestConfigSmall(TestConfig): def setUp(self): self.setup_with_file('etc/nagios_1r_1h_1s.cfg') self.livestatus_broker = Livestatus_broker(modconf, your_own_params.....) self.livestatus_broker.create_queues() self.livestatus_broker.init() self.sched.fill_initial_broks() self.update_broker() and then the test_venelin from above .... Change all the livestatus stuff with your own module's name. The update_broker() routine puts broks to the broker module and calls all the manage_* methods. Gerhard > -----Ursprüngliche Nachricht----- > Von: Venelin Petkov [mailto:petkov.vene...@gmail.com] > Gesendet: Montag, 7. Februar 2011 09:31 > An: shinken-devel@lists.sourceforge.net > Betreff: Re: [Shinken-devel] How to access the configuration > settings in a broker module > > Hi Gerhard, > > Here is exactly what I am doing: > > Excerpt from the conf (I defined custom variables for all 9 > services in this test configuration, just to be sure): > > define service{ > use local-service > hostgroup_name print > service_description cups > check_command check_cups > _udp_template test > _myvar 9 > } > > define service{ > use local-service > hostgroup_name printer > service_description Printer > check_command check_hpjd > _udp_template test > _myvar 10 > } > > Then I am trying the following (eprint is a lambda shortcut for > sys.stderr.write): > > def manage_initial_service_status_brok(self, b): > data = b.data > eprint('customs: '+str(data['customs'])) > > # template = data['customs'].get('_udp_template') > # if template: > # self.template_hash[data['service_description']] = > data['customs']['_udp_template'] > > > I see 'customs' in broker output, but it is empty! Here is a > partial broker output: > > ... > We received modules [<shinken.module.Module object at > 0x2895050>, <shinken.module.Module object at 0x2895150>, > <shinken.module.Module object at 0 > x2895190>, <shinken.module.Module object at 0x2895250>] > I am simple log Broker > I am the nocdmod broker for pnp > I am simple syslog Broker > I am Livestatus Broker > I am Service Perfdata Broker > I am IWR UDP Host Perfdata Broker > I am Host Perfdata Broker > I am IWR UDP Service Perfdata Broker > I am Couchdb Broker > I am Status Dat Broker > I am Generic Merlin Broker > I am Ndo Mysql Broker > I am Ndo Broker for Oracle > Get a Status Dat broker for plugin Status-Dat > {'status_update_interval': '15', 'object_cache_file': > '/home/shinken/src/var/objects.cache', 'customs': {}, 'plus': {}, > 'status_file': '/home/shinken/src/va > r/status.data', 'module_name': 'Status-Dat', 'module_type': > 'status_dat', 'id': 2} > Get a Simple log broker for plugin Simple-log Get a Host > Perfdata broker for plugin IWR-Host-Perfdata Get a Service > Perfdata broker for plugin IWR-Service-Perfdata Load 4 module > instances I am init Starting external process (pid:30310) for > instance Status-Dat > customs: {} > customs: {} > customs: {} > customs: {} > customs: {} > customs: {} > customs: {} > > ... > > customs: {} > customs: {} > customs: {} > Starting external process (pid:30311) for instance Simple-log > I not open the host-perfdata file > '/home/shinken/src/var/iwr-host-perfdata' > [IWR-Service-Perfdata] I open the service-perfdata file > '/home/shinken/src/var/iwr-service-perfdata' > [broker-1] I correctly load the modules : ['Status-Dat', > 'Simple-log', 'IWR-Host-Perfdata', 'IWR-Service-Perfdata'] > [broker-1] New running id for the scheduler scheduler-1 : > 0.877694073146 (was 0) [broker-1] I ask for a broks > generation to the scheduler scheduler-1 [broker-1] Connexion > OK to the scheduler scheduler-1 [broker-1] New running id for > the poller poller-1 : 0.263251106803 (was 0) [broker-1] > Connexion OK to the poller poller-1 [broker-1] New running id > for the reactionner reactionner-1 : > 0.471794279887 (was 0) > [broker-1] Connexion OK to the reactionner reactionner-1 > Begin Loop : manage broks 0 Got a new conf Begin Loop : > manage broks 510 Begin Loop : manage broks 0 Begin Loop : > manage broks 0 Begin Loop : manage broks 0 ... > > > > BTW, this is the 0.5.1 official release, but I am going to > try it with the latest stuff from the repository, to make > sure it is the same. > > Best Regards, > Venelin Petkov > > > > > > > > > On Fri, Feb 4, 2011 at 7:22 PM, Gerhard Lausser > <gerhard.laus...@consol.de> wrote: > > > > > >> need, but somehow the custom variable that I have defined in each > >> service, namely _udp_template, does not appear in > > So if you fill a sevice-dict like in livestatus_broker.py and then > > look at the elements > > > > for svc in service-list.values(): > > print "list of customs", get_customs_keys(svc.customs) > > > > you don't see anything? > > > > Gerhard > > > > > ---------------------------------------------------------------------- > > -------- The modern datacenter depends on network connectivity to > > access resources and provide services. The best practices for > > maximizing a physical server's connectivity to a physical > network are > > well understood - see how these rules translate into the virtual > > world? > > http://p.sf.net/sfu/oracle-sfdevnlfb > > _______________________________________________ > > Shinken-devel mailing list > > Shinken-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/shinken-devel > > > > -------------------------------------------------------------- > ---------------- > The modern datacenter depends on network connectivity to > access resources and provide services. The best practices for > maximizing a physical server's connectivity to a physical > network are well understood - see how these rules translate > into the virtual world? > http://p.sf.net/sfu/oracle-sfdevnlfb > _______________________________________________ > Shinken-devel mailing list > Shinken-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/shinken-devel > ------------------------------------------------------------------------------ The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb _______________________________________________ Shinken-devel mailing list Shinken-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/shinken-devel