Merge branch 'master' into feature/localization-form-6073
This commit is contained in:
commit
1600514839
|
@ -1 +1,5 @@
|
|||
# Exclude files related to git when generating an archive
|
||||
.git* export-ignore
|
||||
|
||||
# Normalize puppet manifests' line endings to LF on checkin and prevent conversion to CRLF when the files are checked out
|
||||
.vagrant-puppet/* eol=lf
|
||||
|
|
|
@ -1,46 +1,12 @@
|
|||
# Exclude all hidden files
|
||||
.*
|
||||
# But not .gitignore, .gitattributes, .vagrant-puppet, .htaccess and .gitkeep
|
||||
!.gitignore
|
||||
!.gitattributes
|
||||
!.vagrant-puppet
|
||||
!public/.htaccess
|
||||
!packages/rhel/usr/share/icingaweb/public/.htaccess
|
||||
!public/.htaccess.in
|
||||
!.gitkeep
|
||||
|
||||
build/
|
||||
# Except those related to git and vagrant
|
||||
!.git*
|
||||
!.vagrant-puppet/*
|
||||
|
||||
development/
|
||||
|
||||
# ./configure output
|
||||
config.log
|
||||
autom4te.cache
|
||||
autoscan*
|
||||
config.status
|
||||
Makefile
|
||||
|
||||
# cmd tester
|
||||
modules/test/bin/extcmd_test
|
||||
|
||||
# misc test output
|
||||
test/php/library/Icinga/Protocol/Statusdat/.cache
|
||||
|
||||
# Generated API documentation
|
||||
doc/api
|
||||
|
||||
# Enabled modules
|
||||
# Exclude enabled modules
|
||||
config/enabledModules/
|
||||
|
||||
# User preferences
|
||||
config/preferences/*.ini
|
||||
|
||||
# Application logfiles
|
||||
var/log/*.log
|
||||
|
||||
# Packaging
|
||||
/debian
|
||||
*.tar.gz
|
||||
*.komodoproject
|
||||
|
||||
|
||||
# Exclude application log files
|
||||
var/log/*
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
* -crlf
|
158
Makefile.in
158
Makefile.in
|
@ -1,158 +0,0 @@
|
|||
SHELL=/bin/sh
|
||||
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
bindir=@bindir@
|
||||
|
||||
HTTPD_CONFIG_PATH=@httpd_config_path@
|
||||
ICINGAWEB_CONFIG_PATH=@icingaweb_config_path@
|
||||
ICINGAWEB_LOG_PATH=@icingaweb_log_path@
|
||||
|
||||
INSTALL=@INSTALL@
|
||||
INSTALL_OPTS=@INSTALL_OPTS@
|
||||
INSTALL_OPTS_WEB=@INSTALL_OPTS_WEB@
|
||||
|
||||
default:
|
||||
@echo "IcingaWeb make targets: "
|
||||
@printf "%b" " -install:\t\t\tInstall the application and overwrite configs\n"
|
||||
@printf "%b" " -update:\t\t\tInstall the application without touching the configs\n"
|
||||
@printf "%b" " -install-apache-config:\tInstall the apache configuration\n"
|
||||
|
||||
#
|
||||
# Installs the whole application w\o httpd configurations
|
||||
#
|
||||
install: install-config install-basic ensure-writable-folders install-cli
|
||||
|
||||
#
|
||||
# Install icingacli bin
|
||||
#
|
||||
|
||||
install-cli:
|
||||
$(INSTALL) -m 755 -d $(INSTALL_OPTS) $(bindir)
|
||||
$(INSTALL) -m 755 $(INSTALL_OPTS) "./bin/icingacli" $(bindir)/icingacli;
|
||||
|
||||
#
|
||||
# Installs the whole application w\o configuration
|
||||
#
|
||||
install-basic: install-static-files install-runtime-dirs ensure-writable-folders
|
||||
|
||||
#
|
||||
# Updates only the application
|
||||
#
|
||||
update: install-application
|
||||
|
||||
#
|
||||
# Removes files created by ./configure
|
||||
#
|
||||
clean:
|
||||
if [ -f ./Makefile ];then \
|
||||
rm ./Makefile; \
|
||||
fi; \
|
||||
if [ -f ./etc/apache/icingaweb.conf ];then \
|
||||
rm ./etc/apache/icingaweb.conf; \
|
||||
fi;
|
||||
|
||||
#
|
||||
# Installs/copies all static files (executables, scripts, html, etc)
|
||||
#
|
||||
install-static-files: install-application copy-web-files-public copy-web-files-modules
|
||||
|
||||
#
|
||||
# Installs all configuration files
|
||||
#
|
||||
install-config:
|
||||
$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)
|
||||
|
||||
@dirs=`cd ./config ; find . -mindepth 1 -type d `;\
|
||||
for dir in $$dirs; do \
|
||||
$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)/"$$dir"; \
|
||||
done;
|
||||
|
||||
@files=`cd ./config ; find . -mindepth 1 -type f \
|
||||
-and ! -name ".*" -and ! -name "*.in"`; \
|
||||
for file in $$files; do \
|
||||
$(INSTALL) -m 644 $(INSTALL_OPTS_WEB) "./config/$$file" $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)/"$$file"; \
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Installs runtime directories like the application cache
|
||||
#
|
||||
install-runtime-dirs:
|
||||
$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(prefix)/application/cache
|
||||
|
||||
#
|
||||
# Copies the tests into the installation directory
|
||||
#
|
||||
install-tests: copy-folder-tests
|
||||
|
||||
#
|
||||
# Install configurations for apache2
|
||||
#
|
||||
install-apache-config:
|
||||
$(INSTALL) -m 755 -d $(INSTALL_OPTS) $(DESTDIR)$(HTTPD_CONFIG_PATH)
|
||||
$(INSTALL) -m 644 $(INSTALL_OPTS) "./etc/apache/icingaweb.conf" $(DESTDIR)$(HTTPD_CONFIG_PATH)/icingaweb.conf;
|
||||
|
||||
#
|
||||
# Installs the php files to the prefix
|
||||
#
|
||||
install-application: copy-web-files-application copy-web-files-library install-cli
|
||||
|
||||
#
|
||||
# Rule for copying folders and containing files (arbitary types), hidden files are excluded
|
||||
#
|
||||
copy-folder-%:
|
||||
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(prefix)/$*
|
||||
|
||||
@dirs=`find ./$* -mindepth 1 -type d `;\
|
||||
for dir in $$dirs; do \
|
||||
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(prefix)/"$$dir"; \
|
||||
done;
|
||||
|
||||
@files=`find ./$* -mindepth 1 -type f \
|
||||
-and ! -name ".*"`; \
|
||||
for file in $$files; do \
|
||||
$(INSTALL) -m 644 $(INSTALL_OPTS) "$$file" $(DESTDIR)$(prefix)/"$$file"; \
|
||||
done
|
||||
|
||||
|
||||
ensure-writable-folders:
|
||||
$(INSTALL) -m 775 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(prefix)/var/
|
||||
$(INSTALL) -m 775 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(ICINGAWEB_LOG_PATH)
|
||||
chmod -R 775 $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)
|
||||
|
||||
|
||||
#
|
||||
# Rule for copying only php, *html, js and ini files. Hidden files are ignored
|
||||
#
|
||||
copy-web-files-%:
|
||||
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(prefix)/$*
|
||||
|
||||
@dirs=`find ./$* -mindepth 1 -type d `;\
|
||||
for dir in $$dirs; do \
|
||||
$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(prefix)/"$$dir"; \
|
||||
done;
|
||||
|
||||
@files=`find ./$* -mindepth 1 -type f \
|
||||
-name "*.php" -or -name "*.ini" -or -name "*.*html" \
|
||||
-or -name "*.js" -or -name "*.css" -or -name "*.less" \
|
||||
-or -name "*.otf" -or -name "*.ttf" -or -name "*.otf" \
|
||||
-or -name "*.svg" -or -name "*.woff" -or -name "*.png" \
|
||||
-and ! -name ".*"`; \
|
||||
for file in $$files; do \
|
||||
$(INSTALL) -m 644 $(INSTALL_OPTS_WEB) "$$file" $(DESTDIR)$(prefix)/"$$file"; \
|
||||
done
|
||||
|
||||
#
|
||||
# Create release or snapshot tarball
|
||||
#
|
||||
# TODO: Use git-archive
|
||||
# create-tarball:
|
||||
# @./bin/make-tarball --prefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/
|
||||
#
|
||||
# create-tarball-nightly:
|
||||
# ./bin/make-tarball --prefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-`date +%Y%m%d`-`git rev-parse --short HEAD`/
|
|
@ -1,84 +0,0 @@
|
|||
AC_DEFUN([AC_USER_GUESS],[
|
||||
$2=$3
|
||||
for x in $1; do
|
||||
AC_MSG_CHECKING([if user $x exists])
|
||||
AS_IF([ $GREP -q "^$x:" /etc/passwd ],
|
||||
[ AC_MSG_RESULT([found]); $2=$x ; break],
|
||||
[ AC_MSG_RESULT([not found]) ])
|
||||
done
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CHECK_PHP_MODULE],[
|
||||
for x in $1;do
|
||||
AC_MSG_CHECKING([if php has $x module])
|
||||
AS_IF([ php -m | $GREP -iq "^$x$" ],
|
||||
[ AC_MSG_RESULT([found]) ],
|
||||
[ AC_MSG_ERROR([not found])])
|
||||
done
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CHECK_PHP_VERSION],[
|
||||
AC_MSG_CHECKING([if php has at least version $1.$2.$3])
|
||||
AS_IF([ test $1 -le `php -r 'echo PHP_MAJOR_VERSION;'` && \
|
||||
test $2 -le `php -r 'echo PHP_MINOR_VERSION;'` && \
|
||||
test $3 -le `php -r 'echo PHP_RELEASE_VERSION;'`],
|
||||
[ AC_MSG_RESULT([PHP version is correct])],
|
||||
[ AC_MSG_ERROR([You need at least PHP version $1.$2.$3])])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CHECK_PHP_INCLUDE],[
|
||||
AC_MSG_CHECKING([if PHP runtime dependency '$2' is available])
|
||||
AS_IF([ php -r 'require "$1";' ],
|
||||
[ AC_MSG_RESULT([PHP runtime dependency fulfilled])],
|
||||
[ AC_MSG_ERROR([PHP runtime dependency '$2' is missing])])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_GROUP_GUESS],[
|
||||
$2=$3
|
||||
for x in $1; do
|
||||
AC_MSG_CHECKING([if group $x exists])
|
||||
AS_IF([ $GREP -q "^$x:" /etc/group ],
|
||||
[ AC_MSG_RESULT([found]); $2=$x ; break],
|
||||
[ AC_MSG_RESULT([not found]) ])
|
||||
done
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CHECK_BIN], [
|
||||
AC_PATH_PROG([$1],[$2],[not found])
|
||||
|
||||
AS_IF([ test "XX${$1}" == "XXnot found" ],
|
||||
[ AC_MSG_WARN([binary $2 not found in PATH]) ])
|
||||
|
||||
test "XX${$1}" == "XXnot found" && $1=""
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_PATH_GUESS], [
|
||||
$2=$3
|
||||
for x in $1; do
|
||||
AC_MSG_CHECKING([if path $x exists])
|
||||
AS_IF([test -d $x],
|
||||
[AC_MSG_RESULT([found]); $2=$x; break],
|
||||
[AC_MSG_RESULT([not found])]
|
||||
)
|
||||
done
|
||||
])
|
||||
|
||||
# ICINGA_CHECK_DBTYPE(DBTYPE, ARGUMENT_NAME)
|
||||
# ------------------------------------------
|
||||
AC_DEFUN([ICINGA_CHECK_DBTYPE], [
|
||||
AC_MSG_CHECKING([Testing database type for $2])
|
||||
AS_IF(echo "$1" | $GREP -q "^\(my\|pg\)sql$",
|
||||
AC_MSG_RESULT([OK ($1)]),
|
||||
AC_MSG_ERROR([$1])
|
||||
)
|
||||
])
|
||||
|
||||
# ICINGA_CHECK_BACKENDTYPE(BACKENDTYPE, ARGUMENT_NAME)
|
||||
# ------------------------------------------
|
||||
AC_DEFUN([ICINGA_CHECK_BACKENDTYPE], [
|
||||
AC_MSG_CHECKING([Testing backend type for $2])
|
||||
AS_IF(echo "$1" | $GREP -q "^\(ido\|statusdat\|livestatus\)$",
|
||||
AC_MSG_RESULT([OK ($1)]),
|
||||
AC_MSG_ERROR([$1])
|
||||
)
|
||||
])
|
|
@ -1,6 +0,0 @@
|
|||
authentication.ini
|
||||
config.ini
|
||||
modules/monitoring/backends.ini
|
||||
modules/monitoring/instances.ini
|
||||
resources.ini
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
; authentication.ini
|
||||
;
|
||||
; Each section listed in this configuration represents a backend used to authenticate users. The backends will be
|
||||
; processed from top to bottom using the first backend for authentication which reports that the user trying to log in
|
||||
; is available with his given credentials.
|
||||
;
|
||||
; Database or LDAP backend configurations must define a resource referring to a configured database
|
||||
; or LDAP connection respectively in the INI file resources.ini.
|
||||
|
||||
[autologin]
|
||||
backend = autologin
|
||||
; If you want to strip the domain
|
||||
; strip_username_regexp = /\@[^$]+$/
|
|
@ -1,29 +0,0 @@
|
|||
; authentication.ini
|
||||
;
|
||||
; Each section listed in this configuration represents a backend used to authenticate users. The backend configurations
|
||||
; must define a resource referring to a configured database or LDAP connection in the INI file resources.ini.
|
||||
;
|
||||
; The backends will be processed from top to bottom using the first backend for authentication which reports that
|
||||
; the user trying to log in is available.
|
||||
|
||||
[autologin]
|
||||
backend = autologin
|
||||
;
|
||||
; If you want to strip the domain
|
||||
; strip_username_regexp = /\@[^$]+$/
|
||||
|
||||
[internal_ldap_authentication]
|
||||
@ldap_auth_disabled@
|
||||
backend = ldap
|
||||
resource = internal_ldap
|
||||
user_class = @ldap_user_objectclass@
|
||||
user_name_attribute = @ldap_attribute_username@
|
||||
group_base_dn = @ldap_group_base_dn@
|
||||
group_attribute = @ldap_group_attribute@
|
||||
group_member_attribute = @ldap_group_member_attribute@
|
||||
group_class = @ldap_group_class@
|
||||
|
||||
[internal_db_authentication]
|
||||
@internal_auth_disabled@
|
||||
backend = db
|
||||
resource = internal_db
|
|
@ -1,41 +0,0 @@
|
|||
[global]
|
||||
timezone = "Europe/Berlin"
|
||||
|
||||
; Contains the directories that will be searched for available modules. Modules that
|
||||
; don't exist in these directories can still be symlinked in the module folder, but
|
||||
; won't show up in the list of disabled modules
|
||||
; modulePath = "/vagrant/modules:/usr/share/icingaweb/modules"
|
||||
|
||||
[logging]
|
||||
enable = true
|
||||
; Writing to a Stream
|
||||
type = "file"
|
||||
; Write data to the following file
|
||||
target = "@icingaweb_log_path@/icingaweb.log"
|
||||
; Write data to a PHP stream
|
||||
;target = "php://output"
|
||||
|
||||
; Writing to the System Log
|
||||
;type = "syslog"
|
||||
; Prefix all syslog messages generated with the string "icingaweb"
|
||||
;application = "icingaweb"
|
||||
;facility = "LOG_USER"
|
||||
|
||||
level = 1
|
||||
; The default level is WARNING, which means that only events of this level and
|
||||
; above will be tracked. Level numbers descend in order of importance where
|
||||
; ERROR (0) is the most important level and DEBUG (3) is the least important
|
||||
; level:
|
||||
;
|
||||
; ERROR = 0 - Error: error conditions
|
||||
; WARNING = 1 - Warning: warning conditions
|
||||
; INFO = 2 - Informational: informational messages
|
||||
; DEBUG = 3 - Debug: debug messages
|
||||
|
||||
[preferences]
|
||||
; Use INI file storage to save preferences to a local disk
|
||||
type = "ini"
|
||||
|
||||
; Use database storage to save preferences in either a MySQL or PostgreSQL database
|
||||
;type = db
|
||||
;resource = icingaweb-mysql
|
|
@ -1,9 +0,0 @@
|
|||
[membership-set1]
|
||||
backend = groupX
|
||||
users = icingaadmin,tgelf
|
||||
groups = admin,users
|
||||
|
||||
[membership-set2]
|
||||
backend = groupY
|
||||
users = icingaadmin
|
||||
groups = support1,support2
|
|
@ -1,19 +0,0 @@
|
|||
[localdb]
|
||||
@ido_enabled@
|
||||
type = ido
|
||||
resource = "ido"
|
||||
|
||||
[locallive]
|
||||
@livestatus_enabled@
|
||||
type = livestatus
|
||||
resource = livestatus
|
||||
|
||||
[localfile]
|
||||
@statusdat_enabled@
|
||||
type = statusdat
|
||||
resource = statusdat
|
||||
|
||||
;[localfailsafe]
|
||||
;enabled=false
|
||||
;type = combo
|
||||
;backends = localdb, locallive, localfile
|
|
@ -1,2 +0,0 @@
|
|||
[icinga]
|
||||
path = "@icinga_commandpipe@"
|
|
@ -1,11 +0,0 @@
|
|||
[test1]
|
||||
users = icingaadmin,root,tgelf
|
||||
groups = support2,support2
|
||||
permission_1 = monitoring, monitoring/log
|
||||
permission_2 = monitoring/command/all
|
||||
|
||||
[test2]
|
||||
users = root
|
||||
groups = admin
|
||||
permission_2 = test/permission/1, test/permission/2
|
||||
permission_3 = test/permission/15, test/permission/7
|
|
@ -1,55 +0,0 @@
|
|||
; resources.ini
|
||||
;
|
||||
; The configuration file *resources.ini* contains data sources that
|
||||
; can be referenced in other configurations. This allows you to manage
|
||||
; all connections to SQL databases in one single place, avoiding the need
|
||||
; to edit several different configuration files, when the connection
|
||||
; information of a resource change.
|
||||
;
|
||||
; Each section represents a resource, with the section name being the
|
||||
; identifier used to reference this certain section. Depending on the
|
||||
; resource type, each section contains different properties. The property
|
||||
; *type* defines the resource type and thus how the properties are going to
|
||||
; be interpreted. Currently only the resource type *db* is available.
|
||||
|
||||
|
||||
[internal_db]
|
||||
type = db
|
||||
db = @internal_db_type@
|
||||
host = @internal_db_host@
|
||||
port = @internal_db_port@
|
||||
password = @internal_db_password@
|
||||
username = @internal_db_user@
|
||||
dbname = @internal_db_name@
|
||||
|
||||
[ido]
|
||||
type = db
|
||||
db = @ido_db_type@
|
||||
host = @ido_host@
|
||||
port = @ido_port@
|
||||
password = @ido_password@
|
||||
username = @ido_user@
|
||||
dbname = @ido_db_name@
|
||||
|
||||
[statusdat]
|
||||
type = statusdat
|
||||
status_file = @statusdat_file@
|
||||
object_file = @objects_cache_file@
|
||||
|
||||
[livestatus]
|
||||
type = livestatus
|
||||
socket = @livestatus_socket@
|
||||
|
||||
[internal_ldap]
|
||||
type = ldap
|
||||
hostname = @ldap_host@
|
||||
port = @ldap_port@
|
||||
root_dn = "@ldap_rootdn@"
|
||||
bind_dn = "@ldap_binddn@"
|
||||
bind_pw = @ldap_bindpass@
|
||||
|
||||
[logfile]
|
||||
type = file
|
||||
filename = "@icingaweb_log_path@/icingaweb.log"
|
||||
fields = "/^(?<datetime>[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}(\\+[0-9]{2}:[0-9]{2})?) - (?<loglevel>[A-Za-z]+) - (?<message>.*)$/"
|
||||
; format: PCRE
|
|
@ -1,16 +0,0 @@
|
|||
[test1]
|
||||
users = "user1"
|
||||
groups = "no-such-group"
|
||||
name = "monitoring/filter"
|
||||
restriction = "hostgroup=lalala&service_description=*ping*"
|
||||
|
||||
[test2]
|
||||
users = "user2"
|
||||
name = "monitoring/filter"
|
||||
restriction = "hostgroup=kunden*&service_description=*ping*"
|
||||
|
||||
[test3]
|
||||
users = "user3"
|
||||
name = "monitoring/filter"
|
||||
restriction = "hostgroup=kunden*&service_description=*ping-ping*"
|
||||
|
448
configure.ac
448
configure.ac
|
@ -1,448 +0,0 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.61])
|
||||
AC_INIT([IcingaWeb2], [1.0.0], [info@icinga.org])
|
||||
AC_PREFIX_DEFAULT(/usr/local/icingaweb)
|
||||
|
||||
if test "x$prefix" = "xNONE" ; then
|
||||
installDir="/usr/local/icingaweb"
|
||||
prefix=$installDir
|
||||
else
|
||||
installDir=$prefix
|
||||
fi
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_GREP
|
||||
AC_PROG_SED
|
||||
|
||||
# Check for php
|
||||
AC_ARG_VAR([PHP],[php cli binary])
|
||||
AC_CHECK_PHP_INCLUDE([Zend/Application.php],[Zend Framework])
|
||||
AC_CHECK_PHP_VERSION([5],[3],[0])
|
||||
AC_CHECK_BIN([PHP], [php])
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_PHP_MODULE([sockets json])
|
||||
|
||||
#
|
||||
# Configuration files
|
||||
#
|
||||
AC_ARG_WITH([icingaweb_config_path],
|
||||
AS_HELP_STRING([--with-icingaweb-config-path=PATH], [Configuration path for icinga web (default $prefix/config)]),
|
||||
icingaweb_config_path=$withval,
|
||||
icingaweb_config_path=$prefix/config
|
||||
)
|
||||
|
||||
#
|
||||
# Log files
|
||||
#
|
||||
AC_ARG_WITH([icingaweb_log_path],
|
||||
AS_HELP_STRING([--with-icingaweb-log-path=PATH], [Log path for icinga web (default $prefix/var/log)]),
|
||||
icingaweb_log_path=$withval,
|
||||
icingaweb_log_path=$prefix/var/log
|
||||
)
|
||||
|
||||
#
|
||||
# Users for webfiles
|
||||
#
|
||||
|
||||
AC_ARG_WITH([web_user],
|
||||
AS_HELP_STRING([--with-web-user=USER], [username for web writable files (default www-data)]),
|
||||
web_user=$withval,
|
||||
AC_USER_GUESS([www wwwrun www-data apache httpd nobody],[web_user],[www-data])
|
||||
)
|
||||
|
||||
AC_ARG_WITH([web_group],
|
||||
AS_HELP_STRING([--with-web-group=GROUP], [group for web writable files (default www-data)]),
|
||||
web_group=$withval,
|
||||
AC_GROUP_GUESS([www www-data apache httpd nogroup nobody],[web_group], [www-data])
|
||||
)
|
||||
|
||||
AC_ARG_WITH([web_path],
|
||||
AS_HELP_STRING([--with-web-path=PATH], [web sub path (default /icingaweb)]),
|
||||
web_path=$withval,
|
||||
web_path=/icingaweb
|
||||
)
|
||||
|
||||
AC_ARG_WITH([httpd_config_path],
|
||||
AS_HELP_STRING([--with-httpd-config-path=PATH], [Include folder apache2 (default /etc/apache2/conf.d)]),
|
||||
httpd_config_path=$withval,
|
||||
httpd_config_path=AC_PATH_GUESS([/etc/httpd/conf.d /etc/apache2/conf-available /etc/apache2/conf.d /etc/apache/conf.d], [httpd_config_path], [/etc/apache2/conf.d])
|
||||
)
|
||||
|
||||
#
|
||||
# Users and groups for installation
|
||||
#
|
||||
|
||||
AC_ARG_WITH([bin_user],
|
||||
AS_HELP_STRING([--with-bin-user=USER], [user for all other files (default root)]),
|
||||
bin_user=$withval,
|
||||
bin_user=root
|
||||
)
|
||||
|
||||
AC_ARG_WITH([bin_group],
|
||||
AS_HELP_STRING([--with-bin-group=GROUP], [group for all other files (default bin)]),
|
||||
bin_group=$withval,
|
||||
bin_group=bin
|
||||
)
|
||||
|
||||
#
|
||||
# Internal database setup
|
||||
#
|
||||
|
||||
AC_ARG_WITH([internal_db_type],
|
||||
AS_HELP_STRING([--with-internal-db-type=TYPE], [database type to use for internal database (default mysql, supported: pgsql, mysql)]),
|
||||
internal_db_type=$withval,
|
||||
internal_db_type=mysql
|
||||
)
|
||||
|
||||
ICINGA_CHECK_DBTYPE($internal_db_type, [--with-internal-db-type])
|
||||
|
||||
AC_ARG_WITH([internal_db_name],
|
||||
AS_HELP_STRING([--with-internal-db-name=NAME], [database name to use for internal database (default icingaweb)]),
|
||||
internal_db_name=$withval,
|
||||
internal_db_name=icingaweb
|
||||
)
|
||||
|
||||
AC_ARG_WITH([internal_db_host],
|
||||
AS_HELP_STRING([--with-internal-db-host=HOST], [database host to use for internal database (default localhost)]),
|
||||
internal_db_host=$withval,
|
||||
internal_db_host=localhost
|
||||
)
|
||||
|
||||
AC_ARG_WITH([internal_db_port],
|
||||
AS_HELP_STRING([--with-internal-db-port=PORT], [database port to use for internal database (default: 3306 for mysql, 5432 for pgsql)]),
|
||||
internal_db_port=$withval,
|
||||
internal_db_port=db_default_port
|
||||
)
|
||||
|
||||
AC_ARG_WITH([internal_db_password],
|
||||
AS_HELP_STRING([--with-internal-db-password=PASS], [database pass to use for internal database (default icingaweb)]),
|
||||
internal_db_password=$withval,
|
||||
internal_db_password=icingaweb
|
||||
)
|
||||
|
||||
AC_ARG_WITH([internal_db_user],
|
||||
AS_HELP_STRING([--with-internal-db-user=USER], [database user to use for internal database (default icingaweb)]),
|
||||
internal_db_user=$withval,
|
||||
internal_db_user=icingaweb
|
||||
)
|
||||
|
||||
#
|
||||
# Authorization method
|
||||
#
|
||||
|
||||
AC_ARG_WITH([internal_authentication],
|
||||
AC_HELP_STRING([--with-internal-authentication], [use the internal database for authentication (default: yes)]),
|
||||
internal_authentication=$withval,
|
||||
internal_authentication=yes
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ldap_authentication],
|
||||
AC_HELP_STRING([--with-ldap-authentication], [use a ldap server for authentication (default: no)]),
|
||||
ldap_authentication=$withval,
|
||||
ldap_authentication=no
|
||||
)
|
||||
|
||||
#
|
||||
# LDAP Authorization
|
||||
#
|
||||
|
||||
AC_ARG_WITH([ldap_host],
|
||||
AS_HELP_STRING([--with-ldap-host=HOST], [host to use for authentication via ldap (default localhost)]),
|
||||
ldap_host=$withval,
|
||||
ldap_host=localhost
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ldap_port],
|
||||
AS_HELP_STRING([--with-ldap-port=PORT], [port to use for authentication via ldap (default 389)]),
|
||||
ldap_port=$withval,
|
||||
ldap_port=389
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ldap_binddn],
|
||||
AS_HELP_STRING([--with-ldap-binddn=DN], [dn to use for retrieving user information via ldap (default cn=admin, cn=config)]),
|
||||
ldap_binddn=$withval,
|
||||
ldap_binddn=["cn=admin,cn=config"]
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ldap_bindpass],
|
||||
AS_HELP_STRING([--with-ldap-bindpass=PASS], [password to use for retrieving user information via ldap (default admin)]),
|
||||
ldap_bindpass=$withval,
|
||||
ldap_bindpass=["admin"]
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ldap_rootdn],
|
||||
AS_HELP_STRING([--with-ldap-rootdn=LDAP_ATTRIBUTE], [root dn to use for user lookup (default ou=people, dc=icinga, dc=org)]),
|
||||
ldap_rootdn=$withval,
|
||||
ldap_rootdn=["ou=people, dc=icinga, dc=org"]
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ldap_user_objectclass],
|
||||
AS_HELP_STRING([--with-ldap-user-objectclass=LDAP_OBJECT_CLASS], [ldap object class to use for user authentication (default: inetOrgPerson)]),
|
||||
ldap_user_objectclass=$withval,
|
||||
ldap_user_objectclass="inetOrgPerson"
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ldap_attribute_username],
|
||||
AS_HELP_STRING([--with-ldap-attribute-username=LDAP_ATTRIBUTE], [user attribute to use for the username (default: uid)]),
|
||||
ldap_attribute_username=$withval,
|
||||
ldap_attribute_username="uid"
|
||||
)
|
||||
|
||||
#
|
||||
# Icinga backend selection
|
||||
#
|
||||
|
||||
AC_ARG_WITH([icinga_backend],
|
||||
AS_HELP_STRING([--with-icinga-backend=(ido, statusdat, livestatus)], [backend to use for rb (default: statusdat)]),
|
||||
icinga_backend=$withval,
|
||||
icinga_backend="statusdat"
|
||||
)
|
||||
|
||||
ICINGA_CHECK_BACKENDTYPE($icinga_backend, [--with-icinga-backend])
|
||||
|
||||
#
|
||||
# Ido settings
|
||||
#
|
||||
|
||||
AC_ARG_WITH([ido_db_type],
|
||||
AS_HELP_STRING([--with-ido-db-type=(mysql, pgsql)], [database engine to use for retrieving data from the ido db (default: mysql)]),
|
||||
ido_db_type=$withval,
|
||||
ido_db_type="mysql"
|
||||
)
|
||||
|
||||
ICINGA_CHECK_DBTYPE($ido_db_type, [--with-ido-db-type])
|
||||
|
||||
AC_ARG_WITH([ido_host],
|
||||
AS_HELP_STRING([--with-ido-host=HOST], [host to use for retrieving data from the ido db (default: localhost)]),
|
||||
ido_host=$withval,
|
||||
ido_host="localhost"
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ido_port],
|
||||
AS_HELP_STRING([--with-ido-port=PORT], [backend to use for retrieving data from the ido db (default: 3306 for mysql. 5432 for pgsql)]),
|
||||
ido_port=$withval,
|
||||
ido_port=db_default_port
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ido_db_name],
|
||||
AS_HELP_STRING([--with-ido-db-name=DATABASE], [database name to use for retrieving data from the ido db (default: icinga)]),
|
||||
ido_db_name=$withval,
|
||||
ido_db_name="icinga"
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ido_user],
|
||||
AS_HELP_STRING([--with-ido-user=USER], [user to use for retrieving data from the ido db (default: icinga)]),
|
||||
ido_user=$withval,
|
||||
ido_user="icinga"
|
||||
)
|
||||
|
||||
AC_ARG_WITH([ido_password],
|
||||
AS_HELP_STRING([--with-ido-password=PASSWORD], [password to use for retrieving data from the ido db (default: icinga)]),
|
||||
ido_password=$withval,
|
||||
ido_password="icinga"
|
||||
)
|
||||
|
||||
#
|
||||
# Statusdat file location
|
||||
#
|
||||
|
||||
AC_ARG_WITH([statusdat_file],
|
||||
AS_HELP_STRING([--with-statusdat-file=FILE], [location of the status.dat file when retrieving data from status.dat (default: /usr/local/icinga/var/status.dat)]),
|
||||
statusdat_file=$withval,
|
||||
statusdat_file="/usr/local/icinga/var/status.dat"
|
||||
)
|
||||
|
||||
AC_ARG_WITH([objects_cache_file],
|
||||
AS_HELP_STRING([--with-objects-cache-file=FILE], [location of the objects.cache file when retrieving data from status.dat (default: /usr/local/icinga/var/objects.cache)]),
|
||||
objects_cache_file=$withval,
|
||||
objects_cache_file="/usr/local/icinga/var/objects.cache"
|
||||
)
|
||||
|
||||
#
|
||||
# Livestatus connection
|
||||
#
|
||||
|
||||
AC_ARG_WITH([livestatus_socket],
|
||||
AS_HELP_STRING([--with-livestatus-socket=FILE], [location of the livestatus socket (default: /usr/local/icinga/var/rw/live)]),
|
||||
livestatus_socket=$withval,
|
||||
livestatus_socket="/usr/local/icinga/var/rw/live"
|
||||
)
|
||||
|
||||
#
|
||||
# Icinga commandpipe
|
||||
#
|
||||
|
||||
AC_ARG_WITH([icinga_commandpipe],
|
||||
AS_HELP_STRING([--with-icinga-commandpipe=FILE], [location of the command pipe used for sending commands (default: /usr/local/icinga/var/rw/icinga.cmd)]),
|
||||
icinga_commandpipe=$withval,
|
||||
icinga_commandpipe="/usr/local/icinga/var/rw/icinga.cmd"
|
||||
)
|
||||
|
||||
AC_ARG_WITH([objects_cache_file],
|
||||
AS_HELP_STRING([--with-objects-file=FILE], [location of the objects.cache file when retrieving data from status.dat (default: /usr/local/icinga/var/objects.cache)]),
|
||||
objects_cache_file=$withval,
|
||||
objects_cache_file="/usr/local/icinga/var/objects.cache"
|
||||
)
|
||||
|
||||
#
|
||||
# Livestatus connection
|
||||
#
|
||||
|
||||
AC_ARG_WITH([livestatus_socket],
|
||||
AS_HELP_STRING([--with-livestatus-socket=FILE], [location of the livestatus socket (default: /usr/local/icinga/var/rw/live)]),
|
||||
livestatus_socket=$withval,
|
||||
livestatus_socket="/usr/local/icinga/var/rw/live"
|
||||
)
|
||||
|
||||
#
|
||||
# Icinga commandpipe
|
||||
#
|
||||
|
||||
AC_ARG_WITH([icinga_commandpipe],
|
||||
AS_HELP_STRING([--with-icinga-commandpipe=FILE], [location of the command pipe used for sending commands (default: /usr/local/icinga/var/rw/icinga.cmd)]),
|
||||
icinga_commandpipe=$withval,
|
||||
icinga_commandpipe="/usr/local/icinga/var/rw/icinga.cmd"
|
||||
)
|
||||
|
||||
# Installation options
|
||||
INSTALL_OPTS="-o $bin_user -g $bin_group"
|
||||
INSTALL_OPTS_WEB="-o $web_user -g $web_group"
|
||||
|
||||
AS_IF([test "x$internal_db_type" = xmysql], [
|
||||
AC_CHECK_PHP_INCLUDE([Zend/Db/Adapter/Pdo/Mysql.php],[Zend Framework - MySQL PDO Adapter])
|
||||
AC_CHECK_PHP_MODULE([mysql])
|
||||
AS_IF([test "x$internal_db_port" == xdb_default_port], [internal_db_port=3306])
|
||||
])
|
||||
|
||||
AS_IF([test "x$ido_db_type" = xmysql], [
|
||||
AC_CHECK_PHP_INCLUDE([Zend/Db/Adapter/Pdo/Mysql.php],[Zend Framework - MySQL PDO Adapter])
|
||||
AC_CHECK_PHP_MODULE([mysql])
|
||||
AS_IF([test "x$ido_port" = xdb_default_port], [ido_port=3306])
|
||||
])
|
||||
|
||||
AS_IF([test "x$internal_db_type" = xpgsql], [
|
||||
AC_CHECK_PHP_INCLUDE([Zend/Db/Adapter/Pdo/Pgsql.php],[Zend Framework - PostgreSQL PDO Adapter])
|
||||
AC_CHECK_PHP_MODULE([pgsql])
|
||||
AS_IF([test "x$internal_db_port" = xdb_default_port], [internal_db_port=5432])
|
||||
])
|
||||
|
||||
AS_IF([test "x$ido_db_type" = xpgsql], [
|
||||
AC_CHECK_PHP_INCLUDE([Zend/Db/Adapter/Pdo/Pgsql.php],[Zend Framework - PostgreSQL PDO Adapter])
|
||||
AC_CHECK_PHP_MODULE([pgsql])
|
||||
AS_IF([test "x$ido_port" = xdb_default_port], [ido_port=5432])
|
||||
])
|
||||
|
||||
#
|
||||
# Disable authentication backends
|
||||
#
|
||||
|
||||
ido_enabled="disabled = \"1\""
|
||||
statusdat_enabled="disabled = \"1\""
|
||||
livestatus_enabled="disabled = \"1\""
|
||||
|
||||
AS_CASE([$icinga_backend],
|
||||
["ido"], [ido_enabled=""],
|
||||
["statusdat"], [statusdat_enabled=""],
|
||||
["livestatus"], [livestatus_enabled=""],
|
||||
[statusdat_enabled=""])
|
||||
|
||||
ldap_auth_disabled="disabled = \"1\""
|
||||
AS_IF([test "x$ldap_authentication" != xno],
|
||||
AC_CHECK_PHP_MODULE([ldap])
|
||||
ldap_auth_disabled=""
|
||||
)
|
||||
|
||||
internal_auth_disabled="disabled = \"1\""
|
||||
AS_IF([test "x$internal_authentication" != xno],
|
||||
AC_CHECK_PHP_MODULE([ldap])
|
||||
internal_auth_disabled=""
|
||||
)
|
||||
|
||||
#
|
||||
# Substitution variables
|
||||
#
|
||||
|
||||
# Installation directives
|
||||
AC_SUBST(app_name)
|
||||
AC_SUBST(web_user)
|
||||
AC_SUBST(web_group)
|
||||
AC_SUBST(web_path)
|
||||
AC_SUBST(httpd_config_path)
|
||||
AC_SUBST(bin_user)
|
||||
AC_SUBST(bin_group)
|
||||
AC_SUBST(icingaweb_config_path)
|
||||
AC_SUBST(icingaweb_log_path)
|
||||
|
||||
# Internal db setup
|
||||
AC_SUBST(internal_db_type)
|
||||
AC_SUBST(internal_db_name)
|
||||
AC_SUBST(internal_db_host)
|
||||
AC_SUBST(internal_db_port)
|
||||
AC_SUBST(internal_db_user)
|
||||
AC_SUBST(internal_db_password)
|
||||
|
||||
# ldap setup
|
||||
AC_SUBST(ldap_host)
|
||||
AC_SUBST(ldap_port)
|
||||
AC_SUBST(ldap_rootdn)
|
||||
AC_SUBST(ldap_binddn)
|
||||
AC_SUBST(ldap_bindpass)
|
||||
AC_SUBST(ldap_user_objectclass)
|
||||
AC_SUBST(ldap_attribute_basedn)
|
||||
AC_SUBST(ldap_attribute_username)
|
||||
|
||||
# backend setup
|
||||
AC_SUBST(icinga_backend)
|
||||
|
||||
# ido backend variables
|
||||
AC_SUBST(ido_enabled)
|
||||
AC_SUBST(ido_db_type)
|
||||
AC_SUBST(ido_host)
|
||||
AC_SUBST(ido_port)
|
||||
AC_SUBST(ido_db_name)
|
||||
AC_SUBST(ido_user)
|
||||
AC_SUBST(ido_password)
|
||||
|
||||
# status.dat backend
|
||||
AC_SUBST(statusdat_enabled)
|
||||
AC_SUBST(statusdat_file)
|
||||
AC_SUBST(objects_cache_file)
|
||||
|
||||
# livestatus backend
|
||||
AC_SUBST(livestatus_socket)
|
||||
AC_SUBST(livestatus_enabled)
|
||||
|
||||
# command pipe
|
||||
AC_SUBST(icinga_commandpipe)
|
||||
|
||||
# Comment placeholders for toggling backends
|
||||
|
||||
AC_SUBST(ldap_auth_disabled)
|
||||
AC_SUBST(internal_auth_disabled)
|
||||
|
||||
# Application and installation
|
||||
AC_SUBST(PHP)
|
||||
AC_SUBST(INSTALL_OPTS)
|
||||
AC_SUBST(INSTALL_OPTS_WEB)
|
||||
|
||||
#
|
||||
# Create config files
|
||||
#
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
config/authentication.ini
|
||||
config/config.ini
|
||||
config/resources.ini
|
||||
config/modules/monitoring/backends.ini
|
||||
config/modules/monitoring/instances.ini
|
||||
etc/apache/icingaweb.conf
|
||||
])
|
||||
|
||||
#
|
||||
# Commit and write
|
||||
#
|
||||
AC_OUTPUT
|
|
@ -1,27 +0,0 @@
|
|||
# Create API documentation
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You need phpDocumentor 2 installed on your system to create the api
|
||||
documentation. Please visit [phpdoc's website](http://phpdoc.org/) for more
|
||||
information. Additionally, the graphviz package is required to be installed.
|
||||
|
||||
## Configuration
|
||||
|
||||
phpDocumentator is configured with xml configuration reside in doc/phpdoc.xml.
|
||||
In there you'll find the target path where the documentation is created as
|
||||
html. Default location is doc/api/. Just point to index.html in this directory
|
||||
with a browser.
|
||||
|
||||
If you generated the documentation already, you can follow [this link](apidoc/idnex.html).
|
||||
|
||||
## Generation
|
||||
|
||||
Change to Icinga Web 2 root directory (source tree) and run:
|
||||
|
||||
bin/createapidoc.sh
|
||||
|
||||
## Options for createapidoc.sh
|
||||
|
||||
--build Optional, silent build mode
|
||||
--help Displays help message
|
|
@ -1 +0,0 @@
|
|||
icingaweb.conf
|
|
@ -1,32 +0,0 @@
|
|||
Alias @web_path@ "@prefix@/public"
|
||||
|
||||
<Directory "@prefix@/public">
|
||||
Options SymLinksIfOwnerMatch
|
||||
AllowOverride None
|
||||
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
<RequireAll>
|
||||
Require all granted
|
||||
</RequireAll>
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_authz_core.c>
|
||||
# Apache 2.2
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</IfModule>
|
||||
|
||||
SetEnv ICINGAWEB_CONFIGDIR @icingaweb_config_path@
|
||||
|
||||
EnableSendfile Off
|
||||
|
||||
RewriteEngine on
|
||||
RewriteBase @web_path@/
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^.*$ - [NC,L]
|
||||
RewriteRule ^.*$ index.php [NC,L]
|
||||
</Directory>
|
||||
|
520
install-sh
520
install-sh
|
@ -1,520 +0,0 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -1,6 +0,0 @@
|
|||
GCC=gcc
|
||||
PROGRAM=extcmd_test
|
||||
SOURCE=${PROGRAM}.c
|
||||
|
||||
all:
|
||||
cd bin/ && gcc ${SOURCE} -o ${PROGRAM}
|
|
@ -1,7 +0,0 @@
|
|||
#
|
||||
# Tools for testing icinga2
|
||||
#
|
||||
|
||||
extcmd_test just receives an icinga external command from stdin and returns whether it's a recognized command
|
||||
or if there are any errors. To build it, just type gcc -o extcmd_test ./extcmd_test.c, there shouldn't be any
|
||||
dependencies that need linker flags
|
|
@ -1,520 +0,0 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* Icinga Common Header File
|
||||
*
|
||||
* Copyright (c) 1999-2009 Ethan Galstad (egalstad@nagios.org)
|
||||
* Copyright (c) 2009-2012 Nagios Core Development Team and Community Contributors
|
||||
* Copyright (c) 2009-2012 Icinga Development Team (http://www.icinga.org)
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
************************************************************************/
|
||||
|
||||
#include "shared.h"
|
||||
|
||||
#define PROGRAM_NAME "Icinga"
|
||||
#define PROGRAM_NAME_UC "ICINGA"
|
||||
#define PROGRAM_NAME_LC "icinga"
|
||||
#define PROGRAM_VERSION "1.8.0dev"
|
||||
#define PROGRAM_MODIFICATION_DATE "10-17-2012"
|
||||
|
||||
/*#define DEBUG_CHECK_IPC 1 */
|
||||
/*#define DEBUG_CHECK_IPC2 1*/
|
||||
|
||||
|
||||
|
||||
/* daemon is thread safe */
|
||||
#ifdef NSCORE
|
||||
#ifndef _REENTRANT
|
||||
#define _REENTRANT
|
||||
#endif
|
||||
#ifndef _THREAD_SAFE
|
||||
#define _THREAD_SAFE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Experimental performance tweaks - use with caution */
|
||||
#undef USE_MEMORY_PERFORMANCE_TWEAKS
|
||||
|
||||
/* my_free has been freed from bondage as a function */
|
||||
#define my_free(ptr) do { if(ptr) { free(ptr); ptr = NULL; } } while(0)
|
||||
|
||||
|
||||
|
||||
/***************************** COMMANDS *********************************/
|
||||
|
||||
#define CMD_NONE 0
|
||||
|
||||
#define CMD_ADD_HOST_COMMENT 1
|
||||
#define CMD_DEL_HOST_COMMENT 2
|
||||
|
||||
#define CMD_ADD_SVC_COMMENT 3
|
||||
#define CMD_DEL_SVC_COMMENT 4
|
||||
|
||||
#define CMD_ENABLE_SVC_CHECK 5
|
||||
#define CMD_DISABLE_SVC_CHECK 6
|
||||
|
||||
#define CMD_SCHEDULE_SVC_CHECK 7
|
||||
|
||||
#define CMD_DELAY_SVC_NOTIFICATION 9
|
||||
|
||||
#define CMD_DELAY_HOST_NOTIFICATION 10
|
||||
|
||||
#define CMD_DISABLE_NOTIFICATIONS 11
|
||||
#define CMD_ENABLE_NOTIFICATIONS 12
|
||||
|
||||
#define CMD_RESTART_PROCESS 13
|
||||
#define CMD_SHUTDOWN_PROCESS 14
|
||||
|
||||
#define CMD_ENABLE_HOST_SVC_CHECKS 15
|
||||
#define CMD_DISABLE_HOST_SVC_CHECKS 16
|
||||
|
||||
#define CMD_SCHEDULE_HOST_SVC_CHECKS 17
|
||||
|
||||
#define CMD_DELAY_HOST_SVC_NOTIFICATIONS 19 /* currently unimplemented */
|
||||
|
||||
#define CMD_DEL_ALL_HOST_COMMENTS 20
|
||||
#define CMD_DEL_ALL_SVC_COMMENTS 21
|
||||
|
||||
#define CMD_ENABLE_SVC_NOTIFICATIONS 22
|
||||
#define CMD_DISABLE_SVC_NOTIFICATIONS 23
|
||||
#define CMD_ENABLE_HOST_NOTIFICATIONS 24
|
||||
#define CMD_DISABLE_HOST_NOTIFICATIONS 25
|
||||
#define CMD_ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST 26
|
||||
#define CMD_DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST 27
|
||||
#define CMD_ENABLE_HOST_SVC_NOTIFICATIONS 28
|
||||
#define CMD_DISABLE_HOST_SVC_NOTIFICATIONS 29
|
||||
|
||||
#define CMD_PROCESS_SERVICE_CHECK_RESULT 30
|
||||
|
||||
#define CMD_SAVE_STATE_INFORMATION 31
|
||||
#define CMD_READ_STATE_INFORMATION 32
|
||||
|
||||
#define CMD_ACKNOWLEDGE_HOST_PROBLEM 33
|
||||
#define CMD_ACKNOWLEDGE_SVC_PROBLEM 34
|
||||
|
||||
#define CMD_START_EXECUTING_SVC_CHECKS 35
|
||||
#define CMD_STOP_EXECUTING_SVC_CHECKS 36
|
||||
|
||||
#define CMD_START_ACCEPTING_PASSIVE_SVC_CHECKS 37
|
||||
#define CMD_STOP_ACCEPTING_PASSIVE_SVC_CHECKS 38
|
||||
|
||||
#define CMD_ENABLE_PASSIVE_SVC_CHECKS 39
|
||||
#define CMD_DISABLE_PASSIVE_SVC_CHECKS 40
|
||||
|
||||
#define CMD_ENABLE_EVENT_HANDLERS 41
|
||||
#define CMD_DISABLE_EVENT_HANDLERS 42
|
||||
|
||||
#define CMD_ENABLE_HOST_EVENT_HANDLER 43
|
||||
#define CMD_DISABLE_HOST_EVENT_HANDLER 44
|
||||
|
||||
#define CMD_ENABLE_SVC_EVENT_HANDLER 45
|
||||
#define CMD_DISABLE_SVC_EVENT_HANDLER 46
|
||||
|
||||
#define CMD_ENABLE_HOST_CHECK 47
|
||||
#define CMD_DISABLE_HOST_CHECK 48
|
||||
|
||||
#define CMD_START_OBSESSING_OVER_SVC_CHECKS 49
|
||||
#define CMD_STOP_OBSESSING_OVER_SVC_CHECKS 50
|
||||
|
||||
#define CMD_REMOVE_HOST_ACKNOWLEDGEMENT 51
|
||||
#define CMD_REMOVE_SVC_ACKNOWLEDGEMENT 52
|
||||
|
||||
#define CMD_SCHEDULE_FORCED_HOST_SVC_CHECKS 53
|
||||
#define CMD_SCHEDULE_FORCED_SVC_CHECK 54
|
||||
|
||||
#define CMD_SCHEDULE_HOST_DOWNTIME 55
|
||||
#define CMD_SCHEDULE_SVC_DOWNTIME 56
|
||||
|
||||
#define CMD_ENABLE_HOST_FLAP_DETECTION 57
|
||||
#define CMD_DISABLE_HOST_FLAP_DETECTION 58
|
||||
|
||||
#define CMD_ENABLE_SVC_FLAP_DETECTION 59
|
||||
#define CMD_DISABLE_SVC_FLAP_DETECTION 60
|
||||
|
||||
#define CMD_ENABLE_FLAP_DETECTION 61
|
||||
#define CMD_DISABLE_FLAP_DETECTION 62
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_SVC_NOTIFICATIONS 63
|
||||
#define CMD_DISABLE_HOSTGROUP_SVC_NOTIFICATIONS 64
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_HOST_NOTIFICATIONS 65
|
||||
#define CMD_DISABLE_HOSTGROUP_HOST_NOTIFICATIONS 66
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_SVC_CHECKS 67
|
||||
#define CMD_DISABLE_HOSTGROUP_SVC_CHECKS 68
|
||||
|
||||
#define CMD_CANCEL_HOST_DOWNTIME 69 /* not internally implemented */
|
||||
#define CMD_CANCEL_SVC_DOWNTIME 70 /* not internally implemented */
|
||||
|
||||
#define CMD_CANCEL_ACTIVE_HOST_DOWNTIME 71 /* old - no longer used */
|
||||
#define CMD_CANCEL_PENDING_HOST_DOWNTIME 72 /* old - no longer used */
|
||||
|
||||
#define CMD_CANCEL_ACTIVE_SVC_DOWNTIME 73 /* old - no longer used */
|
||||
#define CMD_CANCEL_PENDING_SVC_DOWNTIME 74 /* old - no longer used */
|
||||
|
||||
#define CMD_CANCEL_ACTIVE_HOST_SVC_DOWNTIME 75 /* unimplemented */
|
||||
#define CMD_CANCEL_PENDING_HOST_SVC_DOWNTIME 76 /* unimplemented */
|
||||
|
||||
#define CMD_FLUSH_PENDING_COMMANDS 77
|
||||
|
||||
#define CMD_DEL_HOST_DOWNTIME 78
|
||||
#define CMD_DEL_SVC_DOWNTIME 79
|
||||
|
||||
#define CMD_ENABLE_FAILURE_PREDICTION 80
|
||||
#define CMD_DISABLE_FAILURE_PREDICTION 81
|
||||
|
||||
#define CMD_ENABLE_PERFORMANCE_DATA 82
|
||||
#define CMD_DISABLE_PERFORMANCE_DATA 83
|
||||
|
||||
#define CMD_SCHEDULE_HOSTGROUP_HOST_DOWNTIME 84
|
||||
#define CMD_SCHEDULE_HOSTGROUP_SVC_DOWNTIME 85
|
||||
#define CMD_SCHEDULE_HOST_SVC_DOWNTIME 86
|
||||
|
||||
/* new commands in Nagios 2.x found below... */
|
||||
#define CMD_PROCESS_HOST_CHECK_RESULT 87
|
||||
|
||||
#define CMD_START_EXECUTING_HOST_CHECKS 88
|
||||
#define CMD_STOP_EXECUTING_HOST_CHECKS 89
|
||||
|
||||
#define CMD_START_ACCEPTING_PASSIVE_HOST_CHECKS 90
|
||||
#define CMD_STOP_ACCEPTING_PASSIVE_HOST_CHECKS 91
|
||||
|
||||
#define CMD_ENABLE_PASSIVE_HOST_CHECKS 92
|
||||
#define CMD_DISABLE_PASSIVE_HOST_CHECKS 93
|
||||
|
||||
#define CMD_START_OBSESSING_OVER_HOST_CHECKS 94
|
||||
#define CMD_STOP_OBSESSING_OVER_HOST_CHECKS 95
|
||||
|
||||
#define CMD_SCHEDULE_HOST_CHECK 96
|
||||
#define CMD_SCHEDULE_FORCED_HOST_CHECK 98
|
||||
|
||||
#define CMD_START_OBSESSING_OVER_SVC 99
|
||||
#define CMD_STOP_OBSESSING_OVER_SVC 100
|
||||
|
||||
#define CMD_START_OBSESSING_OVER_HOST 101
|
||||
#define CMD_STOP_OBSESSING_OVER_HOST 102
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_HOST_CHECKS 103
|
||||
#define CMD_DISABLE_HOSTGROUP_HOST_CHECKS 104
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS 105
|
||||
#define CMD_DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS 106
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS 107
|
||||
#define CMD_DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS 108
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS 109
|
||||
#define CMD_DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS 110
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS 111
|
||||
#define CMD_DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS 112
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_SVC_CHECKS 113
|
||||
#define CMD_DISABLE_SERVICEGROUP_SVC_CHECKS 114
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_HOST_CHECKS 115
|
||||
#define CMD_DISABLE_SERVICEGROUP_HOST_CHECKS 116
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS 117
|
||||
#define CMD_DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS 118
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS 119
|
||||
#define CMD_DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS 120
|
||||
|
||||
#define CMD_SCHEDULE_SERVICEGROUP_HOST_DOWNTIME 121
|
||||
#define CMD_SCHEDULE_SERVICEGROUP_SVC_DOWNTIME 122
|
||||
|
||||
#define CMD_CHANGE_GLOBAL_HOST_EVENT_HANDLER 123
|
||||
#define CMD_CHANGE_GLOBAL_SVC_EVENT_HANDLER 124
|
||||
|
||||
#define CMD_CHANGE_HOST_EVENT_HANDLER 125
|
||||
#define CMD_CHANGE_SVC_EVENT_HANDLER 126
|
||||
|
||||
#define CMD_CHANGE_HOST_CHECK_COMMAND 127
|
||||
#define CMD_CHANGE_SVC_CHECK_COMMAND 128
|
||||
|
||||
#define CMD_CHANGE_NORMAL_HOST_CHECK_INTERVAL 129
|
||||
#define CMD_CHANGE_NORMAL_SVC_CHECK_INTERVAL 130
|
||||
#define CMD_CHANGE_RETRY_SVC_CHECK_INTERVAL 131
|
||||
|
||||
#define CMD_CHANGE_MAX_HOST_CHECK_ATTEMPTS 132
|
||||
#define CMD_CHANGE_MAX_SVC_CHECK_ATTEMPTS 133
|
||||
|
||||
#define CMD_SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME 134
|
||||
|
||||
#define CMD_ENABLE_HOST_AND_CHILD_NOTIFICATIONS 135
|
||||
#define CMD_DISABLE_HOST_AND_CHILD_NOTIFICATIONS 136
|
||||
|
||||
#define CMD_SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME 137
|
||||
|
||||
#define CMD_ENABLE_SERVICE_FRESHNESS_CHECKS 138
|
||||
#define CMD_DISABLE_SERVICE_FRESHNESS_CHECKS 139
|
||||
|
||||
#define CMD_ENABLE_HOST_FRESHNESS_CHECKS 140
|
||||
#define CMD_DISABLE_HOST_FRESHNESS_CHECKS 141
|
||||
|
||||
#define CMD_SET_HOST_NOTIFICATION_NUMBER 142
|
||||
#define CMD_SET_SVC_NOTIFICATION_NUMBER 143
|
||||
|
||||
/* new commands in Nagios 3.x found below... */
|
||||
#define CMD_CHANGE_HOST_CHECK_TIMEPERIOD 144
|
||||
#define CMD_CHANGE_SVC_CHECK_TIMEPERIOD 145
|
||||
|
||||
#define CMD_PROCESS_FILE 146
|
||||
|
||||
#define CMD_CHANGE_CUSTOM_HOST_VAR 147
|
||||
#define CMD_CHANGE_CUSTOM_SVC_VAR 148
|
||||
#define CMD_CHANGE_CUSTOM_CONTACT_VAR 149
|
||||
|
||||
#define CMD_ENABLE_CONTACT_HOST_NOTIFICATIONS 150
|
||||
#define CMD_DISABLE_CONTACT_HOST_NOTIFICATIONS 151
|
||||
#define CMD_ENABLE_CONTACT_SVC_NOTIFICATIONS 152
|
||||
#define CMD_DISABLE_CONTACT_SVC_NOTIFICATIONS 153
|
||||
|
||||
#define CMD_ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS 154
|
||||
#define CMD_DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS 155
|
||||
#define CMD_ENABLE_CONTACTGROUP_SVC_NOTIFICATIONS 156
|
||||
#define CMD_DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS 157
|
||||
|
||||
#define CMD_CHANGE_RETRY_HOST_CHECK_INTERVAL 158
|
||||
|
||||
#define CMD_SEND_CUSTOM_HOST_NOTIFICATION 159
|
||||
#define CMD_SEND_CUSTOM_SVC_NOTIFICATION 160
|
||||
|
||||
#define CMD_CHANGE_HOST_NOTIFICATION_TIMEPERIOD 161
|
||||
#define CMD_CHANGE_SVC_NOTIFICATION_TIMEPERIOD 162
|
||||
#define CMD_CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD 163
|
||||
#define CMD_CHANGE_CONTACT_SVC_NOTIFICATION_TIMEPERIOD 164
|
||||
|
||||
#define CMD_CHANGE_HOST_MODATTR 165
|
||||
#define CMD_CHANGE_SVC_MODATTR 166
|
||||
#define CMD_CHANGE_CONTACT_MODATTR 167
|
||||
#define CMD_CHANGE_CONTACT_MODHATTR 168
|
||||
#define CMD_CHANGE_CONTACT_MODSATTR 169
|
||||
|
||||
#define CMD_SYNC_STATE_INFORMATION 170
|
||||
|
||||
#define CMD_DEL_DOWNTIME_BY_HOST_NAME 171
|
||||
#define CMD_DEL_DOWNTIME_BY_HOSTGROUP_NAME 172
|
||||
#define CMD_DEL_DOWNTIME_BY_START_TIME_COMMENT 173
|
||||
|
||||
/* Added for expiring Acknowlwdgements */
|
||||
|
||||
#define CMD_ACKNOWLEDGE_HOST_PROBLEM_EXPIRE 174
|
||||
#define CMD_ACKNOWLEDGE_SVC_PROBLEM_EXPIRE 175
|
||||
|
||||
/* for disabled notifications expiry */
|
||||
#define CMD_DISABLE_NOTIFICATIONS_EXPIRE_TIME 176
|
||||
|
||||
/* custom command introduced in Nagios 3.x */
|
||||
#define CMD_CUSTOM_COMMAND 999
|
||||
|
||||
|
||||
|
||||
/************************ SERVICE CHECK TYPES ****************************/
|
||||
|
||||
#define SERVICE_CHECK_ACTIVE 0 /* Icinga performed the service check */
|
||||
#define SERVICE_CHECK_PASSIVE 1 /* the service check result was submitted by an external source */
|
||||
|
||||
|
||||
/************************** HOST CHECK TYPES *****************************/
|
||||
|
||||
#define HOST_CHECK_ACTIVE 0 /* Icinga performed the host check */
|
||||
#define HOST_CHECK_PASSIVE 1 /* the host check result was submitted by an external source */
|
||||
|
||||
|
||||
/************************ SERVICE STATE TYPES ****************************/
|
||||
|
||||
#define SOFT_STATE 0
|
||||
#define HARD_STATE 1
|
||||
|
||||
|
||||
/************************* SCHEDULED DOWNTIME TYPES **********************/
|
||||
|
||||
#define SERVICE_DOWNTIME 1 /* service downtime */
|
||||
#define HOST_DOWNTIME 2 /* host downtime */
|
||||
#define ANY_DOWNTIME 3 /* host or service downtime */
|
||||
|
||||
|
||||
/************************** NOTIFICATION OPTIONS *************************/
|
||||
|
||||
#define NOTIFICATION_OPTION_NONE 0
|
||||
#define NOTIFICATION_OPTION_BROADCAST 1
|
||||
#define NOTIFICATION_OPTION_FORCED 2
|
||||
#define NOTIFICATION_OPTION_INCREMENT 4
|
||||
|
||||
|
||||
/************************** ACKNOWLEDGEMENT TYPES ************************/
|
||||
|
||||
#define HOST_ACKNOWLEDGEMENT 0
|
||||
#define SERVICE_ACKNOWLEDGEMENT 1
|
||||
|
||||
#define ACKNOWLEDGEMENT_NONE 0
|
||||
#define ACKNOWLEDGEMENT_NORMAL 1
|
||||
#define ACKNOWLEDGEMENT_STICKY 2
|
||||
|
||||
|
||||
/**************************** DEPENDENCY TYPES ***************************/
|
||||
|
||||
#define NOTIFICATION_DEPENDENCY 1
|
||||
#define EXECUTION_DEPENDENCY 2
|
||||
|
||||
|
||||
|
||||
/********************** HOST/SERVICE CHECK OPTIONS ***********************/
|
||||
|
||||
#define CHECK_OPTION_NONE 0 /* no check options */
|
||||
#define CHECK_OPTION_FORCE_EXECUTION 1 /* force execution of a check (ignores disabled services/hosts, invalid timeperiods) */
|
||||
#define CHECK_OPTION_FRESHNESS_CHECK 2 /* this is a freshness check */
|
||||
#define CHECK_OPTION_ORPHAN_CHECK 4 /* this is an orphan check */
|
||||
|
||||
|
||||
/**************************** PROGRAM MODES ******************************/
|
||||
|
||||
#define STANDBY_MODE 0
|
||||
#define ACTIVE_MODE 1
|
||||
|
||||
|
||||
/************************** LOG ROTATION MODES ***************************/
|
||||
|
||||
#define LOG_ROTATION_NONE 0
|
||||
#define LOG_ROTATION_HOURLY 1
|
||||
#define LOG_ROTATION_DAILY 2
|
||||
#define LOG_ROTATION_WEEKLY 3
|
||||
#define LOG_ROTATION_MONTHLY 4
|
||||
|
||||
|
||||
/***************************** LOG VERSIONS ******************************/
|
||||
|
||||
#define LOG_VERSION_1 "1.0"
|
||||
#define LOG_VERSION_2 "2.0"
|
||||
|
||||
|
||||
|
||||
/*************************** CHECK STATISTICS ****************************/
|
||||
|
||||
#define ACTIVE_SCHEDULED_SERVICE_CHECK_STATS 0
|
||||
#define ACTIVE_ONDEMAND_SERVICE_CHECK_STATS 1
|
||||
#define PASSIVE_SERVICE_CHECK_STATS 2
|
||||
#define ACTIVE_SCHEDULED_HOST_CHECK_STATS 3
|
||||
#define ACTIVE_ONDEMAND_HOST_CHECK_STATS 4
|
||||
#define PASSIVE_HOST_CHECK_STATS 5
|
||||
#define ACTIVE_CACHED_HOST_CHECK_STATS 6
|
||||
#define ACTIVE_CACHED_SERVICE_CHECK_STATS 7
|
||||
#define EXTERNAL_COMMAND_STATS 8
|
||||
#define PARALLEL_HOST_CHECK_STATS 9
|
||||
#define SERIAL_HOST_CHECK_STATS 10
|
||||
#define MAX_CHECK_STATS_TYPES 11
|
||||
|
||||
|
||||
/************************* GENERAL DEFINITIONS **************************/
|
||||
|
||||
#define OK 0
|
||||
#define ERROR -2 /* value was changed from -1 so as to not interfere with STATUS_UNKNOWN plugin result */
|
||||
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#elif (TRUE!=1)
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#elif (FALSE!=0)
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
|
||||
/****************** HOST CONFIG FILE READING OPTIONS ********************/
|
||||
|
||||
#define READ_HOSTS 1
|
||||
#define READ_HOSTGROUPS 2
|
||||
#define READ_CONTACTS 4
|
||||
#define READ_CONTACTGROUPS 8
|
||||
#define READ_SERVICES 16
|
||||
#define READ_COMMANDS 32
|
||||
#define READ_TIMEPERIODS 64
|
||||
#define READ_SERVICEESCALATIONS 128
|
||||
#define READ_HOSTGROUPESCALATIONS 256 /* no longer implemented */
|
||||
#define READ_SERVICEDEPENDENCIES 512
|
||||
#define READ_HOSTDEPENDENCIES 1024
|
||||
#define READ_HOSTESCALATIONS 2048
|
||||
#define READ_HOSTEXTINFO 4096
|
||||
#define READ_SERVICEEXTINFO 8192
|
||||
#define READ_SERVICEGROUPS 16384
|
||||
#define READ_MODULES 32768
|
||||
|
||||
#define READ_ALL_OBJECT_DATA READ_HOSTS | READ_HOSTGROUPS | READ_CONTACTS | READ_CONTACTGROUPS | READ_SERVICES | READ_COMMANDS | READ_TIMEPERIODS | READ_SERVICEESCALATIONS | READ_SERVICEDEPENDENCIES | READ_HOSTDEPENDENCIES | READ_HOSTESCALATIONS | READ_HOSTEXTINFO | READ_SERVICEEXTINFO | READ_SERVICEGROUPS | READ_MODULES
|
||||
|
||||
|
||||
/************************** DATE RANGE TYPES ****************************/
|
||||
|
||||
#define DATERANGE_CALENDAR_DATE 0 /* 2008-12-25 */
|
||||
#define DATERANGE_MONTH_DATE 1 /* july 4 (specific month) */
|
||||
#define DATERANGE_MONTH_DAY 2 /* day 21 (generic month) */
|
||||
#define DATERANGE_MONTH_WEEK_DAY 3 /* 3rd thursday (specific month) */
|
||||
#define DATERANGE_WEEK_DAY 4 /* 3rd thursday (generic month) */
|
||||
#define DATERANGE_TYPES 5
|
||||
|
||||
|
||||
/************************** DATE/TIME TYPES *****************************/
|
||||
|
||||
#define LONG_DATE_TIME 0
|
||||
#define SHORT_DATE_TIME 1
|
||||
#define SHORT_DATE 2
|
||||
#define SHORT_TIME 3
|
||||
#define HTTP_DATE_TIME 4 /* time formatted for use in HTTP headers */
|
||||
|
||||
|
||||
/**************************** DATE FORMATS ******************************/
|
||||
|
||||
#define DATE_FORMAT_US 0 /* U.S. (MM-DD-YYYY HH:MM:SS) */
|
||||
#define DATE_FORMAT_EURO 1 /* European (DD-MM-YYYY HH:MM:SS) */
|
||||
#define DATE_FORMAT_ISO8601 2 /* ISO8601 (YYYY-MM-DD HH:MM:SS) */
|
||||
#define DATE_FORMAT_STRICT_ISO8601 3 /* ISO8601 (YYYY-MM-DDTHH:MM:SS) */
|
||||
|
||||
|
||||
/************************** MISC DEFINITIONS ****************************/
|
||||
|
||||
#define MAX_FILENAME_LENGTH 256 /* max length of path/filename that Icinga will process */
|
||||
#define MAX_INPUT_BUFFER 1024 /* size in bytes of max. input buffer (for reading files, misc stuff) */
|
||||
#define MAX_COMMAND_BUFFER 8192 /* max length of raw or processed command line */
|
||||
#define MAX_EXTERNAL_COMMAND_LENGTH 8192 /* max length of an external command */
|
||||
|
||||
#define MAX_DATETIME_LENGTH 48
|
||||
|
||||
/************************* MODIFIED ATTRIBUTES **************************/
|
||||
|
||||
#define MODATTR_NONE 0
|
||||
#define MODATTR_NOTIFICATIONS_ENABLED 1
|
||||
#define MODATTR_ACTIVE_CHECKS_ENABLED 2
|
||||
#define MODATTR_PASSIVE_CHECKS_ENABLED 4
|
||||
#define MODATTR_EVENT_HANDLER_ENABLED 8
|
||||
#define MODATTR_FLAP_DETECTION_ENABLED 16
|
||||
#define MODATTR_FAILURE_PREDICTION_ENABLED 32
|
||||
#define MODATTR_PERFORMANCE_DATA_ENABLED 64
|
||||
#define MODATTR_OBSESSIVE_HANDLER_ENABLED 128
|
||||
#define MODATTR_EVENT_HANDLER_COMMAND 256
|
||||
#define MODATTR_CHECK_COMMAND 512
|
||||
#define MODATTR_NORMAL_CHECK_INTERVAL 1024
|
||||
#define MODATTR_RETRY_CHECK_INTERVAL 2048
|
||||
#define MODATTR_MAX_CHECK_ATTEMPTS 4096
|
||||
#define MODATTR_FRESHNESS_CHECKS_ENABLED 8192
|
||||
#define MODATTR_CHECK_TIMEPERIOD 16384
|
||||
#define MODATTR_CUSTOM_VARIABLE 32768
|
||||
#define MODATTR_NOTIFICATION_TIMEPERIOD 65536
|
||||
|
||||
|
|
@ -1,684 +0,0 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* COMMANDS.C - Extacted comamnd handling from the icinga core, supports testing external
|
||||
* commands without requiring a full running system
|
||||
*
|
||||
* Copyright (c) 1999-2008 Ethan Galstad (egalstad@nagios.org)
|
||||
* Copyright (c) 2009-2012 Nagios Core Development Team and Community Contributors
|
||||
* Copyright (c) 2009-2012 Icinga Development Team (http://www.icinga.org)
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include "common.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
int dummy; /* reduce compiler warnings */
|
||||
/* fix the problem with strtok() skipping empty options between tokens */
|
||||
char *my_strtok(char *buffer, char *tokens) {
|
||||
char *token_position = NULL;
|
||||
char *sequence_head = NULL;
|
||||
static char *my_strtok_buffer = NULL;
|
||||
static char *original_my_strtok_buffer = NULL;
|
||||
|
||||
if (buffer != NULL) {
|
||||
my_free(original_my_strtok_buffer);
|
||||
if ((my_strtok_buffer = (char *)strdup(buffer)) == NULL)
|
||||
return NULL;
|
||||
original_my_strtok_buffer = my_strtok_buffer;
|
||||
}
|
||||
|
||||
sequence_head = my_strtok_buffer;
|
||||
|
||||
if (sequence_head[0] == '\x0')
|
||||
return NULL;
|
||||
|
||||
token_position = strchr(my_strtok_buffer, tokens[0]);
|
||||
|
||||
if (token_position == NULL) {
|
||||
my_strtok_buffer = strchr(my_strtok_buffer, '\x0');
|
||||
return sequence_head;
|
||||
}
|
||||
|
||||
token_position[0] = '\x0';
|
||||
my_strtok_buffer = token_position + 1;
|
||||
|
||||
return sequence_head;
|
||||
}
|
||||
|
||||
/* fixes compiler problems under Solaris, since strsep() isn't included */
|
||||
/* this code is taken from the glibc source */
|
||||
char *my_strsep(char **stringp, const char *delim) {
|
||||
char *begin, *end;
|
||||
|
||||
begin = *stringp;
|
||||
if (begin == NULL)
|
||||
return NULL;
|
||||
|
||||
/* A frequent case is when the delimiter string contains only one
|
||||
* character. Here we don't need to call the expensive `strpbrk'
|
||||
* function and instead work using `strchr'. */
|
||||
if (delim[0] == '\0' || delim[1] == '\0') {
|
||||
char ch = delim[0];
|
||||
|
||||
if (ch == '\0' || begin[0] == '\0')
|
||||
end = NULL;
|
||||
else {
|
||||
if (*begin == ch)
|
||||
end = begin;
|
||||
else
|
||||
end = strchr(begin + 1, ch);
|
||||
}
|
||||
} else {
|
||||
/* find the end of the token. */
|
||||
end = strpbrk(begin, delim);
|
||||
}
|
||||
|
||||
if (end) {
|
||||
/* terminate the token and set *STRINGP past NUL character. */
|
||||
*end++ = '\0';
|
||||
*stringp = end;
|
||||
} else
|
||||
/* no more delimiters; this is the last token. */
|
||||
*stringp = NULL;
|
||||
|
||||
return begin;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* strip newline, carriage return, and tab characters from beginning and end of a string */
|
||||
void strip(char *buffer) {
|
||||
register int x;
|
||||
register int y;
|
||||
register int z;
|
||||
|
||||
if (buffer == NULL || buffer[0] == '\x0')
|
||||
return;
|
||||
|
||||
/* strip end of string */
|
||||
y = (int)strlen(buffer);
|
||||
for (x = y - 1; x >= 0; x--) {
|
||||
if (buffer[x] == ' ' || buffer[x] == '\n' || buffer[x] == '\r' || buffer[x] == '\t' || buffer[x] == 13)
|
||||
buffer[x] = '\x0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/* strip beginning of string (by shifting) */
|
||||
y = (int)strlen(buffer);
|
||||
for (x = 0; x < y; x++) {
|
||||
if (buffer[x] == ' ' || buffer[x] == '\n' || buffer[x] == '\r' || buffer[x] == '\t' || buffer[x] == 13)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (x > 0) {
|
||||
for (z = x; z < y; z++)
|
||||
buffer[z-x] = buffer[z];
|
||||
buffer[y-x] = '\x0';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* top-level external command processor */
|
||||
int main(int argv, char **argc) {
|
||||
if(argv < 2) {
|
||||
printf("Not enough arguments!\n");
|
||||
return 1;
|
||||
}
|
||||
char *cmd = argc[1];
|
||||
char *temp_buffer = NULL;
|
||||
char *command_id = NULL;
|
||||
char *args = NULL;
|
||||
time_t entry_time = 0L;
|
||||
int command_type = CMD_NONE;
|
||||
char *temp_ptr = NULL;
|
||||
|
||||
if (cmd == NULL) {
|
||||
printf("No command given\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* strip the command of newlines and carriage returns */
|
||||
strip(cmd);
|
||||
|
||||
/* get the command entry time */
|
||||
if ((temp_ptr = my_strtok(cmd, "[")) == NULL) {
|
||||
printf("No entry time given\n");
|
||||
return ERROR;
|
||||
}
|
||||
if ((temp_ptr = my_strtok(NULL, "]")) == NULL) {
|
||||
printf("Missing ] character at entry time\n");
|
||||
return ERROR;
|
||||
}
|
||||
entry_time = (time_t)strtoul(temp_ptr, NULL, 10);
|
||||
|
||||
/* get the command identifier */
|
||||
if ((temp_ptr = my_strtok(NULL, ";")) == NULL) {
|
||||
printf("Missing command identifier\n");
|
||||
return ERROR;
|
||||
}
|
||||
if ((command_id = (char *)strdup(temp_ptr + 1)) == NULL) {
|
||||
printf("Missing command identifier\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* get the command arguments */
|
||||
if ((temp_ptr = my_strtok(NULL, "\n")) == NULL)
|
||||
args = (char *)strdup("");
|
||||
else
|
||||
args = (char *)strdup(temp_ptr);
|
||||
|
||||
if (args == NULL) {
|
||||
printf("No arguments given\n");
|
||||
my_free(command_id);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* decide what type of command this is... */
|
||||
|
||||
/**************************/
|
||||
/**** PROCESS COMMANDS ****/
|
||||
/**************************/
|
||||
|
||||
if (!strcmp(command_id, "ENTER_STANDBY_MODE") || !strcmp(command_id, "DISABLE_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "ENTER_ACTIVE_MODE") || !strcmp(command_id, "ENABLE_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_NOTIFICATIONS_EXPIRE_TIME"))
|
||||
command_type = CMD_DISABLE_NOTIFICATIONS_EXPIRE_TIME;
|
||||
|
||||
else if (!strcmp(command_id, "SHUTDOWN_PROGRAM") || !strcmp(command_id, "SHUTDOWN_PROCESS"))
|
||||
command_type = CMD_SHUTDOWN_PROCESS;
|
||||
else if (!strcmp(command_id, "RESTART_PROGRAM") || !strcmp(command_id, "RESTART_PROCESS"))
|
||||
command_type = CMD_RESTART_PROCESS;
|
||||
|
||||
else if (!strcmp(command_id, "SAVE_STATE_INFORMATION"))
|
||||
command_type = CMD_SAVE_STATE_INFORMATION;
|
||||
else if (!strcmp(command_id, "READ_STATE_INFORMATION"))
|
||||
command_type = CMD_READ_STATE_INFORMATION;
|
||||
else if (!strcmp(command_id, "SYNC_STATE_INFORMATION"))
|
||||
command_type = CMD_SYNC_STATE_INFORMATION;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_EVENT_HANDLERS"))
|
||||
command_type = CMD_ENABLE_EVENT_HANDLERS;
|
||||
else if (!strcmp(command_id, "DISABLE_EVENT_HANDLERS"))
|
||||
command_type = CMD_DISABLE_EVENT_HANDLERS;
|
||||
|
||||
else if (!strcmp(command_id, "FLUSH_PENDING_COMMANDS"))
|
||||
command_type = CMD_FLUSH_PENDING_COMMANDS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_FAILURE_PREDICTION"))
|
||||
command_type = CMD_ENABLE_FAILURE_PREDICTION;
|
||||
else if (!strcmp(command_id, "DISABLE_FAILURE_PREDICTION"))
|
||||
command_type = CMD_DISABLE_FAILURE_PREDICTION;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_PERFORMANCE_DATA"))
|
||||
command_type = CMD_ENABLE_PERFORMANCE_DATA;
|
||||
else if (!strcmp(command_id, "DISABLE_PERFORMANCE_DATA"))
|
||||
command_type = CMD_DISABLE_PERFORMANCE_DATA;
|
||||
|
||||
else if (!strcmp(command_id, "START_EXECUTING_HOST_CHECKS"))
|
||||
command_type = CMD_START_EXECUTING_HOST_CHECKS;
|
||||
else if (!strcmp(command_id, "STOP_EXECUTING_HOST_CHECKS"))
|
||||
command_type = CMD_STOP_EXECUTING_HOST_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "START_EXECUTING_SVC_CHECKS"))
|
||||
command_type = CMD_START_EXECUTING_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "STOP_EXECUTING_SVC_CHECKS"))
|
||||
command_type = CMD_STOP_EXECUTING_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "START_ACCEPTING_PASSIVE_HOST_CHECKS"))
|
||||
command_type = CMD_START_ACCEPTING_PASSIVE_HOST_CHECKS;
|
||||
else if (!strcmp(command_id, "STOP_ACCEPTING_PASSIVE_HOST_CHECKS"))
|
||||
command_type = CMD_STOP_ACCEPTING_PASSIVE_HOST_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "START_ACCEPTING_PASSIVE_SVC_CHECKS"))
|
||||
command_type = CMD_START_ACCEPTING_PASSIVE_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "STOP_ACCEPTING_PASSIVE_SVC_CHECKS"))
|
||||
command_type = CMD_STOP_ACCEPTING_PASSIVE_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "START_OBSESSING_OVER_HOST_CHECKS"))
|
||||
command_type = CMD_START_OBSESSING_OVER_HOST_CHECKS;
|
||||
else if (!strcmp(command_id, "STOP_OBSESSING_OVER_HOST_CHECKS"))
|
||||
command_type = CMD_STOP_OBSESSING_OVER_HOST_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "START_OBSESSING_OVER_SVC_CHECKS"))
|
||||
command_type = CMD_START_OBSESSING_OVER_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "STOP_OBSESSING_OVER_SVC_CHECKS"))
|
||||
command_type = CMD_STOP_OBSESSING_OVER_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_FLAP_DETECTION"))
|
||||
command_type = CMD_ENABLE_FLAP_DETECTION;
|
||||
else if (!strcmp(command_id, "DISABLE_FLAP_DETECTION"))
|
||||
command_type = CMD_DISABLE_FLAP_DETECTION;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_GLOBAL_HOST_EVENT_HANDLER"))
|
||||
command_type = CMD_CHANGE_GLOBAL_HOST_EVENT_HANDLER;
|
||||
else if (!strcmp(command_id, "CHANGE_GLOBAL_SVC_EVENT_HANDLER"))
|
||||
command_type = CMD_CHANGE_GLOBAL_SVC_EVENT_HANDLER;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SERVICE_FRESHNESS_CHECKS"))
|
||||
command_type = CMD_ENABLE_SERVICE_FRESHNESS_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_SERVICE_FRESHNESS_CHECKS"))
|
||||
command_type = CMD_DISABLE_SERVICE_FRESHNESS_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOST_FRESHNESS_CHECKS"))
|
||||
command_type = CMD_ENABLE_HOST_FRESHNESS_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOST_FRESHNESS_CHECKS"))
|
||||
command_type = CMD_DISABLE_HOST_FRESHNESS_CHECKS;
|
||||
|
||||
|
||||
/*******************************/
|
||||
/**** HOST-RELATED COMMANDS ****/
|
||||
/*******************************/
|
||||
|
||||
else if (!strcmp(command_id, "ADD_HOST_COMMENT"))
|
||||
command_type = CMD_ADD_HOST_COMMENT;
|
||||
else if (!strcmp(command_id, "DEL_HOST_COMMENT"))
|
||||
command_type = CMD_DEL_HOST_COMMENT;
|
||||
else if (!strcmp(command_id, "DEL_ALL_HOST_COMMENTS"))
|
||||
command_type = CMD_DEL_ALL_HOST_COMMENTS;
|
||||
|
||||
else if (!strcmp(command_id, "DELAY_HOST_NOTIFICATION"))
|
||||
command_type = CMD_DELAY_HOST_NOTIFICATION;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_HOST_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_HOST_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST"))
|
||||
command_type = CMD_ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST;
|
||||
else if (!strcmp(command_id, "DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST"))
|
||||
command_type = CMD_DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOST_AND_CHILD_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_HOST_AND_CHILD_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOST_AND_CHILD_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_HOST_AND_CHILD_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOST_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_HOST_SVC_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOST_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_HOST_SVC_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOST_SVC_CHECKS"))
|
||||
command_type = CMD_ENABLE_HOST_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOST_SVC_CHECKS"))
|
||||
command_type = CMD_DISABLE_HOST_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_PASSIVE_HOST_CHECKS"))
|
||||
command_type = CMD_ENABLE_PASSIVE_HOST_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_PASSIVE_HOST_CHECKS"))
|
||||
command_type = CMD_DISABLE_PASSIVE_HOST_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "SCHEDULE_HOST_SVC_CHECKS"))
|
||||
command_type = CMD_SCHEDULE_HOST_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "SCHEDULE_FORCED_HOST_SVC_CHECKS"))
|
||||
command_type = CMD_SCHEDULE_FORCED_HOST_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ACKNOWLEDGE_HOST_PROBLEM"))
|
||||
command_type = CMD_ACKNOWLEDGE_HOST_PROBLEM;
|
||||
else if (!strcmp(command_id, "ACKNOWLEDGE_HOST_PROBLEM_EXPIRE"))
|
||||
command_type = CMD_ACKNOWLEDGE_HOST_PROBLEM_EXPIRE;
|
||||
else if (!strcmp(command_id, "REMOVE_HOST_ACKNOWLEDGEMENT"))
|
||||
command_type = CMD_REMOVE_HOST_ACKNOWLEDGEMENT;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOST_EVENT_HANDLER"))
|
||||
command_type = CMD_ENABLE_HOST_EVENT_HANDLER;
|
||||
else if (!strcmp(command_id, "DISABLE_HOST_EVENT_HANDLER"))
|
||||
command_type = CMD_DISABLE_HOST_EVENT_HANDLER;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOST_CHECK"))
|
||||
command_type = CMD_ENABLE_HOST_CHECK;
|
||||
else if (!strcmp(command_id, "DISABLE_HOST_CHECK"))
|
||||
command_type = CMD_DISABLE_HOST_CHECK;
|
||||
|
||||
else if (!strcmp(command_id, "SCHEDULE_HOST_CHECK"))
|
||||
command_type = CMD_SCHEDULE_HOST_CHECK;
|
||||
else if (!strcmp(command_id, "SCHEDULE_FORCED_HOST_CHECK"))
|
||||
command_type = CMD_SCHEDULE_FORCED_HOST_CHECK;
|
||||
|
||||
else if (!strcmp(command_id, "SCHEDULE_HOST_DOWNTIME"))
|
||||
command_type = CMD_SCHEDULE_HOST_DOWNTIME;
|
||||
else if (!strcmp(command_id, "SCHEDULE_HOST_SVC_DOWNTIME"))
|
||||
command_type = CMD_SCHEDULE_HOST_SVC_DOWNTIME;
|
||||
else if (!strcmp(command_id, "DEL_HOST_DOWNTIME"))
|
||||
command_type = CMD_DEL_HOST_DOWNTIME;
|
||||
else if (!strcmp(command_id, "DEL_DOWNTIME_BY_HOST_NAME"))
|
||||
command_type = CMD_DEL_DOWNTIME_BY_HOST_NAME;
|
||||
else if (!strcmp(command_id, "DEL_DOWNTIME_BY_HOSTGROUP_NAME"))
|
||||
command_type = CMD_DEL_DOWNTIME_BY_HOSTGROUP_NAME;
|
||||
|
||||
else if (!strcmp(command_id, "DEL_DOWNTIME_BY_START_TIME_COMMENT"))
|
||||
command_type = CMD_DEL_DOWNTIME_BY_START_TIME_COMMENT;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOST_FLAP_DETECTION"))
|
||||
command_type = CMD_ENABLE_HOST_FLAP_DETECTION;
|
||||
else if (!strcmp(command_id, "DISABLE_HOST_FLAP_DETECTION"))
|
||||
command_type = CMD_DISABLE_HOST_FLAP_DETECTION;
|
||||
|
||||
else if (!strcmp(command_id, "START_OBSESSING_OVER_HOST"))
|
||||
command_type = CMD_START_OBSESSING_OVER_HOST;
|
||||
else if (!strcmp(command_id, "STOP_OBSESSING_OVER_HOST"))
|
||||
command_type = CMD_STOP_OBSESSING_OVER_HOST;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_HOST_EVENT_HANDLER"))
|
||||
command_type = CMD_CHANGE_HOST_EVENT_HANDLER;
|
||||
else if (!strcmp(command_id, "CHANGE_HOST_CHECK_COMMAND"))
|
||||
command_type = CMD_CHANGE_HOST_CHECK_COMMAND;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_NORMAL_HOST_CHECK_INTERVAL"))
|
||||
command_type = CMD_CHANGE_NORMAL_HOST_CHECK_INTERVAL;
|
||||
else if (!strcmp(command_id, "CHANGE_RETRY_HOST_CHECK_INTERVAL"))
|
||||
command_type = CMD_CHANGE_RETRY_HOST_CHECK_INTERVAL;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_MAX_HOST_CHECK_ATTEMPTS"))
|
||||
command_type = CMD_CHANGE_MAX_HOST_CHECK_ATTEMPTS;
|
||||
|
||||
else if (!strcmp(command_id, "SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME"))
|
||||
command_type = CMD_SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME;
|
||||
|
||||
else if (!strcmp(command_id, "SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME"))
|
||||
command_type = CMD_SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME;
|
||||
|
||||
else if (!strcmp(command_id, "SET_HOST_NOTIFICATION_NUMBER"))
|
||||
command_type = CMD_SET_HOST_NOTIFICATION_NUMBER;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_HOST_CHECK_TIMEPERIOD"))
|
||||
command_type = CMD_CHANGE_HOST_CHECK_TIMEPERIOD;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_CUSTOM_HOST_VAR"))
|
||||
command_type = CMD_CHANGE_CUSTOM_HOST_VAR;
|
||||
|
||||
else if (!strcmp(command_id, "SEND_CUSTOM_HOST_NOTIFICATION"))
|
||||
command_type = CMD_SEND_CUSTOM_HOST_NOTIFICATION;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_HOST_NOTIFICATION_TIMEPERIOD"))
|
||||
command_type = CMD_CHANGE_HOST_NOTIFICATION_TIMEPERIOD;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_HOST_MODATTR"))
|
||||
command_type = CMD_CHANGE_HOST_MODATTR;
|
||||
|
||||
|
||||
/************************************/
|
||||
/**** HOSTGROUP-RELATED COMMANDS ****/
|
||||
/************************************/
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOSTGROUP_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_HOSTGROUP_HOST_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOSTGROUP_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_HOSTGROUP_HOST_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOSTGROUP_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_HOSTGROUP_SVC_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOSTGROUP_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_HOSTGROUP_SVC_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOSTGROUP_HOST_CHECKS"))
|
||||
command_type = CMD_ENABLE_HOSTGROUP_HOST_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOSTGROUP_HOST_CHECKS"))
|
||||
command_type = CMD_DISABLE_HOSTGROUP_HOST_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS"))
|
||||
command_type = CMD_ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS"))
|
||||
command_type = CMD_DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOSTGROUP_SVC_CHECKS"))
|
||||
command_type = CMD_ENABLE_HOSTGROUP_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOSTGROUP_SVC_CHECKS"))
|
||||
command_type = CMD_DISABLE_HOSTGROUP_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS"))
|
||||
command_type = CMD_ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS"))
|
||||
command_type = CMD_DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "SCHEDULE_HOSTGROUP_HOST_DOWNTIME"))
|
||||
command_type = CMD_SCHEDULE_HOSTGROUP_HOST_DOWNTIME;
|
||||
else if (!strcmp(command_id, "SCHEDULE_HOSTGROUP_SVC_DOWNTIME"))
|
||||
command_type = CMD_SCHEDULE_HOSTGROUP_SVC_DOWNTIME;
|
||||
|
||||
|
||||
/**********************************/
|
||||
/**** SERVICE-RELATED COMMANDS ****/
|
||||
/**********************************/
|
||||
|
||||
else if (!strcmp(command_id, "ADD_SVC_COMMENT"))
|
||||
command_type = CMD_ADD_SVC_COMMENT;
|
||||
else if (!strcmp(command_id, "DEL_SVC_COMMENT"))
|
||||
command_type = CMD_DEL_SVC_COMMENT;
|
||||
else if (!strcmp(command_id, "DEL_ALL_SVC_COMMENTS"))
|
||||
command_type = CMD_DEL_ALL_SVC_COMMENTS;
|
||||
|
||||
else if (!strcmp(command_id, "SCHEDULE_SVC_CHECK"))
|
||||
command_type = CMD_SCHEDULE_SVC_CHECK;
|
||||
else if (!strcmp(command_id, "SCHEDULE_FORCED_SVC_CHECK"))
|
||||
command_type = CMD_SCHEDULE_FORCED_SVC_CHECK;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SVC_CHECK"))
|
||||
command_type = CMD_ENABLE_SVC_CHECK;
|
||||
else if (!strcmp(command_id, "DISABLE_SVC_CHECK"))
|
||||
command_type = CMD_DISABLE_SVC_CHECK;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_PASSIVE_SVC_CHECKS"))
|
||||
command_type = CMD_ENABLE_PASSIVE_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_PASSIVE_SVC_CHECKS"))
|
||||
command_type = CMD_DISABLE_PASSIVE_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "DELAY_SVC_NOTIFICATION"))
|
||||
command_type = CMD_DELAY_SVC_NOTIFICATION;
|
||||
else if (!strcmp(command_id, "ENABLE_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_SVC_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_SVC_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "PROCESS_SERVICE_CHECK_RESULT"))
|
||||
command_type = CMD_PROCESS_SERVICE_CHECK_RESULT;
|
||||
else if (!strcmp(command_id, "PROCESS_HOST_CHECK_RESULT"))
|
||||
command_type = CMD_PROCESS_HOST_CHECK_RESULT;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SVC_EVENT_HANDLER"))
|
||||
command_type = CMD_ENABLE_SVC_EVENT_HANDLER;
|
||||
else if (!strcmp(command_id, "DISABLE_SVC_EVENT_HANDLER"))
|
||||
command_type = CMD_DISABLE_SVC_EVENT_HANDLER;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SVC_FLAP_DETECTION"))
|
||||
command_type = CMD_ENABLE_SVC_FLAP_DETECTION;
|
||||
else if (!strcmp(command_id, "DISABLE_SVC_FLAP_DETECTION"))
|
||||
command_type = CMD_DISABLE_SVC_FLAP_DETECTION;
|
||||
|
||||
else if (!strcmp(command_id, "SCHEDULE_SVC_DOWNTIME"))
|
||||
command_type = CMD_SCHEDULE_SVC_DOWNTIME;
|
||||
else if (!strcmp(command_id, "DEL_SVC_DOWNTIME"))
|
||||
command_type = CMD_DEL_SVC_DOWNTIME;
|
||||
|
||||
else if (!strcmp(command_id, "ACKNOWLEDGE_SVC_PROBLEM"))
|
||||
command_type = CMD_ACKNOWLEDGE_SVC_PROBLEM;
|
||||
else if (!strcmp(command_id, "ACKNOWLEDGE_SVC_PROBLEM_EXPIRE"))
|
||||
command_type = CMD_ACKNOWLEDGE_SVC_PROBLEM_EXPIRE;
|
||||
else if (!strcmp(command_id, "REMOVE_SVC_ACKNOWLEDGEMENT"))
|
||||
command_type = CMD_REMOVE_SVC_ACKNOWLEDGEMENT;
|
||||
|
||||
else if (!strcmp(command_id, "START_OBSESSING_OVER_SVC"))
|
||||
command_type = CMD_START_OBSESSING_OVER_SVC;
|
||||
else if (!strcmp(command_id, "STOP_OBSESSING_OVER_SVC"))
|
||||
command_type = CMD_STOP_OBSESSING_OVER_SVC;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_SVC_EVENT_HANDLER"))
|
||||
command_type = CMD_CHANGE_SVC_EVENT_HANDLER;
|
||||
else if (!strcmp(command_id, "CHANGE_SVC_CHECK_COMMAND"))
|
||||
command_type = CMD_CHANGE_SVC_CHECK_COMMAND;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_NORMAL_SVC_CHECK_INTERVAL"))
|
||||
command_type = CMD_CHANGE_NORMAL_SVC_CHECK_INTERVAL;
|
||||
else if (!strcmp(command_id, "CHANGE_RETRY_SVC_CHECK_INTERVAL"))
|
||||
command_type = CMD_CHANGE_RETRY_SVC_CHECK_INTERVAL;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_MAX_SVC_CHECK_ATTEMPTS"))
|
||||
command_type = CMD_CHANGE_MAX_SVC_CHECK_ATTEMPTS;
|
||||
|
||||
else if (!strcmp(command_id, "SET_SVC_NOTIFICATION_NUMBER"))
|
||||
command_type = CMD_SET_SVC_NOTIFICATION_NUMBER;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_SVC_CHECK_TIMEPERIOD"))
|
||||
command_type = CMD_CHANGE_SVC_CHECK_TIMEPERIOD;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_CUSTOM_SVC_VAR"))
|
||||
command_type = CMD_CHANGE_CUSTOM_SVC_VAR;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_CUSTOM_CONTACT_VAR"))
|
||||
command_type = CMD_CHANGE_CUSTOM_CONTACT_VAR;
|
||||
|
||||
else if (!strcmp(command_id, "SEND_CUSTOM_SVC_NOTIFICATION"))
|
||||
command_type = CMD_SEND_CUSTOM_SVC_NOTIFICATION;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_SVC_NOTIFICATION_TIMEPERIOD"))
|
||||
command_type = CMD_CHANGE_SVC_NOTIFICATION_TIMEPERIOD;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_SVC_MODATTR"))
|
||||
command_type = CMD_CHANGE_SVC_MODATTR;
|
||||
|
||||
|
||||
/***************************************/
|
||||
/**** SERVICEGROUP-RELATED COMMANDS ****/
|
||||
/***************************************/
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SERVICEGROUP_HOST_CHECKS"))
|
||||
command_type = CMD_ENABLE_SERVICEGROUP_HOST_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_SERVICEGROUP_HOST_CHECKS"))
|
||||
command_type = CMD_DISABLE_SERVICEGROUP_HOST_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS"))
|
||||
command_type = CMD_ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS"))
|
||||
command_type = CMD_DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SERVICEGROUP_SVC_CHECKS"))
|
||||
command_type = CMD_ENABLE_SERVICEGROUP_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_SERVICEGROUP_SVC_CHECKS"))
|
||||
command_type = CMD_DISABLE_SERVICEGROUP_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS"))
|
||||
command_type = CMD_ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS;
|
||||
else if (!strcmp(command_id, "DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS"))
|
||||
command_type = CMD_DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS;
|
||||
|
||||
else if (!strcmp(command_id, "SCHEDULE_SERVICEGROUP_HOST_DOWNTIME"))
|
||||
command_type = CMD_SCHEDULE_SERVICEGROUP_HOST_DOWNTIME;
|
||||
else if (!strcmp(command_id, "SCHEDULE_SERVICEGROUP_SVC_DOWNTIME"))
|
||||
command_type = CMD_SCHEDULE_SERVICEGROUP_SVC_DOWNTIME;
|
||||
|
||||
|
||||
/**********************************/
|
||||
/**** CONTACT-RELATED COMMANDS ****/
|
||||
/**********************************/
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_CONTACT_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_CONTACT_HOST_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_CONTACT_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_CONTACT_HOST_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_CONTACT_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_CONTACT_SVC_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_CONTACT_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_CONTACT_SVC_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD"))
|
||||
command_type = CMD_CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_CONTACT_SVC_NOTIFICATION_TIMEPERIOD"))
|
||||
command_type = CMD_CHANGE_CONTACT_SVC_NOTIFICATION_TIMEPERIOD;
|
||||
|
||||
else if (!strcmp(command_id, "CHANGE_CONTACT_MODATTR"))
|
||||
command_type = CMD_CHANGE_CONTACT_MODATTR;
|
||||
else if (!strcmp(command_id, "CHANGE_CONTACT_MODHATTR"))
|
||||
command_type = CMD_CHANGE_CONTACT_MODHATTR;
|
||||
else if (!strcmp(command_id, "CHANGE_CONTACT_MODSATTR"))
|
||||
command_type = CMD_CHANGE_CONTACT_MODSATTR;
|
||||
|
||||
/***************************************/
|
||||
/**** CONTACTGROUP-RELATED COMMANDS ****/
|
||||
/***************************************/
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS;
|
||||
|
||||
else if (!strcmp(command_id, "ENABLE_CONTACTGROUP_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_ENABLE_CONTACTGROUP_SVC_NOTIFICATIONS;
|
||||
else if (!strcmp(command_id, "DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS"))
|
||||
command_type = CMD_DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS;
|
||||
|
||||
|
||||
/**************************/
|
||||
/****** MISC COMMANDS *****/
|
||||
/**************************/
|
||||
|
||||
else if (!strcmp(command_id, "PROCESS_FILE"))
|
||||
command_type = CMD_PROCESS_FILE;
|
||||
|
||||
|
||||
|
||||
/****************************/
|
||||
/****** CUSTOM COMMANDS *****/
|
||||
/****************************/
|
||||
|
||||
else if (command_id[0] == '_')
|
||||
command_type = CMD_CUSTOM_COMMAND;
|
||||
|
||||
|
||||
|
||||
/**** UNKNOWN COMMAND ****/
|
||||
else {
|
||||
/* free memory */
|
||||
printf("UNKNOWN COMMAND: %s;%s\n", command_id, args);
|
||||
my_free(command_id);
|
||||
my_free(args);
|
||||
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* log the external command */
|
||||
printf("%s;%s\n", command_id, args);
|
||||
my_free(temp_buffer);
|
||||
|
||||
my_free(command_id);
|
||||
my_free(args);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* SHARED.H - Include file for shared functions and structs
|
||||
*
|
||||
* Copyright (c) 2010-2011 Nagios Core Development Team and Community Contributors
|
||||
* Copyright (c) 2010-2011 Icinga Development Team (http://www.icinga.org)
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef INCLUDE__shared_h__
|
||||
#define INCLUDE__shared_h__
|
||||
|
||||
#include <time.h>
|
||||
/* mmapfile structure - used for reading files via mmap() */
|
||||
typedef struct mmapfile_struct {
|
||||
char *path;
|
||||
int mode;
|
||||
int fd;
|
||||
unsigned long file_size;
|
||||
unsigned long current_position;
|
||||
unsigned long current_line;
|
||||
void *mmap_buf;
|
||||
} mmapfile;
|
||||
|
||||
/* only usable on compile-time initialized arrays, for obvious reasons */
|
||||
#define ARRAY_SIZE(ary) (sizeof(ary) / sizeof(ary[0]))
|
||||
|
||||
extern char *my_strtok(char *buffer, char *tokens);
|
||||
extern char *my_strsep(char **stringp, const char *delim);
|
||||
extern mmapfile *mmap_fopen(char *filename);
|
||||
extern int mmap_fclose(mmapfile *temp_mmapfile);
|
||||
extern char *mmap_fgets(mmapfile *temp_mmapfile);
|
||||
extern char *mmap_fgets_multiline(mmapfile * temp_mmapfile);
|
||||
extern void strip(char *buffer);
|
||||
extern int hashfunc(const char *name1, const char *name2, int hashslots);
|
||||
extern int compare_hashdata(const char *val1a, const char *val1b, const char *val2a,
|
||||
const char *val2b);
|
||||
extern void get_datetime_string(time_t *raw_time, char *buffer,
|
||||
int buffer_length, int type);
|
||||
extern void get_time_breakdown(unsigned long raw_time, int *days, int *hours,
|
||||
int *minutes, int *seconds);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue