diff --git a/alignak/MANIFEST.in b/alignak/MANIFEST.in deleted file mode 100644 index a91e619..0000000 --- a/alignak/MANIFEST.in +++ /dev/null @@ -1,17 +0,0 @@ -recursive-include alignak *.* -recursive-include alignak/webui *.* -recursive-include etc * -recursive-include windows .bat .reg -recursive-include bin *.* *-* alignak -recursive-include libexec *.* -recursive-include modules *.* -recursive-include doc *.* -recursive-include cli *.* -recursive-include share *.* -recursive-include inventory *.* -include test *.py *.txt -global-exclude .git *.pyc *.pyo -global-exclude .debug .pid .exe *~ -include var/void_for_git -include MANIFEST.in Changelog -include COPYING THANKS README README.rst diff --git a/alignak/alignak.spec b/alignak/alignak.spec index 978a660..32e3800 100644 --- a/alignak/alignak.spec +++ b/alignak/alignak.spec @@ -21,8 +21,11 @@ Alignak is a new monitoring tool written in Python. The main goal of Alignak is to allow users to have a fully flexible architecture for their monitoring system that can easily scale to large environments. -Alignak also provide interfaces with NDODB and Merlin database, -Livestatus connector Alignak does not include any human interfaces. +Alignak has several extensions to enrich its standard features: + - a full REST backend that allows to store the monitoring configuration and the live state + - a Web User interface to view and edit the monitored objects + - modules to extend the basic monitoring features: external commands, logs, ... + - checks packages to easily set-up new monitoring objects %package all Summary: Alignak Common files diff --git a/alignak/debian/alignak-all.install b/alignak/debian/alignak-all.install index 83726ec..c031d1a 100644 --- a/alignak/debian/alignak-all.install +++ b/alignak/debian/alignak-all.install @@ -1,7 +1,18 @@ -#bin/init.d/alignak* /etc/init.d/ -#etc/default/alignak -etc/daemons/* /etc/alignak/daemons/ -etc/certs/* /etc/alignak/certs/ +# Define files to install: +# from to +# --- + +# systemd files: we use systemd as a default system loader +# comments in this section must be inverted if we do not want to use systemd... +systemd/* /lib/systemd/system/ +#systemV/default/alignak /etc/default/alignak/ +#systemV/init.d/alignak* /etc/init.d/ + +# alignak default configuration files etc/alignak.cfg /etc/alignak/ +etc/alignak.ini /etc/alignak/ etc/arbiter/* /etc/alignak/arbiter -systemd/* /lib/systemd/system/ +etc/daemons/* /etc/alignak/daemons/ +etc/certs/* /etc/alignak/certs/ +# Do not copy the samples files - useful to copy? +#etc/samples /etc/alignak/samples \ No newline at end of file diff --git a/alignak/debian/alignak-all.postinst b/alignak/debian/alignak-all.postinst index 6987764..e432a09 100644 --- a/alignak/debian/alignak-all.postinst +++ b/alignak/debian/alignak-all.postinst @@ -20,9 +20,9 @@ case "$1" in configure) - ## Create user and group - # Note: if the user exists, it's properties won't be changed (gid, home, shell) - adduser --quiet --system --home /var/lib/alignak --no-create-home --group alignak || true + ## Create alignak user and group + # Note: if the user exists, his properties won't be changed (gid, home, shell) + adduser --quiet --system --home /var/lib/alignak --no-create-home --group alignak || true ## Create nagios group addgroup --system nagios || true @@ -43,8 +43,8 @@ case "$1" in fi done - # SysV part if [ -f /etc/default/alignak ]; then + ## System V part sed -e 's:ETC=.*:ETC=/etc/alignak:g' \ -e 's:VAR=.*:VAR=/var/lib/alignak:g' \ -e 's:BIN=.*:BIN=/usr/bin:g' \ @@ -52,7 +52,6 @@ case "$1" in -e 's:LOG=.*:LOG=/var/log/alignak:g' \ -i /etc/default/alignak - ## Ensure alignak starts automatically update-rc.d -f alignak-arbiter defaults > /dev/null update-rc.d -f alignak-scheduler defaults > /dev/null @@ -63,6 +62,7 @@ case "$1" in update-rc.d -f alignak defaults > /dev/null else + ## Systemd part systemctl daemon-reload > /dev/null || : systemctl enable alignak-arbiter > /dev/null || : systemctl enable alignak-scheduler > /dev/null || : @@ -72,6 +72,14 @@ case "$1" in systemctl enable alignak-receiver > /dev/null || : fi + ## Update Alignak configuration paths.cfg + sed -e 's:$ETC$=.*:$ETC$=/etc/alignak:g' \ + -e 's:$VAR$=.*:$VAR$=/var/lib/alignak:g' \ + -e 's:$RUN$=.*:$RUN$=/var/run/alignak:g' \ + -e 's:$LOG$=.*:$LOG$=/var/log/alignak:g' \ + -i /etc/alignak/arbiter/resource.d/paths.cfg + + ## Update Alignak daemons configuration files for inifiles in /etc/alignak/daemons/*.ini; do sed -e 's:workdir=.*:workdir=/var/run/alignak:g' \ -e 's:logdir=.*:logdir=/var/log/alignak:g' \ diff --git a/alignak/debian/copyright b/alignak/debian/copyright index 6cb0230..33e45bf 100644 --- a/alignak/debian/copyright +++ b/alignak/debian/copyright @@ -5,7 +5,7 @@ Source: https://alignak-monitoring.github.io/ Files: * Copyright: - 2015-2015 Alignak team + 2015-2017 Alignak team 2009-2014 Shinken team Please see THANKS and AUTHORS for full list of contributors License: AGPL-3.0+ @@ -13,7 +13,7 @@ License: AGPL-3.0+ Files: debian/* -Copyright: 2015 Sebastien Coavoux +Copyright: 2015-2017 Sebastien Coavoux License: GPL-2 diff --git a/alignak/for_freebsd/alignak-arbiter b/alignak/for_freebsd/alignak-arbiter new file mode 100755 index 0000000..2f1debb --- /dev/null +++ b/alignak/for_freebsd/alignak-arbiter @@ -0,0 +1,42 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: alignak_arbiter +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="alignak_arbiter" +rcvar="alignak_arbiter_enable" + +alignak_arbiter_daemonfile="/usr/local/etc/alignak/daemons/arbiterd.ini" +alignak_arbiter_configfile="/usr/local/etc/alignak/alignak.cfg" +command="/usr/local/bin/alignak-arbiter" +command_interpreter="/usr/local/bin/python2.7" +command_args="-d -c ${alignak_arbiter_daemonfile} -a ${alignak_arbiter_configfile} > /dev/null 2>&1" +pidfile="/var/run/alignak/arbiterd.pid" + +restart_precmd="alignak_checkconfig" +configtest_cmd="alignak_checkconfig" + +required_files="${alignak_arbiter_configfile}" +extra_commands="configtest" + +load_rc_config "${name}" + +[ -z "${alignak_arbiter_enable}" ] && alignak_arbiter_enable="NO" + +alignak_checkconfig() { + echo -n "Performing sanity check on alignak configuration: " + ${command} -V -a ${alignak_arbiter_configfile} >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "FAILED" + return 1 + else + echo "OK" + fi +} + +run_rc_command "$1" diff --git a/alignak/for_freebsd/alignak-broker b/alignak/for_freebsd/alignak-broker new file mode 100755 index 0000000..9640c3c --- /dev/null +++ b/alignak/for_freebsd/alignak-broker @@ -0,0 +1,26 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: alignak_broker +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="alignak_broker" +rcvar="alignak_broker_enable" + +alignak_broker_configfile="/usr/local/etc/alignak/daemons/brokerd.ini" +command="/usr/local/bin/alignak-broker" +command_interpreter="/usr/local/bin/python2.7" +command_args="-d -c ${alignak_broker_configfile} > /dev/null 2>&1" +pidfile="/var/run/alignak/brokerd.pid" + +required_files="${alignak_broker_configfile}" + +load_rc_config "${name}" + +[ -z "${alignak_broker_enable}" ] && alignak_broker_enable="NO" + +run_rc_command "$1" diff --git a/alignak/for_freebsd/alignak-poller b/alignak/for_freebsd/alignak-poller new file mode 100755 index 0000000..1a49cc2 --- /dev/null +++ b/alignak/for_freebsd/alignak-poller @@ -0,0 +1,26 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: alignak_poller +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="alignak_poller" +rcvar="alignak_poller_enable" + +alignak_poller_configfile="/usr/local/etc/alignak/daemons/pollerd.ini" +command="/usr/local/bin/alignak-poller" +command_interpreter="/usr/local/bin/python2.7" +command_args="-d -c ${alignak_poller_configfile} > /dev/null 2>&1" +pidfile="/var/run/alignak/pollerd.pid" + +required_files="${alignak_poller_configfile}" + +load_rc_config "${name}" + +[ -z "${alignak_poller_enable}" ] && alignak_poller_enable="NO" + +run_rc_command "$1" diff --git a/alignak/for_freebsd/alignak-reactionner b/alignak/for_freebsd/alignak-reactionner new file mode 100755 index 0000000..0486cc6 --- /dev/null +++ b/alignak/for_freebsd/alignak-reactionner @@ -0,0 +1,26 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: alignak_reactionner +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="alignak_reactionner" +rcvar="alignak_reactionner_enable" + +alignak_reactionner_configfile="/usr/local/etc/alignak/daemons/reactionnerd.ini" +command="/usr/local/bin/alignak-reactionner" +command_interpreter="/usr/local/bin/python2.7" +command_args="-d -c ${alignak_reactionner_configfile} > /dev/null 2>&1" +pidfile="/var/run/alignak/reactionnerd.pid" + +required_files="${alignak_reactionner_configfile}" + +load_rc_config "${name}" + +[ -z "${alignak_reactionner_enable}" ] && alignak_reactionner_enable="NO" + +run_rc_command "$1" diff --git a/alignak/for_freebsd/alignak-receiver b/alignak/for_freebsd/alignak-receiver new file mode 100755 index 0000000..62f952c --- /dev/null +++ b/alignak/for_freebsd/alignak-receiver @@ -0,0 +1,26 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: alignak_receiver +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="alignak_receiver" +rcvar="alignak_receiver_enable" + +alignak_receiver_configfile="/usr/local/etc/alignak/daemons/receiverd.ini" +command="/usr/local/bin/alignak-receiver" +command_interpreter="/usr/local/bin/python2.7" +command_args="-d -c ${alignak_receiver_configfile} > /dev/null 2>&1" +pidfile="/var/run/alignak/receiverd.pid" + +required_files="${alignak_receiver_configfile}" + +load_rc_config "${name}" + +[ -z "${alignak_receiver_enable}" ] && alignak_receiver_enable="NO" + +run_rc_command "$1" diff --git a/alignak/for_freebsd/alignak-scheduler b/alignak/for_freebsd/alignak-scheduler new file mode 100755 index 0000000..66b6f1e --- /dev/null +++ b/alignak/for_freebsd/alignak-scheduler @@ -0,0 +1,26 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: alignak_scheduler +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="alignak_scheduler" +rcvar="alignak_scheduler_enable" + +alignak_scheduler_configfile="/usr/local/etc/alignak/daemons/schedulerd.ini" +command="/usr/local/bin/alignak-scheduler" +command_interpreter="/usr/local/bin/python2.7" +command_args="-d -c ${alignak_scheduler_configfile} > /dev/null 2>&1" +pidfile="/var/run/alignak/schedulerd.pid" + +required_files="${alignak_scheduler_configfile}" + +load_rc_config "${name}" + +[ -z "${alignak_scheduler_enable}" ] && alignak_scheduler_enable="NO" + +run_rc_command "$1" diff --git a/alignak/for_freebsd/alignak.in b/alignak/for_freebsd/alignak.in new file mode 100755 index 0000000..afd2149 --- /dev/null +++ b/alignak/for_freebsd/alignak.in @@ -0,0 +1,108 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# + +# This file is copied to the */etc/default/alignak* folder, this to be found and read by the +# alignak system startup script. + +# Main alignak variables: +# - BIN is where the launch scripts are located +# (Free BSD sets to /usr/local/bin) +# - ETC is where we store the configuration files +# (Free BSD sets to /usr/local/etc/alignak) +# - VAR is where the libraries and plugins files are installed +# (Free BSD sets to /var/lib/alignak) +# - RUN is the daemons working directory and where pid files are stored +# (Free BSD sets to /var/run/alignak) +# - LOG is where we put log files +# (Free BSD sets to /var/log/alignak) +# +# Those variables define where the installer copied the files. +BIN=/usr/local/bin +ETC=/usr/local/etc/alignak +VAR=/var/lib/alignak +RUN=/var/run/alignak +LOG=/var/log/alignak +#-- +#-- Do not change the file content below this line until you really know what your are doing ;) +#-- + +# For the arbiter, we also define the name of the 2 main configuration files. +# There may be 2 configuration files because tools like Centreon generate those... +# + +### MONITORING CONFIGURATION ### +# Alignak main configuration file +ALIGNAKCFG="$ETC/alignak.cfg" +if [ -z "$ALIGNAKCFG" ]; then + ALIGNAKCFG="$ETC/alignak.cfg" +fi + +# Alignak secondary configuration file +#ALIGNAKSPECIFICCFG="$ETC/alignak-specific.cfg" + + +# +# For each Alignak daemon, we define: +# - the location of its configuration file +# - the name of its launching script +# - the location of its debug log file (if any is used) +# - the location of its pid file +# + +### ARBITER PART ### +ARBITERCFG="$ETC/daemons/arbiterd.ini" +ARBITERDAEMON=$BIN/alignak-arbiter +ARBITERPID="$RUN/arbiterd.pid" +ARBITERDEBUGFILE="$LOG/arbiter-debug.log" + + +### SCHEDULER PART ### +SCHEDULERCFG="$ETC/daemons/schedulerd.ini" +SCHEDULERDAEMON=$BIN/alignak-scheduler +SCHEDULERPID="$RUN/schedulerd.pid" +SCHEDULERDEBUGFILE="$LOG/scheduler-debug.log" + + +### POLLER PART ### +POLLERCFG="$ETC/daemons/pollerd.ini" +POLLERDAEMON=$BIN/alignak-poller +POLLERPID="$RUN/pollerd.pid" +POLLERDEBUGFILE="$LOG/poller-debug.log" + + +### REACTIONNER PART ### +REACTIONNERCFG="$ETC/daemons/reactionnerd.ini" +REACTIONNERDAEMON=$BIN/alignak-reactionner +REACTIONNERPID="$RUN/reactionnerd.pid" +REACTIONNERDEBUGFILE="$LOG/reactionner-debug.log" + + +### BROKER PART ### +BROKERCFG="$ETC/daemons/brokerd.ini" +BROKERDAEMON=$BIN/alignak-broker +BROKERPID="$RUN/brokerd.pid" +BROKERDEBUGFILE="$LOG/broker-debug.log" + + +### RECEIVER PART ### +RECEIVERCFG="$ETC/daemons/receiverd.ini" +RECEIVERDAEMON=$BIN/alignak-receiver +RECEIVERPID="$RUN/receiverd.pid" +RECEIVERDEBUGFILE="$LOG/receiver-debug.log" diff --git a/alignak/for_freebsd/alignak.ini b/alignak/for_freebsd/alignak.ini new file mode 100755 index 0000000..35f154f --- /dev/null +++ b/alignak/for_freebsd/alignak.ini @@ -0,0 +1,109 @@ +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# + +# +# This configuration file is the main Alignak configuration entry point. +# +# This file is the FreeBSD version of the original *etc/alignak.ini* file. +# Its content has been updated according to the Alignak installation made on a Free BSD system. +# + +# Main alignak variables: +# - BIN is where the launch scripts are located +# (Free BSD sets to /usr/local/bin) +# - ETC is where we store the configuration files +# (Free BSD sets to /usr/local/etc/alignak) +# - VAR is where the libraries and plugins files are installed +# (Free BSD sets to /var/lib/alignak) +# - RUN is the daemons working directory and where pid files are stored +# (Free BSD sets to /var/run/alignak) +# - LOG is where we put log files +# (Free BSD sets to /var/log/alignak) +# +[DEFAULT] +BIN=/usr/local/bin +ETC=/usr/local/etc/alignak +VAR=/var/lib/alignak +RUN=/var/run/alignak +LOG=/var/log/alignak + + +# We define the name of the 2 main Alignak configuration files. +# There may be 2 configuration files because tools like Centreon generate those... +[alignak-configuration] +# Alignak main configuration file +CFG=%(ETC)s/alignak.cfg +# Alignak secondary configuration file (none as a default) +SPECIFICCFG= + + +# For each Alignak daemon, this file contains a section with the daemon name. The section +# identifier is the corresponding daemon name. This daemon name is built with the daemon +# type (eg. arbiter, poller,...) and the daemon name separated with a dash. +# This rule ensure that alignak will be able to find all the daemons configuration in this +# whatever the number of daemons existing in the configuration +# +# Each section defines: +# - the location of the daemon configuration file +# - the daemon launching script +# - the location of the daemon pid file +# - the location of the daemon debug log file (if any is to be used) + +[arbiter-master] +### ARBITER PART ### +PROCESS=alignak-arbiter +DAEMON=%(BIN)s/alignak-arbiter +CFG=%(ETC)s/daemons/arbiterd.ini +DEBUGFILE=%(LOG)s/arbiter-debug.log + + +[scheduler-master] +### SCHEDULER PART ### +PROCESS=alignak-scheduler +DAEMON=%(BIN)s/alignak-scheduler +CFG=%(ETC)s/daemons/schedulerd.ini +DEBUGFILE=%(LOG)s/scheduler-debug.log + +[poller-master] +### POLLER PART ### +PROCESS=alignak-poller +DAEMON=%(BIN)s/alignak-poller +CFG=%(ETC)s/daemons/pollerd.ini +DEBUGFILE=%(LOG)s/poller-debug.log + +[reactionner-master] +### REACTIONNER PART ### +PROCESS=alignak-reactionner +DAEMON=%(BIN)s/alignak-reactionner +CFG=%(ETC)s/daemons/reactionnerd.ini +DEBUGFILE=%(LOG)s/reactionner-debug.log + +[broker-master] +### BROKER PART ### +PROCESS=alignak-broker +DAEMON=%(BIN)s/alignak-broker +CFG=%(ETC)s/daemons/brokerd.ini +DEBUGFILE=%(LOG)s/broker-debug.log + +[receiver-master] +### RECEIVER PART ### +PROCESS=alignak-receiver +DAEMON=%(BIN)s/alignak-receiver +CFG=%(ETC)s/daemons/receiverd.ini +DEBUGFILE=%(LOG)s/receiver-debug.log diff --git a/alignak/systemV/alignak.ini b/alignak/systemV/alignak.ini new file mode 100755 index 0000000..d711638 --- /dev/null +++ b/alignak/systemV/alignak.ini @@ -0,0 +1,109 @@ +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# + +# +# This configuration file is the main Alignak configuration entry point. +# +# This file is the Debian/Ubuntu version of the original *etc/alignak.ini* file. +# Its content has been updated according to the Alignak installation made on the system for system V start/stop scripts. +# + +# Main alignak variables: +# - BIN is where the launch scripts are located +# (Debian sets to /usr/bin) +# - ETC is where we store the configuration files +# (Debian sets to /etc/alignak) +# - VAR is where the libraries and plugins files are installed +# (Debian sets to /var/lib/alignak) +# - RUN is the daemons working directory and where pid files are stored +# (Debian sets to /var/run/alignak) +# - LOG is where we put log files +# (Debian sets to /var/log/alignak) +# +[DEFAULT] +BIN=/usr/bin +ETC=/etc/alignak +VAR=/var/lib/alignak +RUN=/var/run/alignak +LOG=/var/log/alignak + + +# We define the name of the 2 main Alignak configuration files. +# There may be 2 configuration files because tools like Centreon generate those... +[alignak-configuration] +# Alignak main configuration file +CFG=%(ETC)s/alignak.cfg +# Alignak secondary configuration file (none as a default) +SPECIFICCFG= + + +# For each Alignak daemon, this file contains a section with the daemon name. The section +# identifier is the corresponding daemon name. This daemon name is built with the daemon +# type (eg. arbiter, poller,...) and the daemon name separated with a dash. +# This rule ensure that alignak will be able to find all the daemons configuration in this +# whatever the number of daemons existing in the configuration +# +# Each section defines: +# - the location of the daemon configuration file +# - the daemon launching script +# - the location of the daemon pid file +# - the location of the daemon debug log file (if any is to be used) + +[arbiter-master] +### ARBITER PART ### +PROCESS=alignak-arbiter +DAEMON=%(BIN)s/alignak-arbiter +CFG=%(ETC)s/daemons/arbiterd.ini +DEBUGFILE=%(LOG)s/arbiter-debug.log + + +[scheduler-master] +### SCHEDULER PART ### +PROCESS=alignak-scheduler +DAEMON=%(BIN)s/alignak-scheduler +CFG=%(ETC)s/daemons/schedulerd.ini +DEBUGFILE=%(LOG)s/scheduler-debug.log + +[poller-master] +### POLLER PART ### +PROCESS=alignak-poller +DAEMON=%(BIN)s/alignak-poller +CFG=%(ETC)s/daemons/pollerd.ini +DEBUGFILE=%(LOG)s/poller-debug.log + +[reactionner-master] +### REACTIONNER PART ### +PROCESS=alignak-reactionner +DAEMON=%(BIN)s/alignak-reactionner +CFG=%(ETC)s/daemons/reactionnerd.ini +DEBUGFILE=%(LOG)s/reactionner-debug.log + +[broker-master] +### BROKER PART ### +PROCESS=alignak-broker +DAEMON=%(BIN)s/alignak-broker +CFG=%(ETC)s/daemons/brokerd.ini +DEBUGFILE=%(LOG)s/broker-debug.log + +[receiver-master] +### RECEIVER PART ### +PROCESS=alignak-receiver +DAEMON=%(BIN)s/alignak-receiver +CFG=%(ETC)s/daemons/receiverd.ini +DEBUGFILE=%(LOG)s/receiver-debug.log diff --git a/alignak/systemV/default/alignak.in b/alignak/systemV/default/alignak.in new file mode 100755 index 0000000..bc00117 --- /dev/null +++ b/alignak/systemV/default/alignak.in @@ -0,0 +1,108 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# + +# This file is copied to the */etc/default/alignak* folder, this to be found and read by the +# alignak system startup script. + +# Main alignak variables: +# - BIN is where the launch scripts are located +# (Debian sets to /usr/bin) +# - ETC is where we store the configuration files +# (Debian sets to /etc/alignak) +# - VAR is where the libraries and plugins files are installed +# (Debian sets to /var/lib/alignak) +# - RUN is the daemons working directory and where pid files are stored +# (Debian sets to /var/run/alignak) +# - LOG is where we put log files +# (Debian sets to /var/log/alignak) +# +# Those variables define where the installer copied the files. +BIN=/usr/bin +ETC=/etc/alignak +VAR=/var/lib/alignak +RUN=/var/run/alignak +LOG=/var/log/alignak +#-- +#-- Do not change the file content below this line until you really know what your are doing ;) +#-- + +# For the arbiter, we also define the name of the 2 main configuration files. +# There may be 2 configuration files because tools like Centreon generate those... +# + +### MONITORING CONFIGURATION ### +# Alignak main configuration file +ALIGNAKCFG="$ETC/alignak.cfg" +if [ -z "$ALIGNAKCFG" ]; then + ALIGNAKCFG="$ETC/alignak.cfg" +fi + +# Alignak secondary configuration file +#ALIGNAKSPECIFICCFG="$ETC/alignak-specific.cfg" + + +# +# For each Alignak daemon, we define: +# - the location of its configuration file +# - the name of its launching script +# - the location of its debug log file (if any is used) +# - the location of its pid file +# + +### ARBITER PART ### +ARBITERCFG="$ETC/daemons/arbiterd.ini" +ARBITERDAEMON=$BIN/alignak-arbiter +ARBITERPID="$RUN/arbiterd.pid" +ARBITERDEBUGFILE="$LOG/arbiter-debug.log" + + +### SCHEDULER PART ### +SCHEDULERCFG="$ETC/daemons/schedulerd.ini" +SCHEDULERDAEMON=$BIN/alignak-scheduler +SCHEDULERPID="$RUN/schedulerd.pid" +SCHEDULERDEBUGFILE="$LOG/scheduler-debug.log" + + +### POLLER PART ### +POLLERCFG="$ETC/daemons/pollerd.ini" +POLLERDAEMON=$BIN/alignak-poller +POLLERPID="$RUN/pollerd.pid" +POLLERDEBUGFILE="$LOG/poller-debug.log" + + +### REACTIONNER PART ### +REACTIONNERCFG="$ETC/daemons/reactionnerd.ini" +REACTIONNERDAEMON=$BIN/alignak-reactionner +REACTIONNERPID="$RUN/reactionnerd.pid" +REACTIONNERDEBUGFILE="$LOG/reactionner-debug.log" + + +### BROKER PART ### +BROKERCFG="$ETC/daemons/brokerd.ini" +BROKERDAEMON=$BIN/alignak-broker +BROKERPID="$RUN/brokerd.pid" +BROKERDEBUGFILE="$LOG/broker-debug.log" + + +### RECEIVER PART ### +RECEIVERCFG="$ETC/daemons/receiverd.ini" +RECEIVERDAEMON=$BIN/alignak-receiver +RECEIVERPID="$RUN/receiverd.pid" +RECEIVERDEBUGFILE="$LOG/receiver-debug.log" diff --git a/alignak/systemV/init.d/alignak b/alignak/systemV/init.d/alignak new file mode 100755 index 0000000..b03f1f8 --- /dev/null +++ b/alignak/systemV/init.d/alignak @@ -0,0 +1,559 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# +# +# This file incorporates work covered by the following copyright and +# permission notice: +# +# Copyright (C) 2009-2014: +# 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 . + +### BEGIN INIT INFO +# Provides: alignak +# Required-Start: $network $remote_fs +# Required-Stop: $network $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: alignak monitoring daemon +# Description: alignak is a monitoring tool composed of many separated modules: +# - arbiter : the main one : control everything else. +# - scheduler : receives checks/actions from arbiter. Schedules & forwards them to pollers. +# - poller : receives the checks from a scheduler. Launch them and returns results +# - broker : manage results by looking at scheduler. Like export to flat file or db. +# - reactionner : manage the failed checks by looking at scheduler. +# - receiver : manage all passive data +### END INIT INFO + +### Chkconfig Header +# Alignak Starts Alignak daemons +# +# chkconfig: 345 99 01 +# description: Start Alignak daemons + +# Reference: +# http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html + + +NAME="alignak" + +AVAIL_MODULES="scheduler poller reactionner broker receiver arbiter" + +## ALIGNAK_MODULE_FILE is set by alignak-* if it's one of these that's calling us. +if [ -z "$ALIGNAK_MODULE_FILE" ]; then + SCRIPTNAME=$0 + _usage_mods_="[ <$AVAIL_MODULES> ]" +else + SCRIPTNAME=$ALIGNAK_MODULE_FILE +fi + +curpath=$(cd $(dirname "$0") && pwd) +#echo curpath is $curpath filename is $(basename "$0") + + +export LANG=en_US.UTF8 +export LC_ALL=en_US.UTF8 +export PYTHONIOENCODING=utf8 +export PYTHONUNBUFFERED="0" +export TZ=:/etc/localtime + +# default +DEBUG=false +CMD="" +SUBMODULES="" + +# Try relative first (if we have /usr/local for example +[ -z "$ALIGNAK_DEFAULT_FILE" ] && ALIGNAK_DEFAULT_FILE="${curpath}/../default/$NAME" +[ ! -f "$ALIGNAK_DEFAULT_FILE" ] && ALIGNAK_DEFAULT_FILE="/etc/default/$NAME" + + + +usage() { + cat << END +Usage: $SCRIPTNAME [ -d ] {start|stop|status|restart|reload|force-reload|check} $_usage_mods_ + + -d start requested module(s) in debug mode, only useful with start|restart + +END +} + +if [ "$1" = "-d" ]; then + DEBUG="1" + shift +fi + +if [ $# -eq 0 ]; then + usage >&2 + exit 2 +fi + +CMD=$1 +shift +SUBMODULES=$* + +# Reads configuration variable file if it is present +[ -r "$ALIGNAK_DEFAULT_FILE" ] && . "$ALIGNAK_DEFAULT_FILE" + +if [ -z "$SUBMODULES" ]; then + SUBMODULES=$AVAIL_MODULES +else + # check given modules + for mod1 in $SUBMODULES; do + found=0 + for mod2 in $AVAIL_MODULES; do + [ $mod1 = $mod2 ] && found=1; + done + [ $found = 0 ] && { usage >&2 ; exit 2 ; } + done +fi + +# Now look if some required variables are pre defined: +if [ -z "$ALIGNAKCFG" ]; then + ALIGNAKCFG="$ETC/alignak.cfg" +fi +echo "Alignak main configuration file is: $ALIGNAKCFG" + +# If var or run dir is missing, create them and chown them +[ ! -d $VAR ] && mkdir -p $VAR && chown $ALIGNAKUSER:$ALIGNAKGROUP $VAR +[ ! -d $RUN ] && mkdir -p $RUN && chown $ALIGNAKUSER:$ALIGNAKGROUP $RUN + +# Now place us in our var directory so even our arbiter will be +# happy for opening its pid and cmd files +cd $VAR + + + +# In case not existing, define here +log_failure_msg() { + echo $* + return 1 +} + +log_warning_msg() { + echo $* + return 1 +} + +log_end_msg() { + code=$1 + shift + echo $* + return $code +} + +# Load the VERBOSE setting and other rcS variables +[ -f /etc/default/rcS ] && . /etc/default/rcS + +# Source function library. +[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions + +[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions + +echo_success() { + log_end_msg 0 $* +} + +echo_failure() { + log_end_msg 1 $* +} + +################################################ + +# +# returns the pid for a submodule +# + +getpidfile() { + mod="$1" + modPIDVAR=$(echo $mod | tr 'a-z' 'A-Z')"PID" + pidfile=$(echo $(eval echo \${$modPIDVAR})) + if test "$pidfile" + then + echo "$pidfile" + else + echo "$RUN/${mod}d.pid" + fi +} + +getmodpid() { + mod=$1 + pidfile=$(getpidfile "$mod") + if [ -s $pidfile ]; then + cat $pidfile + fi +} + + +getdebugfile() { + mod="$1" + modDEBUG=$(echo $mod | tr 'a-z' 'A-Z')"DEBUGFILE" + debugfile=$(echo $(eval echo \${$modDEBUG})) + if test "$debugfile" + then + echo "$debugfile" + else + echo "${VAR}/${mod}-debug.log" + fi +} + +# +# Display status +# +do_status() { + mod=$1 + pidfile=$(getpidfile "$mod") + [ -e "$pidfile" ] || { + echo "$mod NOT RUNNING (pidfile ($pidfile) not exist)" + return 3 + } + [ -r "$pidfile" ] || { + echo "$mod NOT RUNNING (pidfile ($pidfile) unreadable)" + return 3 + } + pid=$(cat "$pidfile") + if [ -z "$pid" ]; then + echo "$mod NOT RUNNING (pid file empty)" + return 4 + fi + ps -p "$pid" >/dev/null 2>&1 + rc=$? + if [ $rc != 0 ]; then + log_failure_msg "$mod NOT RUNNING (process $pid doesn't exist?)" + return 1 + fi + echo "$mod RUNNING (pid $pid)" + return 0 +} + +# +# starts our modules +# +do_start() { + mod=$1 + modfilepath="$BIN/alignak-${mod}" + [ -e "$modfilepath" ] || { + log_failure_msg "FAILED: did not find $mod file ($modfilepath) ; are you sure alignak-$mod is installed?" + return 5 + } + [ "$DEBUG" = 1 ] && DEBUGCMD="--debug "$(getdebugfile "$mod") + # Arbiter alignak.cfg, and the other OTHERd.ini + modINI=$(echo "$"${mod}CFG | tr '[:lower:]' '[:upper:]') + modinifile=$(eval echo ${modINI}) + if [ "$mod" != "arbiter" ]; then + output=$($modfilepath -d -c "${modinifile}" $DEBUGCMD 2>&1) + rc=$? + else + if [ -z "$ALIGNAKSPECIFICCFG" ]; then + output=$($modfilepath -d -c "${modinifile}" -a "$ALIGNAKCFG" $DEBUGCMD 2>&1) + else + output=$($modfilepath -d -c "${modinifile}" -a "$ALIGNAKCFG" -a "$ALIGNAKSPECIFICCFG" $DEBUGCMD 2>&1) + fi + rc=$? + fi + # debug: + #resfile="/tmp/bad_start_for_$mod" + #echo "$output" > "$resfile" || true + if [ $rc != 0 ]; then + resfile="/tmp/bad_start_for_$mod" + echo "$output" > "$resfile" || true + output=$(echo "$output" | tail -1) + echo "FAILED: $output (full output is in $resfile)" + return 1 + fi + echo "OK" + return 0 +} + +# +# stops modules +# +do_stop() { + mod=$1 + pid=$(getmodpid "$mod") + statusoutput=$(do_status "$mod") + [ $? -ne 0 ] && { + echo "$statusoutput" + return 0 + } + if [ ! -z "$pid" ]; then + kill "$pid" + #sleep 1 + ## TODO: instead of 'sleep 1': wait up to when pid file is removed (with timeout)? + for i in 1 2 3 + do + # TODO: use a better way to get the children pids.. + allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')" + if [ -z "$allpids" ]; then + echo "OK" + return 0 + fi + sleep 1 + done + echo "there are still remaining processes to $mod running.. ; trying to kill them (SIGTERM).." + allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')" + for cpid in $(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}'); do + kill $cpid > /dev/null 2>&1 + done + for i in 1 2 3 + do + # TODO: eventually use a better way to get the children pids.. + allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')" + if [ -z "$allpids" ]; then + echo "OK" + return 0 + fi + sleep 1 + done + echo "there are still remaining processes to $mod running.. ; trying to kill -9 them.." + allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')" + for cpid in $(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}'); do + kill -9 $cpid > /dev/null 2>&1 + done + sleep 1 + allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')" + if [ ! -z "$allpids" ]; then + echo "FAILED: one or more process for $mod are still running after kill -9!" + echo "Remaining processes are (pids="$allpids"):" + ps -lf $(for p in $allpids ; do echo -n "-p$p " ; done) + echo "You should check this." + return 1 + fi + echo "OK" + else + echo "NOT RUNNING" + fi + return 0 +} + +# +# does the config check +# +do_check() { + echo "Checking configuration..." + [ "$DEBUG" = 1 ] && DEBUGCMD="--debug $VAR/${mod}-debug.log" + + modINI=$(echo "$"${mod}CFG | tr '[:lower:]' '[:upper:]') + modinifile=$(eval echo ${modINI}) + + if [ -z "$ALIGNAKSPECIFICCFG" ]; then + $BIN/alignak-arbiter -V -c "${modinifile}" -a "$ALIGNAKCFG" $DEBUGCMD 2>&1 + else + $BIN/alignak-arbiter -V -c "${modinifile}" -a "$ALIGNAKCFG" -a "$ALIGNAKSPECIFICCFG" $DEBUGCMD 2>&1 + fi + rc=$? + if [ $rc -eq 0 ]; then + echo_success + else + echo "$startoutput" + echo_failure + fi + return $? +} + + +############################ + +do_start_() { + echo "Starting $1: " + status=$(do_status "$1") + rc=$? + if [ $rc -eq 0 ]; then + log_warning_msg "Already running" + return + fi + startoutput=$(do_start "$1") + rc=$? + if [ $rc -eq 0 ]; then + echo_success + else + echo "$startoutput" + echo_failure + fi + return $rc +} + +do_stop_() { + echo "Stopping $1" + statusoutput=$(do_status "$1") + rc=$? + if [ $rc -ne 0 ]; then + failuremsg="Couldn't get status of $1: $statusoutput" + else + stopoutput=$(do_stop "$1" 2>&1) + rc=$? + [ $rc -ne 0 ] && failuremsg="Couldn't stop $1: $stopoutput" + fi + if [ $rc -ne 0 ]; then + log_failure_msg "$failuremsg" + echo_failure + else + echo_success + fi + return $rc +} + +do_restart_() { + mod="$1" + if [ "$mod" = "arbiter" ]; then + do_check_ "$mod" + checkrc=$? + if [ $checkrc -ne 0 ]; then + return 1 + fi + fi + echo "Restarting $mod" + stopoutput=$(do_stop "$mod") + startoutput=$(do_start "$mod") + rc=$? + if [ $rc -eq 0 ]; then + echo_success + else + log_failure_msg "$startoutput" + echo_failure + fi + return $rc +} + +do_force_reload_() { + do_restart_ $1 +} + +do_reload_() { + mod="$1" + if [ "$mod" = "arbiter" ]; then + do_status_ $mod + checkrc=$? + if [ $checkrc -ne 0 ]; then + echo "Cannot request reload if process is not running." + return 1 + fi + do_check_ "$mod" + checkrc=$? + if [ $checkrc -ne 0 ]; then + return 1 + fi + pid=$(getmodpid "$mod") + if [ "$pid" != "" ]; then + # send SIGHUP signal to reload configuration + kill -1 $pid + rc=$? + fi + else + # if not the arbiter module, reload == restart + do_restart_ $mod + fi + echo "Reloading $mod" + if [ $rc -eq 0 ]; then + echo_success + else + echo_failure + fi + return $rc +} + +do_status_() { + mod=$1 + echo "Checking status of $mod" + do_status "$1" + rc=$? + if [ $rc -eq 0 ]; then + echo_success + else + echo_failure + fi + +} + +do_check_() { + echo "Doing config check" + output=$(do_check "$1" 2>&1) + rc=$? + check_res_file=$(mktemp /tmp/alignak_checkconfig_resultXXXXXXXX) + echo "$output" > "$check_res_file" + mv $check_res_file /tmp/alignak_checkconfig_result + check_res_file="/tmp/alignak_checkconfig_result" + + if [ $rc -eq 0 ]; then + echo_success + else + output=$(echo "$output" | tail -1) + log_warning_msg "full result is in ${check_res_file}" + log_failure_msg "ConfigCheck failed: $output" + echo_failure + fi + return $rc +} +do_checkconfig_() { do_check_ "$1" ; } + + +############################ + +do_cmd_on() { + action=$1 + mods=$2 + + local return_value + return_value=0 + + for mod in $mods + do + # If at least one action fails, the return value is 1. + do_${action}_ "$mod" || return_value=1 + done + + return $return_value +} + + +############################ +## Main: + +case "$CMD" in + start|stop|restart|status|force-reload) + do_cmd_on "$CMD" "$SUBMODULES" + ;; + force-reload) + do_cmd_on "force_reload" "$SUBMODULES" + ;; + check|checkconfig|reload) + do_cmd_on "$CMD" "arbiter" + ;; + *) + usage >&2 + exit 2 + ;; +esac + diff --git a/alignak/systemV/init.d/alignak-arbiter b/alignak/systemV/init.d/alignak-arbiter new file mode 100755 index 0000000..ef85e8c --- /dev/null +++ b/alignak/systemV/init.d/alignak-arbiter @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# +# +# This file incorporates work covered by the following copyright and +# permission notice: +# +# Copyright (C) 2009-2014: +# 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 . + +### BEGIN INIT INFO +# Provides: alignak-arbiter +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Alignak arbiter daemon +# Description: Alignak is a monitoring tool and the Arbiter +# is one of its daemon. This one reads the configuration, +# cuts it into parts and dispatches it. Then it waits +# for orders from the users to dispatch them too. +### END INIT INFO + +### Chkconfig Header +# Alignak Starts Alignak Arbiter +# +# chkconfig: 345 99 01 +# description: Start Alignak arbiter daemon + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + +SHORTNAME=arbiter +NAME="alignak-$SHORTNAME" +SCRIPT=$(readlink -f "$0") +curdir=$(dirname "$SCRIPT") + +export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us + +case "$1" in + start|stop|reload|restart|force-reload|status|check|checkconfig) + "$curdir/alignak" $@ "$SHORTNAME" + exit $? + ;; + *) + echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}" + exit 1 + ;; +esac diff --git a/alignak/systemV/init.d/alignak-broker b/alignak/systemV/init.d/alignak-broker new file mode 100755 index 0000000..5aff95e --- /dev/null +++ b/alignak/systemV/init.d/alignak-broker @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# +# +# This file incorporates work covered by the following copyright and +# permission notice: +# +# Copyright (C) 2009-2014: +# 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 . + +### BEGIN INIT INFO +# Provides: alignak-broker +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Alignak broker daemon +# Description: Alignak is a monitoring tool and the Broker +# is one of its daemon. This one gets the configuration from the arbiter +# His purpose is to get the broks from the schedulers specified in the +# configuration +### END INIT INFO + +### Chkconfig Header +# Alignak Starts Alignak Broker +# +# chkconfig: 345 99 01 +# description: Start Alignak broker daemon + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + +SHORTNAME=broker +NAME="alignak-$SHORTNAME" +SCRIPT=$(readlink -f "$0") +curdir=$(dirname "$SCRIPT") + +export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us + +case "$1" in + start|stop|reload|restart|force-reload|status|check|checkconfig) + "$curdir/alignak" $@ "$SHORTNAME" + exit $? + ;; + *) + echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}" + exit 1 + ;; +esac diff --git a/alignak/systemV/init.d/alignak-poller b/alignak/systemV/init.d/alignak-poller new file mode 100755 index 0000000..1d614cb --- /dev/null +++ b/alignak/systemV/init.d/alignak-poller @@ -0,0 +1,84 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# +# +# This file incorporates work covered by the following copyright and +# permission notice: +# +# Copyright (C) 2009-2014: +# 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 . + +### BEGIN INIT INFO +# Provides: alignak-poller +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Alignak poller daemon +# Description: Alignak is a monitoring tool and the Poller +# is one of its daemon. This one gets the configuration from the arbiter +# His purpose is to actually do the checks ordered by the schedulers, +# and then sends the results to the schedulers specified in the +# configuration +### END INIT INFO + +### Chkconfig Header +# Alignak Starts Alignak Poller +# +# chkconfig: 345 99 01 +# description: Start Alignak poller daemon + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + +SHORTNAME=poller +NAME="alignak-$SHORTNAME" +SCRIPT=$(readlink -f "$0") +curdir=$(dirname "$SCRIPT") + +export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us + +case "$1" in + start|stop|reload|restart|force-reload|status|check|checkconfig) + "$curdir/alignak" $@ "$SHORTNAME" + exit $? + ;; + *) + echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}" + exit 1 + ;; +esac diff --git a/alignak/systemV/init.d/alignak-reactionner b/alignak/systemV/init.d/alignak-reactionner new file mode 100755 index 0000000..39fc3d9 --- /dev/null +++ b/alignak/systemV/init.d/alignak-reactionner @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# +# +# This file incorporates work covered by the following copyright and +# permission notice: +# +# Copyright (C) 2009-2014: +# 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 . + +### BEGIN INIT INFO +# Provides: alignak-reactionner +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Alignak reactionner daemon +# Description: Alignak is a monitoring tool and the Reactionner +# is one of its daemon. This one gets the configuration from the arbiter +# His purpose is to get the actually do the actions like sending an email +# ordered by the schedulers specified in the configuration +### END INIT INFO + +### Chkconfig Header +# Alignak Starts Alignak Reactionner +# +# chkconfig: 345 99 01 +# description: Start Alignak reactionner daemon + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + +SHORTNAME=reactionner +NAME="alignak-$SHORTNAME" +SCRIPT=$(readlink -f "$0") +curdir=$(dirname "$SCRIPT") + +export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us + +case "$1" in + start|stop|reload|restart|force-reload|status|check|checkconfig) + "$curdir/alignak" $@ "$SHORTNAME" + exit $? + ;; + *) + echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}" + exit 1 + ;; +esac diff --git a/alignak/systemV/init.d/alignak-receiver b/alignak/systemV/init.d/alignak-receiver new file mode 100755 index 0000000..1a5eaae --- /dev/null +++ b/alignak/systemV/init.d/alignak-receiver @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# +# +# This file incorporates work covered by the following copyright and +# permission notice: +# +# Copyright (C) 2009-2014: +# 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 . + +### BEGIN INIT INFO +# Provides: alignak-receiver +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Alignak receiver daemon +# Description: Alignak is a monitoring tool and the Receiver +# is one of its daemon. This one gets the configuration from the arbiter +# His purpose is to get the broks from the schedulers specified in the +# configuration +### END INIT INFO + +### Chkconfig Header +# Alignak Starts Alignak Receiver +# +# chkconfig: 345 99 01 +# description: Start Alignak receiver daemon + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + +SHORTNAME=receiver +NAME="alignak-$SHORTNAME" +SCRIPT=$(readlink -f "$0") +curdir=$(dirname "$SCRIPT") + +export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us + +case "$1" in + start|stop|reload|restart|force-reload|status|check|checkconfig) + "$curdir/alignak" $@ "$SHORTNAME" + exit $? + ;; + *) + echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}" + exit 1 + ;; +esac diff --git a/alignak/systemV/init.d/alignak-scheduler b/alignak/systemV/init.d/alignak-scheduler new file mode 100755 index 0000000..798e23f --- /dev/null +++ b/alignak/systemV/init.d/alignak-scheduler @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# +# +# This file incorporates work covered by the following copyright and +# permission notice: +# +# Copyright (C) 2009-2014: +# 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 . + +### BEGIN INIT INFO +# Provides: alignak-scheduler +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Alignak scheduler daemon +# Description: Alignak is a monitoring tool and the Scheduler +# is one of its daemon. This one get configuration from the arbiter +# His purpose is only to schedule do the checks and actions specified +# in the configuration received from the arbiter +### END INIT INFO + +### Chkconfig Header +# Alignak Starts Alignak Scheduler +# +# chkconfig: 345 99 01 +# description: Start Alignak scheduler daemon + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + +SHORTNAME=scheduler +NAME="alignak-$SHORTNAME" +SCRIPT=$(readlink -f "$0") +curdir=$(dirname "$SCRIPT") + +export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us + +case "$1" in + start|stop|reload|restart|force-reload|status|check|checkconfig) + "$curdir/alignak" $@ "$SHORTNAME" + exit $? + ;; + *) + echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}" + exit 1 + ;; +esac diff --git a/alignak/systemd/alignak.in b/alignak/systemd/alignak.in new file mode 100755 index 0000000..bc00117 --- /dev/null +++ b/alignak/systemd/alignak.in @@ -0,0 +1,108 @@ +#!/bin/sh +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# + +# This file is copied to the */etc/default/alignak* folder, this to be found and read by the +# alignak system startup script. + +# Main alignak variables: +# - BIN is where the launch scripts are located +# (Debian sets to /usr/bin) +# - ETC is where we store the configuration files +# (Debian sets to /etc/alignak) +# - VAR is where the libraries and plugins files are installed +# (Debian sets to /var/lib/alignak) +# - RUN is the daemons working directory and where pid files are stored +# (Debian sets to /var/run/alignak) +# - LOG is where we put log files +# (Debian sets to /var/log/alignak) +# +# Those variables define where the installer copied the files. +BIN=/usr/bin +ETC=/etc/alignak +VAR=/var/lib/alignak +RUN=/var/run/alignak +LOG=/var/log/alignak +#-- +#-- Do not change the file content below this line until you really know what your are doing ;) +#-- + +# For the arbiter, we also define the name of the 2 main configuration files. +# There may be 2 configuration files because tools like Centreon generate those... +# + +### MONITORING CONFIGURATION ### +# Alignak main configuration file +ALIGNAKCFG="$ETC/alignak.cfg" +if [ -z "$ALIGNAKCFG" ]; then + ALIGNAKCFG="$ETC/alignak.cfg" +fi + +# Alignak secondary configuration file +#ALIGNAKSPECIFICCFG="$ETC/alignak-specific.cfg" + + +# +# For each Alignak daemon, we define: +# - the location of its configuration file +# - the name of its launching script +# - the location of its debug log file (if any is used) +# - the location of its pid file +# + +### ARBITER PART ### +ARBITERCFG="$ETC/daemons/arbiterd.ini" +ARBITERDAEMON=$BIN/alignak-arbiter +ARBITERPID="$RUN/arbiterd.pid" +ARBITERDEBUGFILE="$LOG/arbiter-debug.log" + + +### SCHEDULER PART ### +SCHEDULERCFG="$ETC/daemons/schedulerd.ini" +SCHEDULERDAEMON=$BIN/alignak-scheduler +SCHEDULERPID="$RUN/schedulerd.pid" +SCHEDULERDEBUGFILE="$LOG/scheduler-debug.log" + + +### POLLER PART ### +POLLERCFG="$ETC/daemons/pollerd.ini" +POLLERDAEMON=$BIN/alignak-poller +POLLERPID="$RUN/pollerd.pid" +POLLERDEBUGFILE="$LOG/poller-debug.log" + + +### REACTIONNER PART ### +REACTIONNERCFG="$ETC/daemons/reactionnerd.ini" +REACTIONNERDAEMON=$BIN/alignak-reactionner +REACTIONNERPID="$RUN/reactionnerd.pid" +REACTIONNERDEBUGFILE="$LOG/reactionner-debug.log" + + +### BROKER PART ### +BROKERCFG="$ETC/daemons/brokerd.ini" +BROKERDAEMON=$BIN/alignak-broker +BROKERPID="$RUN/brokerd.pid" +BROKERDEBUGFILE="$LOG/broker-debug.log" + + +### RECEIVER PART ### +RECEIVERCFG="$ETC/daemons/receiverd.ini" +RECEIVERDAEMON=$BIN/alignak-receiver +RECEIVERPID="$RUN/receiverd.pid" +RECEIVERDEBUGFILE="$LOG/receiver-debug.log" diff --git a/alignak/systemd/alignak.ini b/alignak/systemd/alignak.ini new file mode 100755 index 0000000..cbe2ef1 --- /dev/null +++ b/alignak/systemd/alignak.ini @@ -0,0 +1,109 @@ +# +# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors +# +# This file is part of Alignak. +# +# Alignak 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. +# +# Alignak 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 Alignak. If not, see . +# + +# +# This configuration file is the main Alignak configuration entry point. +# +# This file is the Debian/Ubuntu version of the original *etc/alignak.ini* file. +# Its content has been updated according to the Alignak installation made on the system for systemd start/stop scripts. +# + +# Main alignak variables: +# - BIN is where the launch scripts are located +# (Debian sets to /usr/bin) +# - ETC is where we store the configuration files +# (Debian sets to /etc/alignak) +# - VAR is where the libraries and plugins files are installed +# (Debian sets to /var/lib/alignak) +# - RUN is the daemons working directory and where pid files are stored +# (Debian sets to /var/run/alignak) +# - LOG is where we put log files +# (Debian sets to /var/log/alignak) +# +[DEFAULT] +BIN=/usr/bin +ETC=/etc/alignak +VAR=/var/lib/alignak +RUN=/var/run/alignak +LOG=/var/log/alignak + + +# We define the name of the 2 main Alignak configuration files. +# There may be 2 configuration files because tools like Centreon generate those... +[alignak-configuration] +# Alignak main configuration file +CFG=%(ETC)s/alignak.cfg +# Alignak secondary configuration file (none as a default) +SPECIFICCFG= + + +# For each Alignak daemon, this file contains a section with the daemon name. The section +# identifier is the corresponding daemon name. This daemon name is built with the daemon +# type (eg. arbiter, poller,...) and the daemon name separated with a dash. +# This rule ensure that alignak will be able to find all the daemons configuration in this +# whatever the number of daemons existing in the configuration +# +# Each section defines: +# - the location of the daemon configuration file +# - the daemon launching script +# - the location of the daemon pid file +# - the location of the daemon debug log file (if any is to be used) + +[arbiter-master] +### ARBITER PART ### +PROCESS=alignak-arbiter +DAEMON=%(BIN)s/alignak-arbiter +CFG=%(ETC)s/daemons/arbiterd.ini +DEBUGFILE=%(LOG)s/arbiter-debug.log + + +[scheduler-master] +### SCHEDULER PART ### +PROCESS=alignak-scheduler +DAEMON=%(BIN)s/alignak-scheduler +CFG=%(ETC)s/daemons/schedulerd.ini +DEBUGFILE=%(LOG)s/scheduler-debug.log + +[poller-master] +### POLLER PART ### +PROCESS=alignak-poller +DAEMON=%(BIN)s/alignak-poller +CFG=%(ETC)s/daemons/pollerd.ini +DEBUGFILE=%(LOG)s/poller-debug.log + +[reactionner-master] +### REACTIONNER PART ### +PROCESS=alignak-reactionner +DAEMON=%(BIN)s/alignak-reactionner +CFG=%(ETC)s/daemons/reactionnerd.ini +DEBUGFILE=%(LOG)s/reactionner-debug.log + +[broker-master] +### BROKER PART ### +PROCESS=alignak-broker +DAEMON=%(BIN)s/alignak-broker +CFG=%(ETC)s/daemons/brokerd.ini +DEBUGFILE=%(LOG)s/broker-debug.log + +[receiver-master] +### RECEIVER PART ### +PROCESS=alignak-receiver +DAEMON=%(BIN)s/alignak-receiver +CFG=%(ETC)s/daemons/receiverd.ini +DEBUGFILE=%(LOG)s/receiver-debug.log