1616
1717using namespace icinga ;
1818
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" );
2020
2121static 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 CheckResultProducer ::Ptr& producer , String output, ServiceState state = ServiceUnknown
2424)
2525{
2626 if (Checkable::ExecuteCommandProcessFinishedHandler) {
@@ -36,12 +36,12 @@ static void ReportIdoCheck(
3636 } else {
3737 cr->SetState (state);
3838 cr->SetOutput (output);
39- checkable->ProcessCheckResult (cr);
39+ checkable->ProcessCheckResult (cr, producer );
4040 }
4141}
4242
4343void IdoCheckTask::ScriptFunc (const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
44- const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
44+ const CheckResultProducer::Ptr& producer, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
4545{
4646 ServiceState state;
4747 CheckCommand::Ptr commandObj = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand ();
@@ -88,19 +88,19 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
8888 return ;
8989
9090 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." );
9292 return ;
9393 }
9494
9595 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." );
9797 return ;
9898 }
9999
100100 Type::Ptr type = Type::GetByName (idoType);
101101
102102 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." );
104104 return ;
105105 }
106106
@@ -110,25 +110,25 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
110110 DbConnection::Ptr conn = static_pointer_cast<DbConnection>(dtype->GetObject (idoName));
111111
112112 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." );
114114 return ;
115115 }
116116
117117 double qps = conn->GetQueryCount (60 ) / 60.0 ;
118118
119119 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);
121121 return ;
122122 }
123123
124124 double pendingQueries = conn->GetPendingQueryCount ();
125125
126126 if (!conn->GetConnected ()) {
127127 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);
129129 } else {
130130 ReportIdoCheck (
131- checkable, commandObj, cr,
131+ checkable, commandObj, cr, producer,
132132 " Not currently enabled: Another cluster instance is responsible for the IDO database." , ServiceOK
133133 );
134134 }
@@ -193,5 +193,5 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
193193 { new PerfdataValue (" pending_queries" , pendingQueries, false , " " , pendingQueriesWarning, pendingQueriesCritical) }
194194 }));
195195
196- ReportIdoCheck (checkable, commandObj, cr, msgbuf.str (), state);
196+ ReportIdoCheck (checkable, commandObj, cr, producer, msgbuf.str (), state);
197197}
0 commit comments