mirror of https://github.com/Icinga/icinga2.git
Merge pull request #5238 from Icinga/fix/ido-category
Remove deprecated "DbCat1 | DbCat2" notation for DB IDO categories
This commit is contained in:
commit
52d6db07f7
|
@ -779,12 +779,6 @@ by Icinga Web 2 in the table above.
|
||||||
In addition to the category flags listed above the `DbCatEverything`
|
In addition to the category flags listed above the `DbCatEverything`
|
||||||
flag may be used as a shortcut for listing all flags.
|
flag may be used as a shortcut for listing all flags.
|
||||||
|
|
||||||
> **Note**
|
|
||||||
>
|
|
||||||
> The previous way of defining the `categories` attribute e.g.
|
|
||||||
> `DbCatProgramStatus | DbCatState` was deprecated in 2.5 and will
|
|
||||||
> be removed in future versions.
|
|
||||||
|
|
||||||
## <a id="objecttype-idopgsqlconnection"></a> IdoPgSqlConnection
|
## <a id="objecttype-idopgsqlconnection"></a> IdoPgSqlConnection
|
||||||
|
|
||||||
IDO database adapter for PostgreSQL.
|
IDO database adapter for PostgreSQL.
|
||||||
|
@ -868,13 +862,6 @@ by Icinga Web 2 in the table above.
|
||||||
In addition to the category flags listed above the `DbCatEverything`
|
In addition to the category flags listed above the `DbCatEverything`
|
||||||
flag may be used as a shortcut for listing all flags.
|
flag may be used as a shortcut for listing all flags.
|
||||||
|
|
||||||
> **Note**
|
|
||||||
>
|
|
||||||
> The previous way of defining the `categories` attribute e.g.
|
|
||||||
> `DbCatProgramStatus | DbCatState` was deprecated in 2.5 and will
|
|
||||||
> be removed in future versions.
|
|
||||||
|
|
||||||
|
|
||||||
## <a id="objecttype-influxdbwriter"></a> InfluxdbWriter
|
## <a id="objecttype-influxdbwriter"></a> InfluxdbWriter
|
||||||
|
|
||||||
Writes check result metrics and performance data to a defined InfluxDB host.
|
Writes check result metrics and performance data to a defined InfluxDB host.
|
||||||
|
|
|
@ -48,15 +48,7 @@ void DbConnection::OnConfigLoaded(void)
|
||||||
|
|
||||||
Value categories = GetCategories();
|
Value categories = GetCategories();
|
||||||
|
|
||||||
//TODO: Remove 'cat1 | cat2' notation in 2.6
|
SetCategoryFilter(FilterArrayToInt(categories, DbQuery::GetCategoryFilterMap(), DbCatEverything));
|
||||||
if (categories.IsNumber()) {
|
|
||||||
SetCategoryFilter(categories);
|
|
||||||
Log(LogWarning, "DbConnection")
|
|
||||||
<< "Specifying flags using '|' for 'categories' for object '" << GetName()
|
|
||||||
<< "' of type '" << GetReflectionType()->GetName() << "'"
|
|
||||||
<< " is deprecated. This functionality will be removed in 2.6.0. Please use an array.";
|
|
||||||
} else
|
|
||||||
SetCategoryFilter(FilterArrayToInt(categories, DbQuery::GetCategoryFilterMap(), DbCatEverything));
|
|
||||||
|
|
||||||
if (!GetEnableHa()) {
|
if (!GetEnableHa()) {
|
||||||
Log(LogDebug, "DbConnection")
|
Log(LogDebug, "DbConnection")
|
||||||
|
@ -498,6 +490,19 @@ void DbConnection::ValidateFailoverTimeout(double value, const ValidationUtils&
|
||||||
BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("failover_timeout"), "Failover timeout minimum is 60s."));
|
BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("failover_timeout"), "Failover timeout minimum is 60s."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DbConnection::ValidateCategories(const Array::Ptr& value, const ValidationUtils& utils)
|
||||||
|
{
|
||||||
|
ObjectImpl<DbConnection>::ValidateCategories(value, utils);
|
||||||
|
|
||||||
|
int filter = FilterArrayToInt(value, DbQuery::GetCategoryFilterMap(), 0);
|
||||||
|
|
||||||
|
if (filter == -1 || (filter & ~(DbCatInvalid | DbCatEverything | DbCatConfig | DbCatState |
|
||||||
|
DbCatAcknowledgement | DbCatComment | DbCatDowntime | DbCatEventHandler | DbCatExternalCommand |
|
||||||
|
DbCatFlapping | DbCatLog | DbCatNotification | DbCatProgramStatus | DbCatRetention |
|
||||||
|
DbCatStateHistory)) != 0)
|
||||||
|
BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("categories"), "categories filter is invalid."));
|
||||||
|
}
|
||||||
|
|
||||||
void DbConnection::IncreaseQueryCount(void)
|
void DbConnection::IncreaseQueryCount(void)
|
||||||
{
|
{
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
|
|
|
@ -77,6 +77,7 @@ public:
|
||||||
virtual int GetPendingQueryCount(void) const = 0;
|
virtual int GetPendingQueryCount(void) const = 0;
|
||||||
|
|
||||||
virtual void ValidateFailoverTimeout(double value, const ValidationUtils& utils) override;
|
virtual void ValidateFailoverTimeout(double value, const ValidationUtils& utils) override;
|
||||||
|
virtual void ValidateCategories(const Array::Ptr& value, const ValidationUtils& utils) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnConfigLoaded(void) override;
|
virtual void OnConfigLoaded(void) override;
|
||||||
|
|
|
@ -35,7 +35,7 @@ abstract class DbConnection : ConfigObject
|
||||||
default {{{ return new Dictionary(); }}}
|
default {{{ return new Dictionary(); }}}
|
||||||
};
|
};
|
||||||
|
|
||||||
[config] Value categories {
|
[config] Array::Ptr categories {
|
||||||
default {{{
|
default {{{
|
||||||
Array::Ptr cat = new Array();
|
Array::Ptr cat = new Array();
|
||||||
cat->Add("DbCatConfig");
|
cat->Add("DbCatConfig");
|
||||||
|
@ -90,10 +90,8 @@ validator DbConnection {
|
||||||
Number systemcommands_age;
|
Number systemcommands_age;
|
||||||
};
|
};
|
||||||
|
|
||||||
Number categories;
|
|
||||||
Array categories {
|
Array categories {
|
||||||
String "*";
|
String "*";
|
||||||
Number "*";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue