mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
parent
4cf4ffe893
commit
d618762dad
@ -199,6 +199,8 @@ New columns:
|
|||||||
{host,service}group | notes_url | TEXT | NULL | -
|
{host,service}group | notes_url | TEXT | NULL | -
|
||||||
{host,service}group | action_url | TEXT | NULL | -
|
{host,service}group | action_url | TEXT | NULL | -
|
||||||
customvariable* | is_json | integer | 0 | Defines whether `varvalue` is a json encoded string from custom attributes, or not
|
customvariable* | is_json | integer | 0 | Defines whether `varvalue` is a json encoded string from custom attributes, or not
|
||||||
|
servicestatus | original_attributes | TEXT | NULL | JSON encoded dictionary of original attributes if modified at runtime.
|
||||||
|
hoststatus | original_attributes | TEXT | NULL | JSON encoded dictionary of original attributes if modified at runtime.
|
||||||
|
|
||||||
Additional command custom variables populated from 'vars' dictionary.
|
Additional command custom variables populated from 'vars' dictionary.
|
||||||
Additional global custom variables populated from 'Vars' constant (object_id is NULL).
|
Additional global custom variables populated from 'Vars' constant (object_id is NULL).
|
||||||
@ -249,6 +251,8 @@ New columns:
|
|||||||
status | custom_variable_names
|
status | custom_variable_names
|
||||||
status | custom_variable_values
|
status | custom_variable_values
|
||||||
status | custom_variables
|
status | custom_variables
|
||||||
|
hosts | original_attributes
|
||||||
|
services | original_attributes
|
||||||
|
|
||||||
Command custom variables reflect the local 'vars' dictionary.
|
Command custom variables reflect the local 'vars' dictionary.
|
||||||
Status custom variables reflect the global 'Vars' constant.
|
Status custom variables reflect the global 'Vars' constant.
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
|
#include "base/json.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -170,6 +171,8 @@ Dictionary::Ptr HostDbObject::GetStatusFields(void) const
|
|||||||
fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
|
fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
|
||||||
fields->Set("is_reachable", CompatUtility::GetCheckableIsReachable(host));
|
fields->Set("is_reachable", CompatUtility::GetCheckableIsReachable(host));
|
||||||
|
|
||||||
|
fields->Set("original_attributes", JsonEncode(host->GetOriginalAttributes()));
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "base/configtype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
|
#include "base/json.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
|
|
||||||
@ -164,6 +165,8 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const
|
|||||||
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
||||||
fields->Set("is_reachable", CompatUtility::GetCheckableIsReachable(service));
|
fields->Set("is_reachable", CompatUtility::GetCheckableIsReachable(service));
|
||||||
|
|
||||||
|
fields->Set("original_attributes", JsonEncode(service->GetOriginalAttributes()));
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,6 +744,7 @@ CREATE TABLE IF NOT EXISTS icinga_hoststatus (
|
|||||||
process_performance_data smallint default 0,
|
process_performance_data smallint default 0,
|
||||||
obsess_over_host smallint default 0,
|
obsess_over_host smallint default 0,
|
||||||
modified_host_attributes int default 0,
|
modified_host_attributes int default 0,
|
||||||
|
original_attributes TEXT character set latin1 default NULL,
|
||||||
event_handler TEXT character set latin1 default '',
|
event_handler TEXT character set latin1 default '',
|
||||||
check_command TEXT character set latin1 default '',
|
check_command TEXT character set latin1 default '',
|
||||||
normal_check_interval double default '0',
|
normal_check_interval double default '0',
|
||||||
@ -1230,6 +1231,7 @@ CREATE TABLE IF NOT EXISTS icinga_servicestatus (
|
|||||||
process_performance_data smallint default 0,
|
process_performance_data smallint default 0,
|
||||||
obsess_over_service smallint default 0,
|
obsess_over_service smallint default 0,
|
||||||
modified_service_attributes int default 0,
|
modified_service_attributes int default 0,
|
||||||
|
original_attributes TEXT character set latin1 default NULL,
|
||||||
event_handler TEXT character set latin1 default '',
|
event_handler TEXT character set latin1 default '',
|
||||||
check_command TEXT character set latin1 default '',
|
check_command TEXT character set latin1 default '',
|
||||||
normal_check_interval double default '0',
|
normal_check_interval double default '0',
|
||||||
|
@ -41,6 +41,13 @@ CREATE TABLE IF NOT EXISTS icinga_zonestatus (
|
|||||||
ALTER TABLE icinga_services MODIFY freshness_threshold int;
|
ALTER TABLE icinga_services MODIFY freshness_threshold int;
|
||||||
ALTER TABLE icinga_hosts MODIFY freshness_threshold int;
|
ALTER TABLE icinga_hosts MODIFY freshness_threshold int;
|
||||||
|
|
||||||
|
-- -----------------------------------------
|
||||||
|
-- #10392 - original attributes
|
||||||
|
-- -----------------------------------------
|
||||||
|
|
||||||
|
ALTER TABLE icinga_servicestatus ADD COLUMN original_attributes TEXT character set latin1 default NULL;
|
||||||
|
ALTER TABLE icinga_hoststatus ADD COLUMN original_attributes TEXT character set latin1 default NULL;
|
||||||
|
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
-- update dbversion
|
-- update dbversion
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
|
@ -770,6 +770,7 @@ CREATE TABLE icinga_hoststatus (
|
|||||||
process_performance_data INTEGER default 0,
|
process_performance_data INTEGER default 0,
|
||||||
obsess_over_host INTEGER default 0,
|
obsess_over_host INTEGER default 0,
|
||||||
modified_host_attributes INTEGER default 0,
|
modified_host_attributes INTEGER default 0,
|
||||||
|
original_attributes TEXT default NULL,
|
||||||
event_handler TEXT default '',
|
event_handler TEXT default '',
|
||||||
check_command TEXT default '',
|
check_command TEXT default '',
|
||||||
normal_check_interval double precision default 0,
|
normal_check_interval double precision default 0,
|
||||||
@ -1256,6 +1257,7 @@ CREATE TABLE icinga_servicestatus (
|
|||||||
process_performance_data INTEGER default 0,
|
process_performance_data INTEGER default 0,
|
||||||
obsess_over_service INTEGER default 0,
|
obsess_over_service INTEGER default 0,
|
||||||
modified_service_attributes INTEGER default 0,
|
modified_service_attributes INTEGER default 0,
|
||||||
|
original_attributes TEXT default NULL,
|
||||||
event_handler TEXT default '',
|
event_handler TEXT default '',
|
||||||
check_command TEXT default '',
|
check_command TEXT default '',
|
||||||
normal_check_interval double precision default 0,
|
normal_check_interval double precision default 0,
|
||||||
|
@ -151,6 +151,12 @@ CREATE TABLE icinga_zonestatus (
|
|||||||
CONSTRAINT UQ_zonestatus UNIQUE (zone_object_id)
|
CONSTRAINT UQ_zonestatus UNIQUE (zone_object_id)
|
||||||
) ;
|
) ;
|
||||||
|
|
||||||
|
-- -----------------------------------------
|
||||||
|
-- #10392 original attributes
|
||||||
|
-- -----------------------------------------
|
||||||
|
ALTER TABLE icinga_servicestatus ADD COLUMN original_attributes TEXT default NULL;
|
||||||
|
ALTER TABLE icinga_hoststatus ADD COLUMN original_attributes TEXT default NULL;
|
||||||
|
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
-- update dbversion
|
-- update dbversion
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
|
@ -164,6 +164,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
|
|||||||
table->AddColumn(prefix + "check_source", Column(&HostsTable::CheckSourceAccessor, objectAccessor));
|
table->AddColumn(prefix + "check_source", Column(&HostsTable::CheckSourceAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "is_reachable", Column(&HostsTable::IsReachableAccessor, objectAccessor));
|
table->AddColumn(prefix + "is_reachable", Column(&HostsTable::IsReachableAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "cv_is_json", Column(&HostsTable::CVIsJsonAccessor, objectAccessor));
|
table->AddColumn(prefix + "cv_is_json", Column(&HostsTable::CVIsJsonAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "original_attributes", Column(&HostsTable::OriginalAttributesAccessor, objectAccessor));
|
||||||
|
|
||||||
/* add additional group by values received through the object accessor */
|
/* add additional group by values received through the object accessor */
|
||||||
if (table->GetGroupByType() == LivestatusGroupByHostGroup) {
|
if (table->GetGroupByType() == LivestatusGroupByHostGroup) {
|
||||||
@ -1570,3 +1571,13 @@ Value HostsTable::IsReachableAccessor(const Value& row)
|
|||||||
|
|
||||||
return host->IsReachable();
|
return host->IsReachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value HostsTable::OriginalAttributesAccessor(const Value& row)
|
||||||
|
{
|
||||||
|
Host::Ptr host = static_cast<Host::Ptr>(row);
|
||||||
|
|
||||||
|
if (!host)
|
||||||
|
return Empty;
|
||||||
|
|
||||||
|
return JsonEncode(host->GetOriginalAttributes());
|
||||||
|
}
|
||||||
|
@ -144,6 +144,7 @@ protected:
|
|||||||
static Value CheckSourceAccessor(const Value& row);
|
static Value CheckSourceAccessor(const Value& row);
|
||||||
static Value IsReachableAccessor(const Value& row);
|
static Value IsReachableAccessor(const Value& row);
|
||||||
static Value CVIsJsonAccessor(const Value& row);
|
static Value CVIsJsonAccessor(const Value& row);
|
||||||
|
static Value OriginalAttributesAccessor(const Value& row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,7 @@ void ServicesTable::AddColumns(Table *table, const String& prefix,
|
|||||||
table->AddColumn(prefix + "check_source", Column(&ServicesTable::CheckSourceAccessor, objectAccessor));
|
table->AddColumn(prefix + "check_source", Column(&ServicesTable::CheckSourceAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "is_reachable", Column(&ServicesTable::IsReachableAccessor, objectAccessor));
|
table->AddColumn(prefix + "is_reachable", Column(&ServicesTable::IsReachableAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "cv_is_json", Column(&ServicesTable::CVIsJsonAccessor, objectAccessor));
|
table->AddColumn(prefix + "cv_is_json", Column(&ServicesTable::CVIsJsonAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "original_attributes", Column(&ServicesTable::OriginalAttributesAccessor, objectAccessor));
|
||||||
|
|
||||||
HostsTable::AddColumns(table, "host_", boost::bind(&ServicesTable::HostAccessor, _1, objectAccessor));
|
HostsTable::AddColumns(table, "host_", boost::bind(&ServicesTable::HostAccessor, _1, objectAccessor));
|
||||||
|
|
||||||
@ -1266,3 +1267,13 @@ Value ServicesTable::IsReachableAccessor(const Value& row)
|
|||||||
|
|
||||||
return service->IsReachable();
|
return service->IsReachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value ServicesTable::OriginalAttributesAccessor(const Value& row)
|
||||||
|
{
|
||||||
|
Service::Ptr service = static_cast<Service::Ptr>(row);
|
||||||
|
|
||||||
|
if (!service)
|
||||||
|
return Empty;
|
||||||
|
|
||||||
|
return JsonEncode(service->GetOriginalAttributes());
|
||||||
|
}
|
||||||
|
@ -127,6 +127,7 @@ protected:
|
|||||||
static Value CheckSourceAccessor(const Value& row);
|
static Value CheckSourceAccessor(const Value& row);
|
||||||
static Value IsReachableAccessor(const Value& row);
|
static Value IsReachableAccessor(const Value& row);
|
||||||
static Value CVIsJsonAccessor(const Value& row);
|
static Value CVIsJsonAccessor(const Value& row);
|
||||||
|
static Value OriginalAttributesAccessor(const Value& row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
GET hosts
|
GET hosts
|
||||||
Columns: name modified_attributes modified_attributes_list
|
Columns: name modified_attributes modified_attributes_list original_attributes
|
||||||
ResponseHeader: fixed16
|
ResponseHeader: fixed16
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
GET services
|
GET services
|
||||||
Columns: name modified_attributes modified_attributes_list
|
Columns: description modified_attributes modified_attributes_list original_attributes
|
||||||
ResponseHeader: fixed16
|
ResponseHeader: fixed16
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NC=`which nc`
|
NC=`which nc`
|
||||||
LIVESTATUSSOCKET="/var/run/icinga2/cmd/livestatus"
|
LOCALSTATEDIR=`icinga2 variable get LocalStateDir`
|
||||||
|
LIVESTATUSSOCKET="$LOCALSTATEDIR/run/icinga2/cmd/livestatus"
|
||||||
LIVESTATUSHOST="127.0.0.1"
|
LIVESTATUSHOST="127.0.0.1"
|
||||||
LIVESTATUSPORT="6558"
|
LIVESTATUSPORT="6558"
|
||||||
LIVESTATUSQUERIES="./queries"
|
LIVESTATUSQUERIES="./queries"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user