File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 164164
165165$ params = [];
166166$ params [] = $ poller_id ;
167- $ sql_where = 'AND poller_id = ? ' ;
167+ $ sql_where = ' AND poller_id = ? ' ;
168168
169169if ($ test_id > 0 ) {
170170 $ sql_where = ' AND id = ? ' ;
173173
174174$ tests = db_fetch_assoc_prepared ("SELECT *
175175 FROM plugin_servcheck_test
176- WHERE enabled = 'on',
177- $ sql_where " ,
176+ WHERE enabled = 'on'
177+ $ sql_where " ,
178178 $ params );
179179
180180$ max_processes = read_config_option ('servcheck_processes ' );
248248$ stat_search_ok = 0 ;
249249$ stat_search_ko = 0 ;
250250
251- foreach ($ tests as $ test ) {
252- $ test_last = db_fetch_row_prepared ('SELECT result, result_search
253- FROM plugin_servcheck_log
254- WHERE test_id = ?
255- ORDER BY id DESC LIMIT 1 ' ,
256- [$ test ['id ' ]]);
257-
258- if (isset ($ test_last ['result ' ]) && ($ test_last ['result ' ] == 'ok ' || $ test_last ['result ' ] == 'not yet ' )) {
259- $ stat_ok ++;
260- } else {
261- $ stat_ko ++;
262- }
251+ if (cacti_sizeof ($ tests )) {
252+ foreach ($ tests as $ test ) {
253+ $ test_last = db_fetch_row_prepared ('SELECT result, result_search
254+ FROM plugin_servcheck_log
255+ WHERE test_id = ?
256+ ORDER BY id DESC LIMIT 1 ' ,
257+ [$ test ['id ' ]]);
258+
259+ if (isset ($ test_last ['result ' ]) && ($ test_last ['result ' ] == 'ok ' || $ test_last ['result ' ] == 'not yet ' )) {
260+ $ stat_ok ++;
261+ } else {
262+ $ stat_ko ++;
263+ }
263264
264- if (isset ($ test_last ['result_search ' ]) && ($ test_last ['result_search ' ] == 'ok ' || $ test_last ['result_search ' ] == 'not yet ' || $ test_last ['result_search ' ] == 'not tested ' )) {
265- $ stat_search_ok ++;
266- } else {
267- $ stat_search_ko ++;
265+ if (isset ($ test_last ['result_search ' ]) && ($ test_last ['result_search ' ] == 'ok ' || $ test_last ['result_search ' ] == 'not yet ' || $ test_last ['result_search ' ] == 'not tested ' )) {
266+ $ stat_search_ok ++;
267+ } else {
268+ $ stat_search_ko ++;
269+ }
268270 }
269271}
270272
You can’t perform that action at this time.
0 commit comments