Skip to content
Snippets Groups Projects
Commit a87013bf authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'update-appmonitor' into 'master'

Update appmonitor

See merge request !90
parents 5a8f68a4 7dae943b
Branches
No related tags found
No related merge requests found
<?php
require_once('classes/appmonitor-client.class.php');
require_once(__DIR__.'/../deployment/classes/project.class.php');
$oMonitor = new appmonitor();
$oMonitor->addCheck(
......@@ -77,6 +78,67 @@ foreach (array(
);
}
// ----------------------------------------------------------------------
// count of Projects
// ----------------------------------------------------------------------
$oPrj=new project();
$iProjectCount=count($oPrj->getProjects());
$iInProgress=0;
$iInQueue=0;
foreach ($oPrj->getProjects() as $sPrj) {
$oPrj->getPhases();
$aProgress=$oPrj->getProgress();
$iInProgress+=$aProgress['inprogress'] ? 1 : 0;
$iInQueue+=$aProgress['hasQueue'] ? 1 : 0;
}
$oMonitor->addCheck(
array(
"name" => "ci projects",
"description" => "Count of Projects in CI Webgui",
"check" => array(
"function" => "Simple",
"params" => array(
"result" => $iProjectCount ? RESULT_OK : RESULT_ERROR,
"value" => "found projects: $iProjectCount",
"count" => $iProjectCount,
"visual" => "simple",
),
),
)
);
$oMonitor->addCheck(
array(
"name" => "ci inProgress",
"description" => "Projects in progress",
"check" => array(
"function" => "Simple",
"params" => array(
"result" => RESULT_OK,
"value" => "found projects: $iInProgress",
"count" => $iInProgress,
"visual" => "simple",
),
),
)
);
$oMonitor->addCheck(
array(
"name" => "ci hasqueue",
"description" => "Waiting for install",
"check" => array(
"function" => "Simple",
"params" => array(
"result" => RESULT_OK,
"value" => "found projects: $iInQueue",
"count" => $iInQueue,
"visual" => "simple",
),
),
)
);
// ----------------------------------------------------------------------
// foreman
// ----------------------------------------------------------------------
......@@ -99,12 +161,12 @@ if(isset($aConfig['foreman']['api'])){
$oMonitor->addCheck(
array(
"name" => "Foreman $sForemanKey",
"description" => "Count of $sForemanKey",
"description" => "Count of Foreman $sForemanKey",
"check" => array(
"function" => "Simple",
"params" => array(
"result" => count($aFData) ? RESULT_OK : RESULT_ERROR,
"value" => "Count of found $sForemanKey: " . count($aFData)."; response status: ".$oForeman->getResponseStatus() . "; Http-Code ".$oForeman->getResponseInfo('http_code'),
"value" => "Count of found Foreman $sForemanKey: " . count($aFData)."; response status: ".$oForeman->getResponseStatus() . "; Http-Code ".$oForeman->getResponseInfo('http_code'),
"count" => count($aFData),
"visual" => "simple",
),
......
......@@ -3,6 +3,7 @@
define("OPTION_DEFAULT", -999);
define("OPTION_NONE", -1);
require_once __DIR__.'/../inc_functions.php';
require_once 'base.class.php';
require_once 'htmlguielements.class.php';
require_once 'messenger.class.php';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment