parent
8c640cbab7
commit
b9f03e27b7
|
@ -1,15 +1,17 @@
|
|||
[localdb]
|
||||
type = ido
|
||||
resource = "ido"
|
||||
@ido_enabled@
|
||||
type = ido
|
||||
resource = "ido"
|
||||
|
||||
[locallive]
|
||||
type = livestatus
|
||||
socket = @livestatus_socket@
|
||||
@livestatus_enabled@
|
||||
type = livestatus
|
||||
resource = livestatus
|
||||
|
||||
[localfile]
|
||||
type = statusdat
|
||||
status_file = @statusdat_file@
|
||||
objects_file = @objects_cache_file@
|
||||
@statusdat_enabled@
|
||||
type = statusdat
|
||||
resource = statusdat
|
||||
|
||||
;[localfailsafe]
|
||||
;enabled=false
|
||||
|
|
|
@ -30,3 +30,12 @@ port = @ido_port@
|
|||
password = @ido_user@
|
||||
username = @ido_user@
|
||||
dbname = @ido_database@
|
||||
|
||||
[statusdat]
|
||||
type = statusdat
|
||||
status_file = /usr/local/icinga-mysql/var/status.dat
|
||||
object_file = /usr/local/icinga-mysql/var/objects.cache
|
||||
|
||||
[livestatus]
|
||||
type = livestatus
|
||||
socket = @livestatus_socket@
|
||||
|
|
|
@ -593,15 +593,18 @@ INSTALL_OPTS
|
|||
use_internal_auth
|
||||
use_ldap_auth
|
||||
icinga_commandpipe
|
||||
livestatus_enabled
|
||||
livestatus_socket
|
||||
objects_cache_file
|
||||
statusdat_file
|
||||
statusdat_enabled
|
||||
ido_password
|
||||
ido_user
|
||||
ido_database
|
||||
ido_port
|
||||
ido_host
|
||||
ido_db_type
|
||||
ido_enabled
|
||||
icinga_backend
|
||||
ldap_attribute_username
|
||||
ldap_attribute_basedn
|
||||
|
@ -1394,7 +1397,7 @@ Optional Packages:
|
|||
location of the status.dat file when retrieving data
|
||||
from status.dat (default:
|
||||
/usr/local/icinga/var/status.dat)
|
||||
--with-objects-file=FILE
|
||||
--with-objects-cache-file=FILE
|
||||
location of the objects.cache file when retrieving
|
||||
data from status.dat (default:
|
||||
/usr/local/icinga/var/objects.cache)
|
||||
|
@ -1405,6 +1408,10 @@ Optional Packages:
|
|||
location of the command pipe used for sending
|
||||
commands (default:
|
||||
/usr/local/icinga/var/rw/icinga.cmd)
|
||||
--with-objects-file=FILE
|
||||
location of the objects.cache file when retrieving
|
||||
data from status.dat (default:
|
||||
/usr/local/icinga/var/objects.cache)
|
||||
|
||||
Some influential environment variables:
|
||||
PHP php cli binary
|
||||
|
@ -2810,9 +2817,9 @@ fi
|
|||
# Comment out the disabled backends per default
|
||||
#
|
||||
|
||||
ido_enabled="disable=1"
|
||||
statusdat_enabled="disable=1"
|
||||
livestatus_enabled="disable=1"
|
||||
ido_enabled="disabled = \"1\""
|
||||
statusdat_enabled="disabled = \"1\""
|
||||
livestatus_enabled="disabled = \"1\""
|
||||
|
||||
case $icinga_backend in #(
|
||||
"ido") :
|
||||
|
@ -2905,13 +2912,16 @@ fi
|
|||
|
||||
|
||||
|
||||
|
||||
# status.dat backend
|
||||
|
||||
|
||||
|
||||
|
||||
# livestatus backend
|
||||
|
||||
|
||||
|
||||
# command pipe
|
||||
|
||||
|
||||
|
|
11
configure.ac
11
configure.ac
|
@ -255,7 +255,7 @@ AC_ARG_WITH([statusdat_file],
|
|||
)
|
||||
|
||||
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)]),
|
||||
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"
|
||||
)
|
||||
|
@ -338,9 +338,9 @@ AS_IF([test "x$ido_db_type" = xpgsql], [
|
|||
# Comment out the disabled backends per default
|
||||
#
|
||||
|
||||
ido_enabled="disable=1"
|
||||
statusdat_enabled="disable=1"
|
||||
livestatus_enabled="disable=1"
|
||||
ido_enabled="disabled = \"1\""
|
||||
statusdat_enabled="disabled = \"1\""
|
||||
livestatus_enabled="disabled = \"1\""
|
||||
|
||||
AS_CASE([$icinga_backend],
|
||||
["ido"], [ido_enabled=""],
|
||||
|
@ -397,6 +397,7 @@ AC_SUBST(ldap_attribute_username)
|
|||
AC_SUBST(icinga_backend)
|
||||
|
||||
# ido backend variables
|
||||
AC_SUBST(ido_enabled)
|
||||
AC_SUBST(ido_db_type)
|
||||
AC_SUBST(ido_host)
|
||||
AC_SUBST(ido_port)
|
||||
|
@ -405,11 +406,13 @@ 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)
|
||||
|
|
|
@ -40,7 +40,7 @@ class ResourceFactory implements ConfigAwareFactory
|
|||
$resource = new StatusdatReader($config);
|
||||
break;
|
||||
default:
|
||||
throw new ConfigurationError('Unsupported Backend "' + $config->type + '"');
|
||||
throw new ConfigurationError('Unsupported resource type "' . $config->type . '"');
|
||||
|
||||
}
|
||||
return $resource;
|
||||
|
|
|
@ -128,8 +128,17 @@ class Backend implements ConfigAwareFactory, DatasourceInterface
|
|||
'Cannot get default backend as no backend has been configured'
|
||||
);
|
||||
}
|
||||
reset($configs);
|
||||
return key($configs);
|
||||
|
||||
// We won't have disabled backends
|
||||
foreach ($configs as $name => $config) {
|
||||
if (!$config->get('disabled') == '1') {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ConfigurationError(
|
||||
'All backends are disabled'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,11 +158,19 @@ class Backend implements ConfigAwareFactory, DatasourceInterface
|
|||
$name = self::getDefaultBackendName();
|
||||
}
|
||||
|
||||
$config = null;
|
||||
|
||||
if (isset(self::$backendConfigs[$name])) {
|
||||
/** @var Zend_Config $config */
|
||||
$config = self::$backendConfigs[$name];
|
||||
} else {
|
||||
if ($config->get('disabled') == '1') {
|
||||
$config = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($config === null) {
|
||||
throw new ConfigurationError(
|
||||
'No configuration for backend' . $name
|
||||
'No configuration for backend:' . $name
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue