Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions poller_servcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@

$params = [];
$params[] = $poller_id;
$sql_where = 'AND poller_id = ?';
$sql_where = ' AND poller_id = ?';

if ($test_id > 0) {
$sql_where = ' AND id = ?';
Expand All @@ -173,8 +173,8 @@

$tests = db_fetch_assoc_prepared("SELECT *
FROM plugin_servcheck_test
WHERE enabled = 'on',
$sql_where",
WHERE enabled = 'on'
$sql_where",
$params);

$max_processes = read_config_option('servcheck_processes');
Expand Down Expand Up @@ -248,23 +248,25 @@
$stat_search_ok = 0;
$stat_search_ko = 0;

foreach ($tests as $test) {
$test_last = db_fetch_row_prepared('SELECT result, result_search
FROM plugin_servcheck_log
WHERE test_id = ?
ORDER BY id DESC LIMIT 1',
[$test['id']]);

if (isset($test_last['result']) && ($test_last['result'] == 'ok' || $test_last['result'] == 'not yet')) {
$stat_ok++;
} else {
$stat_ko++;
}
if (cacti_sizeof($tests)) {
foreach ($tests as $test) {
$test_last = db_fetch_row_prepared('SELECT result, result_search
FROM plugin_servcheck_log
WHERE test_id = ?
ORDER BY id DESC LIMIT 1',
[$test['id']]);

if (isset($test_last['result']) && ($test_last['result'] == 'ok' || $test_last['result'] == 'not yet')) {
$stat_ok++;
} else {
$stat_ko++;
}

if (isset($test_last['result_search']) && ($test_last['result_search'] == 'ok' || $test_last['result_search'] == 'not yet ' || $test_last['result_search'] == 'not tested')) {
$stat_search_ok++;
} else {
$stat_search_ko++;
if (isset($test_last['result_search']) && ($test_last['result_search'] == 'ok' || $test_last['result_search'] == 'not yet' || $test_last['result_search'] == 'not tested')) {
$stat_search_ok++;
} else {
$stat_search_ko++;
}
}
}

Expand Down