@@ -81,6 +81,23 @@ function register_system() {
81
81
'details_func ' => false ,
82
82
'trends_func ' => false
83
83
),
84
+ 'boost_history ' => array (
85
+ 'name ' => __ ('Boost History ' , 'intropage ' ),
86
+ 'description ' => __ ('Information about boost process history. ' , 'intropage ' ),
87
+ 'class ' => 'system ' ,
88
+ 'level ' => PANEL_SYSTEM ,
89
+ 'refresh ' => 300 ,
90
+ 'trefresh ' => read_config_option ('poller_interval ' ),
91
+ 'force ' => true ,
92
+ 'width ' => 'quarter-panel ' ,
93
+ 'priority ' => 48 ,
94
+ 'alarm ' => 'grey ' ,
95
+ 'requires ' => false ,
96
+ 'update_func ' => 'boost_history ' ,
97
+ 'details_func ' => false ,
98
+ 'trends_func ' => 'boost_history_trend '
99
+ ),
100
+
84
101
'extrem ' => array (
85
102
'name ' => __ ('24 Hour Extremes ' , 'intropage ' ),
86
103
'description ' => __ ('Table with 24 hours of Polling Extremes (longest poller run, down hosts) ' , 'intropage ' ),
@@ -263,6 +280,122 @@ function admin_alert($panel, $user_id) {
263
280
save_panel_result ($ panel , $ user_id );
264
281
}
265
282
283
+
284
+ function boost_history_trend () {
285
+
286
+ $ data_length = db_fetch_cell ("SELECT data_length
287
+ FROM INFORMATION_SCHEMA.TABLES WHERE table_schema=SCHEMA()
288
+ AND (table_name LIKE 'poller_output_boost_arch_%' OR table_name LIKE 'poller_output_boost') " );
289
+
290
+ db_execute_prepared ('INSERT INTO plugin_intropage_trends
291
+ (name, value, user_id)
292
+ VALUES ("boost_mem_size", ?, 0) ' ,
293
+ array ($ data_length ));
294
+
295
+ $ boost_table_status = db_fetch_assoc ("SELECT *
296
+ FROM INFORMATION_SCHEMA.TABLES WHERE table_schema=SCHEMA()
297
+ AND (table_name LIKE 'poller_output_boost_arch_%' OR table_name LIKE 'poller_output_boost') " );
298
+
299
+ $ pending_records = 0 ;
300
+ $ arch_records = 0 ;
301
+
302
+ if (cacti_sizeof ($ boost_table_status )) {
303
+ foreach ($ boost_table_status as $ table ) {
304
+ if ($ table ['TABLE_NAME ' ] == 'poller_output_boost ' ) {
305
+ $ pending_records += $ table ['TABLE_ROWS ' ];
306
+ } else {
307
+ $ arch_records += $ table ['TABLE_ROWS ' ];
308
+ }
309
+ }
310
+ }
311
+
312
+ db_execute_prepared ('INSERT INTO plugin_intropage_trends
313
+ (name, value, user_id)
314
+ VALUES ("boost_pending", ?, 0) ' ,
315
+ array ($ pending_records ));
316
+ }
317
+
318
+
319
+ function boost_history ($ panel , $ user_id , $ timespan = 0 ) {
320
+ global $ config ;
321
+
322
+ $ panel ['alarm ' ] = 'green ' ;
323
+
324
+ $ graph = array (
325
+ 'line ' => array (
326
+ 'title ' => __ ('Boost history: ' , 'intropage ' ),
327
+ 'label1 ' => array (),
328
+ 'data1 ' => array (),
329
+ 'label2 ' => array (),
330
+ 'data2 ' => array (),
331
+ ),
332
+ );
333
+
334
+ if ($ timespan == 0 ) {
335
+ if (isset ($ _SESSION ['sess_user_id ' ])) {
336
+ $ timespan = read_user_setting ('intropage_timespan ' , read_config_option ('intropage_timespan ' ), $ _SESSION ['sess_user_id ' ]);
337
+ } else {
338
+ $ timespan = $ panel ['refresh ' ];
339
+ }
340
+ }
341
+
342
+ if (!isset ($ panel ['refresh_interval ' ])) {
343
+ $ refresh = db_fetch_cell_prepared ('SELECT refresh_interval
344
+ FROM plugin_intropage_panel_data
345
+ WHERE id = ? ' ,
346
+ array ($ panel ['id ' ]));
347
+ } else {
348
+ $ refresh = $ panel ['refresh ' ];
349
+ }
350
+
351
+ $ rows = db_fetch_assoc_prepared ("SELECT cur_timestamp AS `date`, value
352
+ FROM plugin_intropage_trends
353
+ WHERE cur_timestamp > date_sub(NOW(), INTERVAL ? SECOND)
354
+ AND name = 'boost_mem_size'
355
+ ORDER BY cur_timestamp ASC " ,
356
+ array ($ timespan ));
357
+
358
+ if (cacti_sizeof ($ rows )) {
359
+ $ graph ['line ' ]['title1 ' ] = __ ('Mem ' , 'intropage ' );
360
+ $ graph ['line ' ]['unit1 ' ]['title ' ] = 'Used mem [KB] ' ;
361
+
362
+ foreach ($ rows as $ row ) {
363
+ $ graph ['line ' ]['label1 ' ][] = $ row ['date ' ];
364
+ $ graph ['line ' ]['data1 ' ][] = $ row ['value ' ]/1024 ;
365
+ }
366
+
367
+ $ rows = db_fetch_assoc_prepared ("SELECT cur_timestamp AS `date`, value
368
+ FROM plugin_intropage_trends
369
+ WHERE cur_timestamp > date_sub(NOW(), INTERVAL ? SECOND)
370
+ AND name = 'boost_pending'
371
+ ORDER BY cur_timestamp ASC " ,
372
+ array ($ timespan ));
373
+
374
+ if (cacti_sizeof ($ rows )) {
375
+ $ graph ['line ' ]['title2 ' ] = __ ('Pending records ' , 'intropage ' );
376
+ $ graph ['line ' ]['unit2 ' ]['title ' ] = 'Records ' ;
377
+
378
+ foreach ($ rows as $ row ) {
379
+ $ graph ['line ' ]['label2 ' ][] = $ row ['date ' ];
380
+ $ graph ['line ' ]['data2 ' ][] = $ row ['value ' ];
381
+ }
382
+ } else {
383
+ unset($ graph ['line ' ]['label2 ' ]);
384
+ unset($ graph ['line ' ]['data2 ' ]);
385
+ unset($ graph ['line ' ]['title2 ' ]);
386
+ unset($ graph ['line ' ]['unit2 ' ]);
387
+ }
388
+
389
+ $ panel ['data ' ] = intropage_prepare_graph ($ graph , $ user_id );
390
+ } else {
391
+ unset($ graph );
392
+ $ panel ['data ' ] = __ ('Waiting for data ' , 'intropage ' );
393
+ }
394
+
395
+ save_panel_result ($ panel , $ user_id );
396
+ }
397
+
398
+
266
399
//--------------------------------boost--------------------------------
267
400
function boost ($ panel , $ user_id ) {
268
401
global $ config , $ boost_refresh_interval , $ boost_max_runtime ;
@@ -290,6 +423,7 @@ function boost($panel, $user_id) {
290
423
$ data_length = 0 ;
291
424
$ engine = '' ;
292
425
$ max_data_length = 0 ;
426
+ $ total_records = 0 ;
293
427
294
428
if (cacti_sizeof ($ boost_table_status )) {
295
429
foreach ($ boost_table_status as $ table ) {
@@ -369,14 +503,12 @@ function boost($panel, $user_id) {
369
503
370
504
$ panel ['data ' ] .= '<tr><td> ' . __ ('Approximate Next Start Time: %s ' , $ next_run_time , 'intropage ' ) . '</td></tr> ' ;
371
505
372
- if ($ total_records ) {
373
- $ panel ['data ' ] .= '<tr><td> ' . __ ('Pending/Archived Records: %s / %s ' , number_format_i18n ($ pending_records , -1 ), number_format_i18n ($ arch_records , -1 ), 'intropage ' ) . '</td></tr> ' ;
506
+ $ panel ['data ' ] .= '<tr><td> ' . __ ('Pending/Archived Records: %s / %s ' , number_format_i18n ($ pending_records , -1 ), number_format_i18n ($ arch_records , -1 ), 'intropage ' ) . '</td></tr> ' ;
374
507
375
- if ($ total_records > ($ max_records - ($ max_records / 10 )) && $ panel ['alarm ' ] == 'green ' ) {
376
- $ panel ['alarm ' ] = 'yellow ' ;
377
- } elseif ($ total_records > ($ max_records - ($ max_records / 20 )) && $ panel ['alarm ' ] == 'green ' ) {
378
- $ panel ['alarm ' ] = 'red ' ;
379
- }
508
+ if ($ total_records > ($ max_records - ($ max_records / 10 )) && $ panel ['alarm ' ] == 'green ' ) {
509
+ $ panel ['alarm ' ] = 'yellow ' ;
510
+ } elseif ($ total_records > ($ max_records - ($ max_records / 20 )) && $ panel ['alarm ' ] == 'green ' ) {
511
+ $ panel ['alarm ' ] = 'red ' ;
380
512
}
381
513
382
514
$ data_length = db_fetch_cell ("SELECT data_length
@@ -444,7 +576,7 @@ function extrem_trend() {
444
576
//------------------------------------ extrem -----------------------------------------------------
445
577
function extrem ($ panel , $ user_id ) {
446
578
global $ config ;
447
-
579
+
448
580
$ lines = read_user_setting ('intropage_number_of_lines ' , read_config_option ('intropage_number_of_lines ' ), false , $ user_id );
449
581
$ poller_interval = read_config_option ('poller_interval ' );
450
582
0 commit comments