16
16
17
17
using namespace icinga ;
18
18
19
- REGISTER_FUNCTION_NONCONST (Internal, IdoCheck, &IdoCheckTask::ScriptFunc, " checkable:cr:resolvedMacros:useResolvedMacros" );
19
+ REGISTER_FUNCTION_NONCONST (Internal, IdoCheck, &IdoCheckTask::ScriptFunc, " checkable:cr:producer: resolvedMacros:useResolvedMacros" );
20
20
21
21
static void ReportIdoCheck (
22
- const Checkable::Ptr& checkable, const CheckCommand::Ptr& commandObj,
23
- const CheckResult ::Ptr& cr , String output, ServiceState state = ServiceUnknown
22
+ const Checkable::Ptr& checkable, const CheckCommand::Ptr& commandObj, const CheckResult::Ptr& cr,
23
+ const WaitGroup ::Ptr& producer , String output, ServiceState state = ServiceUnknown
24
24
)
25
25
{
26
26
if (Checkable::ExecuteCommandProcessFinishedHandler) {
@@ -36,12 +36,12 @@ static void ReportIdoCheck(
36
36
} else {
37
37
cr->SetState (state);
38
38
cr->SetOutput (output);
39
- checkable->ProcessCheckResult (cr);
39
+ checkable->ProcessCheckResult (cr, producer );
40
40
}
41
41
}
42
42
43
43
void IdoCheckTask::ScriptFunc (const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
44
- const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
44
+ const WaitGroup::Ptr& producer, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
45
45
{
46
46
ServiceState state;
47
47
CheckCommand::Ptr commandObj = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand ();
@@ -88,19 +88,19 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
88
88
return ;
89
89
90
90
if (idoType.IsEmpty ()) {
91
- ReportIdoCheck (checkable, commandObj, cr, " Attribute 'ido_type' must be set." );
91
+ ReportIdoCheck (checkable, commandObj, cr, producer, " Attribute 'ido_type' must be set." );
92
92
return ;
93
93
}
94
94
95
95
if (idoName.IsEmpty ()) {
96
- ReportIdoCheck (checkable, commandObj, cr, " Attribute 'ido_name' must be set." );
96
+ ReportIdoCheck (checkable, commandObj, cr, producer, " Attribute 'ido_name' must be set." );
97
97
return ;
98
98
}
99
99
100
100
Type::Ptr type = Type::GetByName (idoType);
101
101
102
102
if (!type || !DbConnection::TypeInstance->IsAssignableFrom (type)) {
103
- ReportIdoCheck (checkable, commandObj, cr, " DB IDO type '" + idoType + " ' is invalid." );
103
+ ReportIdoCheck (checkable, commandObj, cr, producer, " DB IDO type '" + idoType + " ' is invalid." );
104
104
return ;
105
105
}
106
106
@@ -110,25 +110,25 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
110
110
DbConnection::Ptr conn = static_pointer_cast<DbConnection>(dtype->GetObject (idoName));
111
111
112
112
if (!conn) {
113
- ReportIdoCheck (checkable, commandObj, cr, " DB IDO connection '" + idoName + " ' does not exist." );
113
+ ReportIdoCheck (checkable, commandObj, cr, producer, " DB IDO connection '" + idoName + " ' does not exist." );
114
114
return ;
115
115
}
116
116
117
117
double qps = conn->GetQueryCount (60 ) / 60.0 ;
118
118
119
119
if (conn->IsPaused ()) {
120
- ReportIdoCheck (checkable, commandObj, cr, " DB IDO connection is temporarily disabled on this cluster instance." , ServiceOK);
120
+ ReportIdoCheck (checkable, commandObj, cr, producer, " DB IDO connection is temporarily disabled on this cluster instance." , ServiceOK);
121
121
return ;
122
122
}
123
123
124
124
double pendingQueries = conn->GetPendingQueryCount ();
125
125
126
126
if (!conn->GetConnected ()) {
127
127
if (conn->GetShouldConnect ()) {
128
- ReportIdoCheck (checkable, commandObj, cr, " Could not connect to the database server." , ServiceCritical);
128
+ ReportIdoCheck (checkable, commandObj, cr, producer, " Could not connect to the database server." , ServiceCritical);
129
129
} else {
130
130
ReportIdoCheck (
131
- checkable, commandObj, cr,
131
+ checkable, commandObj, cr, producer,
132
132
" Not currently enabled: Another cluster instance is responsible for the IDO database." , ServiceOK
133
133
);
134
134
}
@@ -193,5 +193,5 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
193
193
{ new PerfdataValue (" pending_queries" , pendingQueries, false , " " , pendingQueriesWarning, pendingQueriesCritical) }
194
194
}));
195
195
196
- ReportIdoCheck (checkable, commandObj, cr, msgbuf.str (), state);
196
+ ReportIdoCheck (checkable, commandObj, cr, producer, msgbuf.str (), state);
197
197
}
0 commit comments