2 #Copyright (C) 2009 Gabes Jean, naparuba@gmail.com
4 #This file is part of Shinken.
6 #Shinken is free software: you can redistribute it and/or modify
7 #it under the terms of the GNU Affero General Public License as published by
8 #the Free Software Foundation, either version 3 of the License, or
9 #(at your option) any later version.
11 #Shinken is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #GNU Affero General Public License for more details.
16 #You should have received a copy of the GNU Affero General Public License
17 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
20 #This Class is a plugin for the Shinken Broker. It is in charge
21 #to brok log into the syslog
27 #This text is print at the import
28 print "I am simple syslog Broker"
34 'phases' : ['running'],
38 #called by the plugin manager to get a broker
39 def get_instance(plugin
):
40 print "Get a Syslog broker for plugin %s" % plugin
.get_name()
44 instance
= Syslog_broker(plugin
.get_name())
49 #Class for the Merlindb Broker
50 #Get broks and puts them in merlin database
52 def __init__(self
, name
):
56 #Called by Broker so we can do init stuff
57 #TODO : add conf param to get pass with init
61 #self.q = self.properties['to_queue']
68 #Get a brok, parse it, and put in in database
69 #We call functions like manage_ TYPEOFBROK _brok that return us queries
70 def manage_brok(self
, b
):
72 manager
= 'manage_'+type+'_brok'
73 if hasattr(self
, manager
):
74 f
= getattr(self
, manager
)
78 #A service check have just arrived, we UPDATE data info with this
79 def manage_log_brok(self
, b
):
81 syslog
.syslog(data
['log'].encode('UTF-8'))
86 # b = self.q.get() # can block here :)