/usr/bin/shinken-receiver is in shinken-common 2.0.3-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #! /usr/bin/python
# Copyright (C) 2009-2011:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Shinken is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.
'''
This class is an interface for the Receiver
The receiver listens to the Arbiter for the configuration sent through
the given port as first argument.
The configuration sent by the arbiter specifies from which schedulers
the receiver will take broks.
When the receiver is already launched and has its own conf, it keeps on
listening the arbiter (one a timeout)
In case the arbiter has a new conf to send, the receiver forget its old
schedulers (and their associated broks) and take the new ones instead.
'''
import os
import sys
import optparse
try:
from shinken.bin import VERSION
import shinken
except ImportError:
# If importing shinken fails, try to load from current directory
# or parent directory to support running without installation.
# Submodules will then be loaded from there, too.
import imp
imp.load_module('shinken', *imp.find_module('shinken', [os.path.realpath("."), os.path.realpath(".."), os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "..")]))
import shinken
# Ok we should add the shinken root directory to our sys.path so our sons
# will be able to use the shinken import without problems
shinken_root_path = os.path.dirname(os.path.dirname(shinken.__file__))
os.environ['PYTHONPATH'] = os.path.join(os.environ.get('PYTHONPATH', ''), shinken_root_path)
from shinken.daemons.receiverdaemon import Receiver
from shinken.bin import VERSION
parser = optparse.OptionParser(
"%prog [options]", version="%prog " + VERSION)
parser.add_option('-c', '--config',
dest="config_file", metavar="INI-CONFIG-FILE",
help='Config file')
parser.add_option('-d', '--daemon', action='store_true',
dest="is_daemon",
help="Run in daemon mode")
parser.add_option('-r', '--replace', action='store_true',
dest="do_replace",
help="Replace previous running receiver")
parser.add_option('--debugfile', dest='debug_file',
help=("Debug file. Default: not used "
"(why debug a bug free program? :) )"))
opts, args = parser.parse_args()
if args:
parser.error("Does not accept any argument.")
# Protect for windows multiprocessing that will RELAUNCH all
if __name__ == '__main__':
daemon = Receiver(debug=opts.debug_file is not None, **opts.__dict__)
daemon.main()
|