2012-07-09 20:32:02 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
|
|
|
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 2 *
|
|
|
|
* of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* 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 St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
2012-07-02 12:34:54 +02:00
|
|
|
#include "i2-cib.h"
|
2012-06-25 14:13:24 +02:00
|
|
|
|
|
|
|
using namespace icinga;
|
|
|
|
|
2012-07-03 10:39:17 +02:00
|
|
|
CheckResult::CheckResult(void)
|
|
|
|
: MessagePart()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
CheckResult::CheckResult(const MessagePart& message)
|
|
|
|
: MessagePart(message)
|
|
|
|
{ }
|
|
|
|
|
2012-07-25 12:59:17 +02:00
|
|
|
void CheckResult::SetScheduleStart(double ts)
|
2012-06-25 14:13:24 +02:00
|
|
|
{
|
2012-07-25 12:59:17 +02:00
|
|
|
Set("schedule_start", ts);
|
2012-06-25 14:13:24 +02:00
|
|
|
}
|
|
|
|
|
2012-07-25 12:59:17 +02:00
|
|
|
double CheckResult::GetScheduleStart(void) const
|
2012-06-25 14:13:24 +02:00
|
|
|
{
|
2012-07-25 12:59:17 +02:00
|
|
|
double value = 0;
|
2012-07-09 16:19:56 +02:00
|
|
|
Get("schedule_start", &value);
|
2012-07-25 12:59:17 +02:00
|
|
|
return value;
|
2012-06-25 14:13:24 +02:00
|
|
|
}
|
|
|
|
|
2012-07-25 12:59:17 +02:00
|
|
|
void CheckResult::SetScheduleEnd(double ts)
|
2012-06-25 14:13:24 +02:00
|
|
|
{
|
2012-07-25 12:59:17 +02:00
|
|
|
Set("schedule_end", ts);
|
2012-06-25 14:13:24 +02:00
|
|
|
}
|
|
|
|
|
2012-07-25 12:59:17 +02:00
|
|
|
double CheckResult::GetScheduleEnd(void) const
|
2012-06-25 14:13:24 +02:00
|
|
|
{
|
2012-07-25 12:59:17 +02:00
|
|
|
double value = 0;
|
2012-07-09 16:19:56 +02:00
|
|
|
Get("schedule_end", &value);
|
2012-07-25 12:59:17 +02:00
|
|
|
return value;
|
2012-06-25 14:13:24 +02:00
|
|
|
}
|
|
|
|
|
2012-07-25 12:59:17 +02:00
|
|
|
void CheckResult::SetExecutionStart(double ts)
|
2012-06-27 23:38:50 +02:00
|
|
|
{
|
2012-07-25 12:59:17 +02:00
|
|
|
Set("execution_start", ts);
|
2012-06-27 23:38:50 +02:00
|
|
|
}
|
|
|
|
|
2012-07-25 12:59:17 +02:00
|
|
|
double CheckResult::GetExecutionStart(void) const
|
2012-06-27 23:38:50 +02:00
|
|
|
{
|
2012-07-25 12:59:17 +02:00
|
|
|
double value = 0;
|
2012-07-09 16:19:56 +02:00
|
|
|
Get("execution_start", &value);
|
2012-07-25 12:59:17 +02:00
|
|
|
return value;
|
2012-06-27 23:38:50 +02:00
|
|
|
}
|
|
|
|
|
2012-07-25 12:59:17 +02:00
|
|
|
void CheckResult::SetExecutionEnd(double ts)
|
2012-06-27 23:38:50 +02:00
|
|
|
{
|
2012-07-25 12:59:17 +02:00
|
|
|
Set("execution_end", ts);
|
2012-06-27 23:38:50 +02:00
|
|
|
}
|
|
|
|
|
2012-07-25 12:59:17 +02:00
|
|
|
double CheckResult::GetExecutionEnd(void) const
|
2012-06-27 23:38:50 +02:00
|
|
|
{
|
2012-07-25 12:59:17 +02:00
|
|
|
double value = 0;
|
2012-07-09 16:19:56 +02:00
|
|
|
Get("execution_end", &value);
|
2012-06-27 23:38:50 +02:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2012-06-25 15:42:46 +02:00
|
|
|
void CheckResult::SetState(ServiceState state)
|
2012-06-25 14:13:24 +02:00
|
|
|
{
|
2012-07-09 16:19:56 +02:00
|
|
|
Set("state", static_cast<long>(state));
|
2012-06-25 14:13:24 +02:00
|
|
|
}
|
|
|
|
|
2012-06-25 15:42:46 +02:00
|
|
|
ServiceState CheckResult::GetState(void) const
|
2012-06-25 14:13:24 +02:00
|
|
|
{
|
|
|
|
long value = StateUnknown;
|
2012-07-09 16:19:56 +02:00
|
|
|
Get("state", &value);
|
2012-06-25 15:42:46 +02:00
|
|
|
return static_cast<ServiceState>(value);
|
2012-06-25 14:13:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CheckResult::SetOutput(string output)
|
|
|
|
{
|
2012-07-09 16:19:56 +02:00
|
|
|
Set("output", output);
|
2012-06-25 14:13:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
string CheckResult::GetOutput(void) const
|
|
|
|
{
|
|
|
|
string value;
|
2012-07-09 16:19:56 +02:00
|
|
|
Get("output", &value);
|
2012-06-25 14:13:24 +02:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2012-06-29 14:14:51 +02:00
|
|
|
void CheckResult::SetPerformanceDataRaw(const string& pd)
|
|
|
|
{
|
2012-07-09 16:19:56 +02:00
|
|
|
Set("performance_data_raw", pd);
|
2012-06-29 14:14:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
string CheckResult::GetPerformanceDataRaw(void) const
|
|
|
|
{
|
|
|
|
string value;
|
2012-07-09 16:19:56 +02:00
|
|
|
Get("performance_data_raw", &value);
|
2012-06-29 14:14:51 +02:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2012-06-25 14:13:24 +02:00
|
|
|
void CheckResult::SetPerformanceData(const Dictionary::Ptr& pd)
|
|
|
|
{
|
2012-07-09 16:19:56 +02:00
|
|
|
Set("performance_data", pd);
|
2012-06-25 14:13:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Dictionary::Ptr CheckResult::GetPerformanceData(void) const
|
|
|
|
{
|
|
|
|
Dictionary::Ptr value;
|
2012-07-09 16:19:56 +02:00
|
|
|
Get("performance_data", &value);
|
2012-06-25 14:13:24 +02:00
|
|
|
return value;
|
|
|
|
}
|