Fix : get back LiveStatus as default.
[shinken.git] / shinken / modules / syslog_broker.py
blob73e49608793c29686c4c4bc226c6318d5c990de3
1 #!/usr/bin/python
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
23 import syslog
25 from shinken.basemodule import BaseModule
27 #This text is print at the import
28 print "I am simple syslog Broker"
31 properties = {
32 'type' : 'syslog',
33 'external' : False,
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()
42 #Catch errors
43 #path = plugin.path
44 instance = Syslog_broker(plugin)
45 return instance
49 #Class for the Merlindb Broker
50 #Get broks and puts them in merlin database
51 class Syslog_broker(BaseModule):
52 def __init__(self, modconf):
53 BaseModule.__init__(self, modconf)
55 #A service check have just arrived, we UPDATE data info with this
56 def manage_log_brok(self, b):
57 data = b.data
58 syslog.syslog(data['log'].encode('UTF-8'))